You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Control a [robot](https://roboruka.robotickytabor.cz/) with a Space Mouse
24
+
Control [Robo Arm](https://roboruka.robotickytabor.cz/) with a Space Mouse.
25
25
26
26
## Supported 3Dconnexion devices
27
27
@@ -41,17 +41,19 @@ Control a [robot](https://roboruka.robotickytabor.cz/) with a Space Mouse
41
41
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install [pyspacemouse](https://pypi.org/project/pyspacemouse/). If you are using a Mac with an ARM processor, you'll need a patched version of `easyhid`.
Open a 3D space navigator device. Makes this device the current active device, which enables the module-level read() and close()
169
-
calls. For multiple devices, use the read() and close() calls on the returned object instead, and don't use the module-level calls.
170
-
171
-
Parameters:
172
-
callback: If callback is provided, it is called on each HID update with a copy of the current state namedtuple
173
-
dof_callback: If dof_callback is provided, it is called only on DOF state changes with the argument (state).
174
-
button_callback: If button_callback is provided, it is called on each button push, with the arguments (state_tuple, button_state)
175
-
device: name of device to open, as a string like "SpaceNavigator". Must be one of the values in `supported_devices`.
176
-
If `None`, chooses the first supported device found.
177
-
Returns:
178
-
Device object if the device was opened successfully
179
-
None if the device could not be opened
180
-
181
-
read() Return a namedtuple giving the current device state (t,x,y,z,roll,pitch,yaw,button)
182
-
close() Close the connection to the current device, if it is open
183
-
list_devices() Return a list of supported devices found, or an empty list if none found
184
-
185
-
`open()` returns a DeviceSpec object.
186
-
If you have multiple 3Dconnexion devices, you can use the object-oriented API to access them individually.
187
-
Each object has the following API, which functions exactly as the above API, but on a per-device basis:
188
-
189
-
dev.open() Opens the connection (this is always called by the module-level open command,
190
-
so you should not need to use it unless you have called close())
191
-
dev.read() Return the state of the device as namedtuple [t,x,y,z,roll,pitch,yaw,button]
192
-
dev.close() Close this device
193
-
194
-
There are also attributes:
195
-
196
-
dev.connected True if the device is connected, False otherwise
197
-
dev.state Convenience property which returns the same value as read()
198
-
199
-
## Predefined callbacks
109
+
## Basic example
200
110
201
111
````py
202
112
import pyspacemouse
@@ -208,18 +118,8 @@ if success:
208
118
state = pyspacemouse.read()
209
119
time.sleep(0.01)
210
120
````
121
+
More examples can be found in the [/examples](https://github.com/JakubAndrysek/PySpaceMouse/tree/master/examples) directory or in page with [Examples](https://spacemouse.kubaandrysek.cz/mouseApi/examples/).
211
122
212
-
### Callback: print_state
213
-
214
-
Print all axis states
215
-
216
-
x +0.00 y +0.00 z +0.00 roll +0.00 pitch +0.00 yaw +0.00 t +0.0
Control a [robot](https://roboruka.robotickytabor.cz/) with a Space Mouse
24
+
Control [Robo Arm](https://roboruka.robotickytabor.cz/) with a Space Mouse.
25
25
26
26
## Supported 3Dconnexion devices
27
27
@@ -41,17 +41,19 @@ Control a [robot](https://roboruka.robotickytabor.cz/) with a Space Mouse
41
41
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install [pyspacemouse](https://pypi.org/project/pyspacemouse/). If you are using a Mac with an ARM processor, you'll need a patched version of `easyhid`.
Open a 3D space navigator device. Makes this device the current active device, which enables the module-level read() and close()
169
-
calls. For multiple devices, use the read() and close() calls on the returned object instead, and don't use the module-level calls.
170
-
171
-
Parameters:
172
-
callback: If callback is provided, it is called on each HID update with a copy of the current state namedtuple
173
-
dof_callback: If dof_callback is provided, it is called only on DOF state changes with the argument (state).
174
-
button_callback: If button_callback is provided, it is called on each button push, with the arguments (state_tuple, button_state)
175
-
device: name of device to open, as a string like "SpaceNavigator". Must be one of the values in `supported_devices`.
176
-
If `None`, chooses the first supported device found.
177
-
Returns:
178
-
Device object if the device was opened successfully
179
-
None if the device could not be opened
180
-
181
-
read() Return a namedtuple giving the current device state (t,x,y,z,roll,pitch,yaw,button)
182
-
close() Close the connection to the current device, if it is open
183
-
list_devices() Return a list of supported devices found, or an empty list if none found
184
-
185
-
`open()` returns a DeviceSpec object.
186
-
If you have multiple 3Dconnexion devices, you can use the object-oriented API to access them individually.
187
-
Each object has the following API, which functions exactly as the above API, but on a per-device basis:
188
-
189
-
dev.open() Opens the connection (this is always called by the module-level open command,
190
-
so you should not need to use it unless you have called close())
191
-
dev.read() Return the state of the device as namedtuple [t,x,y,z,roll,pitch,yaw,button]
192
-
dev.close() Close this device
193
-
194
-
There are also attributes:
195
-
196
-
dev.connected True if the device is connected, False otherwise
197
-
dev.state Convenience property which returns the same value as read()
198
-
199
-
## Predefined callbacks
109
+
## Basic example
200
110
201
111
````py
202
112
import pyspacemouse
@@ -208,18 +118,8 @@ if success:
208
118
state = pyspacemouse.read()
209
119
time.sleep(0.01)
210
120
````
121
+
More examples can be found in the [/examples](https://github.com/JakubAndrysek/PySpaceMouse/tree/master/examples) directory or in page with [Examples](https://spacemouse.kubaandrysek.cz/mouseApi/examples/).
211
122
212
-
### Callback: print_state
213
-
214
-
Print all axis states
215
-
216
-
x +0.00 y +0.00 z +0.00 roll +0.00 pitch +0.00 yaw +0.00 t +0.0
0 commit comments