Types
- class quanser.devices.types.RangingMeasurements(num_measurements=0, distance=0.0, distance_sigma=0.0, heading=0.0, quality=0)
A structure to hold ranging measurements.
- Parameters
distance (float[]) – The distances in metres.
distance_sigma (float[]) – Estimates of the standard deviation in the current distance measurement.
heading (float[]) – The headings in radians (will be zero for 1D ranging sensors).
quality (int[]) – Indications of the quality of the measurement (0 to 100%).
length (int) – The number of valid measurements in each array.
Examples
Create a holder for ranging measurements.
>>> from quanser.devices.types import RangingMeasurements >>> measurement = RangingMeasurements(num_measurements)
Create a ranging measurement holder containing values.
>>> from quanser.devices.types import RangingMeasurements >>> measurement = RangingMeasurements(720, 10.0, 0.2, 0.0, 50)
- class quanser.devices.types.VRPNAnalogMeasurements
A structure to hold VRPN analog measurements.
- device
Index of the analog device that this measurement represents.
- Type
int
- channel
Index of the channel of the device that this measurement represents.
- Type
int
- new
Indicates whether this measurement contains new data.
- Type
boolean
- value
Represents the analog value of the channel.
- Type
float
Examples
Create a holder for analog reading measurements.
>>> from quanser.common.utilities import count_list_elements >>> from quanser.devices import VRPNClient, VRPNAnalogMeasurements >>> analog_names = ['Mouse0'] >>> analog_num_channels = arr.array('I', [2]) >>> analog_channels_to_read = [[0, 1]] >>> num_analog_channels = count_list_elements(analog_channels_to_read) >>> analog_measurements = [VRPNAnalogMeasurements() for _ in range(num_analog_channels)] >>> vrpn_client = VRPNClient() >>> vrpn_client.open("localhost:3883", analog_names, analog_num_channels, None, None, None, None, None, None) >>> vrpn_client.initialize(analog_channels_to_read, None, None, None) >>> vrpn_client.read(analog_measurements, None, None, None, False) >>> vrpn_client.close()
- class quanser.devices.types.VRPNButtonMeasurements
A structure to hold VRPN button measurements.
- device
Index of the button device that this measurement represents.
- Type
int
- button
Index of the button of the device that this measurement represents.
- Type
int
- new
Indicates whether this measurement contains new data.
- Type
boolean
- value
Represents the value of the button.
- Type
boolean
Examples
Create a holder for button reading measurements.
>>> from quanser.common.utilities import count_list_elements >>> from quanser.devices import VRPNClient, VRPNButtonMeasurements >>> button_names = ['Mouse0'] >>> button_num_buttons = arr.array('I', [3]) >>> button_buttons_to_read = [[0, 1, 2]] >>> num_button_buttons = count_list_elements(button_buttons_to_read) >>> button_measurements = [VRPNButtonMeasurements() for _ in range(num_button_buttons)] >>> vrpn_client = VRPNClient() >>> vrpn_client.open("localhost:3883", None, None, button_names, button_num_buttons, None, None, None, None) >>> vrpn_client.initialize(None, button_buttons_to_read, None, None) >>> vrpn_client.read(None, button_measurements, None, None, False) >>> vrpn_client.close()
- class quanser.devices.types.VRPNDialMeasurements
A structure to hold VRPN dial measurements.
- device
Index of the dial device that this measurement represents.
- Type
int
- channel
Index of the channel of the device that this measurement represents.
- Type
int
- new
Indicates whether this measurement contains new data.
- Type
boolean
- value
Represents the value of the channel.
- Type
float
Examples
Create a holder for dial reading measurements.
>>> from quanser.common.utilities import count_list_elements >>> from quanser.devices import VRPNClient, VRPNDialMeasurements >>> dial_names = ['Dial0'] >>> dial_num_channels = arr.array('I', [2]) >>> dial_channels_to_read = [[0, 1]] >>> num_dial_channels = count_list_elements(dial_channels_to_read) >>> dial_measurements = [VRPNDialMeasurements() for _ in range(num_dial_channels)] >>> vrpn_client = VRPNClient() >>> vrpn_client.open("localhost:3883", None, None, None, None, dial_names, dial_num_channels, None, None) >>> vrpn_client.initialize(None, None, dial_channels_to_read, None) >>> vrpn_client.read(None, None, dial_measurements, None, False) >>> vrpn_client.close()
- class quanser.devices.types.VRPNTrackerMeasurements
A structure to hold VRPN tracker measurements.
- device
Index of the tracker device that this measurement represents.
- Type
int
- sensor
Index of the tracker sensor of the device that this measurement represents.
- Type
int
- new
Indicates whether this measurement contains new data.
- Type
boolean
- pos
Represents the xyz coordinates of the tracker sensor.
- Type
float[3]
- quat
Represents the orientation of the tracker sensor in quaternion format.
- Type
float[4]
- vel
Represents the xyz velocities of the tracker sensor.
- Type
float[3]
- vel_quat
Represents the angular velocities of the tracker sensor in quaternion format
- Type
float[4]
- vel_quat_dt
Represents the angular velocity delta time of the tracker sensor.
- Type
float
- acc
Represents the xyz accelerations of the tracker sensor.
- Type
float[3]
- acc_quat
Represents the angular acclerations of the tracker sensor in quaternion format.
- Type
float[4]
- acc_quat_dt
Represents the angular acceleration delta time of the tracker sensor.
- Type
float
Examples
Create a holder for tracker sensor measurements.
>>> from quanser.common.utilities import count_list_elements >>> from quanser.devices import VRPNClient, VRPNTrackerMeasurements >>> tracker_names = ['Tracker0', 'Tracker1'] >>> tracker_num_sensors = arr.array('I', [2, 2]) >>> tracker_sensors_to_read = [[0, 1], [1]] >>> num_tracker_sensors = count_list_elements(tracker_sensors_to_read) >>> tracker_measurements = [VRPNTrackerMeasurements() for _ in range(num_tracker_sensors)] >>> vrpn_client = VRPNClient() >>> vrpn_client.open("localhost:3883", None, None, None, None, None, None, tracker_names, tracker_num_sensors) >>> vrpn_client.initialize(None, None, None, tracker_sensors_to_read) >>> vrpn_client.read(None, None, None, tracker_measurements, False)