Hello guys,
I bought SpaceMouseCompact.
I installed the driver 3DxWare64_v10-8-8_r3488.exe in Windows10 Home 64bit version 21H2.
I tried sample program in SDK.
SpaceMouse_Module_SDKv1.zip\SpaceMouse Module SDKv1\Sample_Software_USB
Release\3DxSMM_USB_SensorDemo.exe is executed and I manipulate SpaceMouseCompact,
but there is no change on Demo program dialog.
I also build 3DxSMM_USB_SensorDemo.exe from source code,
but there is no change on Demo program dialog.
Dose anyone know the solution about Sample_Software_USB ?
I want X,Y,Z,A,B,C axis movement information in C++ language for my work.
Thanks,
Masumi
Sample_Software_USB
Moderator: Moderators
Re: Sample_Software_USB
The SpaceMouse Module SDK is for an different product where the cap is mounted in an industrial setting, such as a robot controller.
The commercial products use a different SDK: which can be downloaded here
The commercial products use a different SDK: which can be downloaded here
Re: Sample_Software_USB
Hi jwick,
Thank you for your reply.
I can find two programs for Windows platform in your link.
Windows 3DxWare SDK 4.0.2 Release Date: 2020/07/30
SpaceMouse Module SDK 1.0 Release Date: 2014/04/29
"Windows 3DxWare SDK 4.0.2", there is no sample code for C++ language.
"SpaceMouse Module SDK 1.0" failed, I mentioned.
Do you mean these sample code ?
Thanks,
Masumi
Thank you for your reply.
I can find two programs for Windows platform in your link.
Windows 3DxWare SDK 4.0.2 Release Date: 2020/07/30
SpaceMouse Module SDK 1.0 Release Date: 2014/04/29
"Windows 3DxWare SDK 4.0.2", there is no sample code for C++ language.
"SpaceMouse Module SDK 1.0" failed, I mentioned.
Do you mean these sample code ?
Thanks,
Masumi
Re: Sample_Software_USB
There appears to be a C++ sample under samples/navlib_viewer
Re: Sample_Software_USB
Hi jwick,
I'm checking navlib_viewer project.
What exact function does retreive SpaceMouse XYZABC axis information ?
It is hard to find it.
Or, is there any documentation about these functions ?
Thanks,
Masumi
I'm checking navlib_viewer project.
What exact function does retreive SpaceMouse XYZABC axis information ?
It is hard to find it.
Or, is there any documentation about these functions ?
Thanks,
Masumi
Re: Sample_Software_USB
There is the function what I want.
SpaceMouse_Module_SDKv1\Sample_Software_USB\Source\3DxSMM_USB.cpp
// Poll the device to read the current state
hr = g_pJoystick->Poll();
// Get the input's device state
if (FAILED(hr = g_pJoystick->GetDeviceState(sizeof(DIJOYSTATE2), &js)))
return hr; // The device should have been acquired during the Poll()
I can see 6-axis motion information like sample code.
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_X, IDC_SENSOR_SLIDER_X, js.lX);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_Y, IDC_SENSOR_SLIDER_Y, js.lY);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_Z, IDC_SENSOR_SLIDER_Z, js.lZ);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_A, IDC_SENSOR_SLIDER_A, js.lRx);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_B, IDC_SENSOR_SLIDER_B, js.lRy);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_C, IDC_SENSOR_SLIDER_C, js.lRz);
SpaceMouse_Module_SDKv1\Sample_Software_USB\Source\3DxSMM_USB.cpp
// Poll the device to read the current state
hr = g_pJoystick->Poll();
// Get the input's device state
if (FAILED(hr = g_pJoystick->GetDeviceState(sizeof(DIJOYSTATE2), &js)))
return hr; // The device should have been acquired during the Poll()
I can see 6-axis motion information like sample code.
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_X, IDC_SENSOR_SLIDER_X, js.lX);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_Y, IDC_SENSOR_SLIDER_Y, js.lY);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_Z, IDC_SENSOR_SLIDER_Z, js.lZ);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_A, IDC_SENSOR_SLIDER_A, js.lRx);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_B, IDC_SENSOR_SLIDER_B, js.lRy);
SetGalileoSensorDataSlider(hDlg, IDC_SENSOR_VALUE_C, IDC_SENSOR_SLIDER_C, js.lRz);
Re: Sample_Software_USB
Issue was fixed.
Code: Select all
BOOL CMFCApplication15Dlg::OnInitDialog()
{
...
RAWINPUTDEVICE rid[1];
rid[0].usUsagePage = 1; // Generic Desktop Page
rid[0].usUsage = 8; // Multi-axis Controller
rid[0].dwFlags = 0;
rid[0].hwndTarget = m_hWnd;
::RegisterRawInputDevices(rid, 1, sizeof(RAWINPUTDEVICE));
return TRUE;
}
void CMFCApplication15Dlg::OnRawInput(UINT nInputcode, HRAWINPUT hRawInput)
{
RAWINPUT* pRI = NULL;
UINT ret, size = 0;
ret = ::GetRawInputData(hRawInput, RID_INPUT, pRI, &size, sizeof(RAWINPUTHEADER));
if (ret == 0 && 0 < size) {
unsigned char* buffer = new unsigned char[size];
pRI = (RAWINPUT*)buffer;
ret = ::GetRawInputData(hRawInput, RID_INPUT, pRI, &size, sizeof(RAWINPUTHEADER));
RAWINPUTHEADER header = pRI->header;
// TRACE(_T("type %d size %d h %x param %d\n"), header.dwType, header.dwSize, header.hDevice, header.wParam);
if (header.dwType == RIM_TYPEMOUSE) {
TRACE(_T("RIM_TYPEMOUSE\n"));
}
else if (header.dwType == RIM_TYPEKEYBOARD) {
TRACE(_T("RIM_TYPEKEYBOARD\n"));
}
else if (header.dwType == RIM_TYPEHID) {
RAWHID hid = pRI->data.hid;
// TRACE(_T("sizehid %d count %d rawdata %x\n"), hid.dwSizeHid, hid.dwCount, hid.bRawData[0]);
unsigned char* data = new unsigned char[hid.dwSizeHid];
int offset = &(pRI->data.hid.bRawData[0]) - buffer;
/*
UINT i;
CString str;
for (i = 0; i < hid.dwSizeHid; i++) {
str.AppendFormat(_T(" %02x"), buffer[offset+i]);
}
str += _T("\n");
TRACE(str);
*/
memcpy(data, (const void*)&(pRI->data.hid.bRawData[0]), hid.dwSizeHid);
if (data[0] == 1) { // XYZ
m_cnt_x = *(short*)(data + 1);
m_cnt_y = *(short*)(data + 3);
m_cnt_z = *(short*)(data + 5);
m_sum_x += m_bCkX ? m_cnt_x : 0;
m_sum_y += m_bCkY ? m_cnt_y : 0;
m_sum_z += m_bCkZ ? m_cnt_z : 0;
UpdateData(FALSE);
}
else if (data[0] == 2) { // ABC
m_cnt_a = *(short*)(data + 1);
m_cnt_b = *(short*)(data + 3);
m_cnt_c = *(short*)(data + 5);
m_sum_a += m_bCkA ? m_cnt_a : 0;
m_sum_b += m_bCkB ? m_cnt_b : 0;
m_sum_c += m_bCkC ? m_cnt_c : 0;
UpdateData(FALSE);
}
else if (data[0] == 3) { // Button
LPCTSTR but1 = data[1] & 1 ? _T("Button1:on") : _T("Button1:off");
LPCTSTR but2 = data[1] & 2 ? _T("Button2:on") : _T("Button2:off");
SetDlgItemText(IDC_ED_BUT1, but1);
SetDlgItemText(IDC_ED_BUT2, but2);
}
delete[] data;
}
delete[] buffer;
}
CDialogEx::OnRawInput(nInputcode, hRawInput);
}
Re: Sample_Software_USB
To clarify, imimasumi appears to have moved away from the SpaceMouse Module SDK and switched to a Raw Input implementation. Raw Input is a system API native to Windows.
Nuno Gomes