Sensor Control Service
About 5720 wordsAbout 19 min
2025-01-27
Provides management of robot system sensor data, including camera, IMU, LiDAR, etc.
Interface Definition
SensorController
is responsible for robot sensor data management, including camera, IMU, LiDAR, etc.
SensorController
— Sensor Controller
Item | Description |
---|---|
Class Name | SensorController |
Overview | Robot sensor data management, including camera, IMU, LiDAR, etc. |
Main Functions | Sensor switch control, data subscription, multimodal perception |
Use Cases | Environmental perception, navigation and localization, status monitoring |
initialize
Item | Description |
---|---|
Method Name | initialize |
Method Declaration | bool initialize() |
Overview | Initialize the sensor controller. |
Return Value | true for success, false for failure. |
Note | Must be called before first use. |
shutdown
Item | Description |
---|---|
Method Name | shutdown |
Method Declaration | void shutdown() |
Overview | Shut down the sensor controller. |
Note | Used together with initialize. |
open_channel_switch
Item | Description |
---|---|
Method Name | open_channel_switch |
Method Declaration | Status open_channel_switch() |
Overview | Open the topic switch. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
close_channel_switch
Item | Description |
---|---|
Method Name | close_channel_switch |
Method Declaration | Status close_channel_switch() |
Overview | Close the topic switch. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with open function. |
open_laser_scan
Item | Description |
---|---|
Method Name | open_laser_scan |
Method Declaration | Status open_laser_scan() |
Overview | Open the LiDAR. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
close_laser_scan
Item | Description |
---|---|
Method Name | close_laser_scan |
Method Declaration | Status close_laser_scan() |
Overview | Close the LiDAR. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with open function. |
open_rgbd_camera
Item | Description |
---|---|
Method Name | open_rgbd_camera |
Method Declaration | Status open_rgbd_camera() |
Overview | Open the RGBD camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
close_rgbd_camera
Item | Description |
---|---|
Method Name | close_rgbd_camera |
Method Declaration | Status close_rgbd_camera() |
Overview | Close the RGBD camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with open function. |
open_binocular_camera
Item | Description |
---|---|
Method Name | open_binocular_camera |
Method Declaration | Status open_binocular_camera() |
Overview | Open the binocular camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
close_binocular_camera
Item | Description |
---|---|
Method Name | close_binocular_camera |
Method Declaration | Status close_binocular_camera() |
Overview | Close the binocular camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with open function. |
subscribe_imu
Item | Description |
---|---|
Method Name | subscribe_imu |
Method Declaration | void subscribe_imu(callback) |
Overview | Subscribe to IMU data. |
Parameter Description | callback : Callback function to receive IMU data. Function signature: callback(data : Imu) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_tof
Item | Description |
---|---|
Method Name | subscribe_tof |
Method Declaration | void subscribe_tof(callback) |
Overview | Subscribe to TOF data. |
Parameter Description | callback : Callback function to receive TOF data. |
Note | Non-blocking interface, data received asynchronously via callback. Function signature: callback(data : Float32MultiArray) -> None |
subscribe_ultra
Item | Description |
---|---|
Method Name | subscribe_ultra |
Method Declaration | void subscribe_ultra(callback) |
Overview | Subscribe to ultrasonic data. |
Parameter Description | callback : Callback function to receive ultrasonic data. Function signature: callback(data : Float32MultiArray) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_head_touch
Item | Description |
---|---|
Method Name | subscribe_head_touch |
Method Declaration | void subscribe_head_touch(callback) |
Overview | Subscribe to head touch data. |
Parameter Description | callback : Callback function to receive head touch data. Function signature: callback(data : HeadTouch) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_laser_scan
Item | Description |
---|---|
Method Name | subscribe_laser_scan |
Method Declaration | void subscribe_laser_scan(callback) |
Overview | Subscribe to LiDAR data. |
Parameter Description | callback : Callback function to receive LiDAR data. Function signature: callback(data : LaserScan) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_rgb_depth_camera_info
Item | Description |
---|---|
Method Name | subscribe_rgb_depth_camera_info |
Method Declaration | void subscribe_rgb_depth_camera_info(callback) |
Overview | Subscribe to RGBD depth camera intrinsic data. |
Parameter Description | callback : Callback function to receive camera intrinsic data. Function signature: callback(data : CameraInfo) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_rgbd_depth_image
Item | Description |
---|---|
Method Name | subscribe_rgbd_depth_image |
Method Declaration | void subscribe_rgbd_depth_image(callback) |
Overview | Subscribe to RGBD depth image data. |
Parameter Description | callback : Callback function to receive depth image data. Function signature: callback(data : Image) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_rgbd_color_camera_info
Item | Description |
---|---|
Method Name | subscribe_rgbd_color_camera_info |
Method Declaration | void subscribe_rgbd_color_camera_info(callback) |
Overview | Subscribe to RGBD color image intrinsic data. |
Parameter Description | callback : Callback function to receive camera intrinsic data. Function signature: callback(data : CameraInfo) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_rgbd_color_image
Item | Description |
---|---|
Method Name | subscribe_rgbd_color_image |
Method Declaration | void subscribe_rgbd_color_image(callback) |
Overview | Subscribe to RGBD color image data. |
Parameter Description | callback : Callback function to receive color image data. Function signature: callback(data : Image) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_left_binocular_high_img
Item | Description |
---|---|
Method Name | subscribe_left_binocular_high_img |
Method Declaration | void subscribe_left_binocular_high_img(callback) |
Overview | Subscribe to left high-quality binocular data. |
Parameter Description | callback : Callback function to receive left high-quality binocular data. Function signature: callback(data : CompressedImage) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_left_binocular_low_img
Item | Description |
---|---|
Method Name | subscribe_left_binocular_low_img |
Method Declaration | void subscribe_left_binocular_low_img(callback) |
Overview | Subscribe to left low-quality binocular data. |
Parameter Description | callback : Callback function to receive left low-quality binocular data. Function signature: callback(data : CompressedImage) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_right_binocular_low_img
Item | Description |
---|---|
Method Name | subscribe_right_binocular_low_img |
Method Declaration | void subscribe_right_binocular_low_img(callback) |
Overview | Subscribe to right low-quality binocular data. |
Parameter Description | callback : Callback function to receive right low-quality binocular data. Function signature: callback(data : CompressedImage) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
subscribe_depth_image
Item | Description |
---|---|
Method Name | subscribe_depth_image |
Method Declaration | void subscribe_depth_image(callback) |
Overview | Subscribe to depth image data. |
Parameter Description | callback : Callback function to receive depth image data. Function signature: callback(data : Image) -> None |
Note | Non-blocking interface, data received asynchronously via callback. |
Data Structure Definitions
Uint8Vector
— Unsigned 8-bit Integer Vector
Item | Description |
---|---|
Type | Python binding of std::vector<uint8_t> |
Overview | Dynamic array for storing unsigned 8-bit integers, commonly used for raw byte data |
Main Methods | Supports standard Python list operations: indexing, slicing, iteration, length query, etc. |
Use Cases | Image data, audio data, binary data storage |
PointFieldVector
— Point Cloud Field Vector
Item | Description |
---|---|
Type | Python binding of std::vector<magic::dog::PointField> |
Overview | Dynamic array for storing point cloud field descriptions, used to define point cloud data structure |
Main Methods | Supports standard Python list operations, each element is a PointField struct |
Use Cases | Point cloud data processing, 3D sensor data parsing |
MultiArrayDimensionVector
— Multi-dimensional Array Dimension Vector
Item | Description |
---|---|
Type | Python binding of std::vector<magic::dog::MultiArrayDimension> |
Overview | Dynamic array for storing multi-dimensional array dimension information, used to describe array shape and layout |
Main Methods | Supports standard Python list operations, each element is a MultiArrayDimension struct |
Use Cases | Multi-dimensional sensor data, matrix data processing |
FloatVector
— Float Vector
Item | Description |
---|---|
Type | Python binding of std::vector<float> |
Overview | Dynamic array for storing single-precision floats, used for high-precision numerical computation |
Main Methods | Supports standard Python list operations, supports float arithmetic |
Use Cases | Sensor data, coordinate data, physical quantity data |
DoubleVector
— Double Precision Float Vector
Item | Description |
---|---|
Type | Python binding of std::vector<double> |
Overview | Dynamic array for storing double-precision floats, provides highest precision numerical computation |
Main Methods | Supports standard Python list operations, supports high-precision float arithmetic |
Use Cases | High-precision sensor data, scientific computation, coordinate transformation |
Double3Array
— 3D Double Precision Float Array
Item | Description |
---|---|
Type | Python binding of std::array<double, 3> |
Overview | Fixed-size 3D double array, commonly used for 3D coordinate representation |
Main Methods | Supports indexing, iteration, length query, fixed length 3 |
Use Cases | 3D coordinates, RGB values, Euler angles, position vectors |
Double4Array
— 4D Double Precision Float Array
Item | Description |
---|---|
Type | Python binding of std::array<double, 4> |
Overview | Fixed-size 4D double array, commonly used for quaternion representation |
Main Methods | Supports indexing, iteration, length query, fixed length 4 |
Use Cases | Quaternions, RGBA values, pose representation |
Double9Array
— 9D Double Precision Float Array
Item | Description |
---|---|
Type | Python binding of std::array<double, 9> |
Overview | Fixed-size 9D double array, commonly used for 3x3 matrix representation |
Main Methods | Supports indexing, iteration, length query, fixed length 9 |
Use Cases | 3x3 rotation matrix, covariance matrix, transformation matrix |
Double12Array
— 12D Double Precision Float Array
Item | Description |
---|---|
Type | Python binding of std::array<double, 12> |
Overview | Fixed-size 12D double array, commonly used for 3x4 projection matrix representation |
Main Methods | Supports indexing, iteration, length query, fixed length 12 |
Use Cases | 3x4 projection matrix, camera parameter matrix |
Header
— Header Structure
Field Name | Type | Description |
---|---|---|
stamp | int | Timestamp |
frame_id | str | Coordinate frame ID |
Image
— Image Structure
Field Name | Type | Description |
---|---|---|
header | Header | Header information |
height | int | Image height |
width | int | Image width |
encoding | str | Encoding format |
is_bigendian | bool | Is big endian |
step | int | Step size |
data | Uint8Vector | Image data |
Imu
— Inertial Measurement Unit Structure
Field Name | Type | Description |
---|---|---|
timestamp | int | Timestamp |
orientation | Double4Array | Orientation quaternion (read-only) |
angular_velocity | Double3Array | Angular velocity (read-only) |
linear_acceleration | Double3Array | Linear acceleration (read-only) |
temperature | float | Temperature |
PointField
— Point Cloud Field Description Structure
Field Name | Type | Description |
---|---|---|
name | str | Field name, e.g. "x", "y", "z", "intensity", etc. |
offset | int | Starting byte offset |
datatype | int | Data type (corresponding constant) |
count | int | Number of elements in this field |
PointCloud2
— General Point Cloud Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Standard message header |
height | int | Number of rows |
width | int | Number of columns |
fields | PointFieldVector | Point field array |
is_bigendian | bool | Byte order |
point_step | int | Bytes per point |
row_step | int | Bytes per row |
data | Uint8Vector | Raw point cloud data (packed by field) |
is_dense | bool | Is dense point cloud (no invalid points) |
CameraInfo
— Camera Intrinsic and Distortion Info Structure
Field Name | Type | Description |
---|---|---|
header | Header | General message header |
height | int | Image height (rows) |
width | int | Image width (columns) |
distortion_model | str | Distortion model, e.g. "plumb_bob" |
D | FloatVector | Distortion parameter array |
K | FloatVector | Camera intrinsic matrix (9 elements) |
R | FloatVector | Rectification matrix (9 elements) |
P | FloatVector | Projection matrix (12 elements) |
binning_x | int | Horizontal binning factor |
binning_y | int | Vertical binning factor |
roi_x_offset | int | ROI start x |
roi_y_offset | int | ROI start y |
roi_height | int | ROI height |
roi_width | int | ROI width |
roi_do_rectify | bool | Whether to rectify |
CompressedImage
— Compressed Image Structure
Field Name | Type | Description |
---|---|---|
header | Header | General message header |
format | str | Compression format |
data | Uint8Vector | Compressed image data |
LaserScan
— LiDAR Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | General message header |
angle_min | int | Minimum angle |
angle_max | int | Maximum angle |
angle_increment | int | Angle increment |
time_increment | int | Time increment |
scan_time | int | Scan time |
range_min | int | Minimum range |
range_max | int | Maximum range |
ranges | FloatVector | Range data array |
intensities | FloatVector | Intensity data array |
MultiArrayDimension
— Multi-dimensional Array Dimension Description Structure
Field Name | Type | Description |
---|---|---|
label | str | Dimension label |
size | int | Dimension size |
stride | int | Stride |
MultiArrayLayout
— Multi-dimensional Array Layout Description Structure
Field Name | Type | Description |
---|---|---|
dim_size | int | Number of dimensions |
dim | MultiArrayDimensionVector | Dimension description array |
data_offset | int | Data offset |
Float32MultiArray
— Float Multi-dimensional Array Structure
Field Name | Type | Description |
---|---|---|
layout | MultiArrayLayout | Array layout description |
data | FloatVector | Float data array |
ByteMultiArray
— Byte Array Structure
Field Name | Type | Description |
---|---|---|
layout | MultiArrayLayout | Array layout description |
data | Uint8Vector | Byte data array |
HeadTouch
— Head Touch Data Structure
Field Name | Type | Description |
---|---|---|
data | int | Touch state data |