Sensor Control Service
About 2898 wordsAbout 10 min
2025-01-27
Provides robot system sensor (LiDAR/RGBD camera/binocular camera) services. Through the
SensorController
, you can control robot sensors and obtain status via RPC and topic methods.
Interface Definition
SensorController
is a management class that encapsulates various robot sensors, supporting initialization, control, and data subscription of LiDAR, RGBD cameras, and binocular cameras.
⚠️ Notice: Current binocular and RGBD sensor interfaces are not fully open.
SensorController
Item | Content |
---|---|
Class Name | SensorController |
Constructor | controller = SensorController() |
Function Overview | Constructor, initializes sensor controller object. |
Notes | Constructs internal state. |
initialize
Item | Content |
---|---|
Function Name | initialize |
Function Declaration | bool initialize() |
Function Overview | Initialize controller, including resource allocation and driver loading. |
Return Value | True indicates success, False indicates failure. |
Notes | Object must be constructed before calling. |
shutdown
Item | Content |
---|---|
Function Name | shutdown |
Function Declaration | void shutdown() |
Function Overview | Close all sensor connections and release resources. |
Notes | Used in conjunction with initialize. |
open_lidar
Item | Content |
---|---|
Function Name | open_lidar |
Function Declaration | Status open_lidar() |
Function Overview | Open LiDAR. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface. |
close_lidar
Item | Content |
---|---|
Function Name | close_lidar |
Function Declaration | Status close_lidar() |
Function Overview | Close LiDAR. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface, used in conjunction with open function. |
open_head_rgbd_camera
Item | Content |
---|---|
Function Name | open_head_rgbd_camera |
Function Declaration | Status open_head_rgbd_camera() |
Function Overview | Open head RGBD camera. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface. |
close_head_rgbd_camera
Item | Content |
---|---|
Function Name | close_head_rgbd_camera |
Function Declaration | Status close_head_rgbd_camera() |
Function Overview | Close head RGBD camera. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface, used in conjunction with open function. |
open_binocular_camera
Item | Content |
---|---|
Function Name | open_binocular_camera |
Function Declaration | Status open_binocular_camera() |
Function Overview | Open binocular camera. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface. |
close_binocular_camera
Item | Content |
---|---|
Function Name | close_binocular_camera |
Function Declaration | Status close_binocular_camera() |
Function Overview | Close binocular camera. |
Return Value | Status object, Status.code == ErrorCode.OK indicates success. |
Notes | Blocking interface, used in conjunction with open function. |
subscribe_lidar_imu
Item | Content |
---|---|
Function Name | subscribe_lidar_imu |
Function Declaration | void subscribe_lidar_imu(callback) |
Function Overview | Subscribe to LiDAR IMU data |
Parameter Description | callback: Data processing function after receiving data, signature is callback(data: Imu) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_lidar_point_cloud
Item | Content |
---|---|
Function Name | subscribe_lidar_point_cloud |
Function Declaration | void subscribe_lidar_point_cloud(callback) |
Function Overview | Subscribe to LiDAR point cloud data |
Parameter Description | callback: Point cloud processing function after receiving data, signature is callback(data: PointCloud2) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_head_rgbd_color_image
Item | Content |
---|---|
Function Name | subscribe_head_rgbd_color_image |
Function Declaration | void subscribe_head_rgbd_color_image(callback) |
Function Overview | Subscribe to head RGBD color image data |
Parameter Description | callback: Image processing function after receiving data, signature is callback(data: Image) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_head_rgbd_depth_image
Item | Content |
---|---|
Function Name | subscribe_head_rgbd_depth_image |
Function Declaration | void subscribe_head_rgbd_depth_image(callback) |
Function Overview | Subscribe to head RGBD depth image data |
Parameter Description | callback: Depth image processing function after receiving data, signature is callback(data: Image) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_head_rgbd_camera_info
Item | Content |
---|---|
Function Name | subscribe_head_rgbd_camera_info |
Function Declaration | void subscribe_head_rgbd_camera_info(callback) |
Function Overview | Subscribe to head RGBD camera parameter data |
Parameter Description | callback: Camera intrinsic parameter processing function after receiving data, signature is callback(data: CameraInfo) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_binocular_image
Item | Content |
---|---|
Function Name | subscribe_binocular_image |
Function Declaration | void subscribe_binocular_image(callback) |
Function Overview | Subscribe to binocular camera image frame data |
Parameter Description | callback: Binocular camera data processing function after receiving data, signature is callback(data: BinocularCameraFrame) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
subscribe_binocular_camera_info
Item | Content |
---|---|
Function Name | subscribe_binocular_camera_info |
Function Declaration | void subscribe_binocular_camera_info(callback) |
Function Overview | Subscribe to binocular camera parameter data |
Parameter Description | callback: Camera intrinsic parameter processing function after receiving data, signature is callback(data: CameraInfo) -> None |
Notes | Non-blocking interface, callback function will be called when data is updated. |
Data Types
Imu
IMU data structure, containing sensor data such as attitude, angular velocity, linear acceleration, etc.
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (nanoseconds) |
temperature | float | Temperature (Celsius) |
orientation | Quaternion | Attitude quaternion |
angular_velocity | Vector3 | Angular velocity (rad/s) |
linear_acceleration | Vector3 | Linear acceleration (m/s²) |
PointCloud2
Point cloud data structure, containing 3D point cloud information.
Field Name | Type | Description |
---|---|---|
header | Header | Standard message header (timestamp + frame_id) |
height | int32_t | Point cloud height (number of rows) |
width | int32_t | Point cloud width (number of columns) |
fields | list[PointField] | Point field array |
is_bigendian | bool | Byte order |
point_step | int32_t | Number of bytes per point |
row_step | int32_t | Number of bytes per row |
data | list[uint8_t] | Raw point cloud data (packed by field) |
is_dense | bool | Whether it is a dense point cloud (no invalid points) |
Image
Image data structure, supporting multiple encoding formats.
Field Name | Type | Description |
---|---|---|
header | Header | Standard message header (timestamp + frame_id) |
height | int32_t | Image height (pixels) |
width | int32_t | Image width (pixels) |
encoding | str | Image encoding type, such as "rgb8", "mono8", "bgr8" |
is_bigendian | bool | Whether data is in big-endian mode |
step | int32_t | Number of bytes per image row |
data | list[uint8_t] | Raw image byte data |
CameraInfo
Camera intrinsic parameters and distortion information, usually published together with Image messages.
Field Name | Type | Description |
---|---|---|
header | Header | Standard message header (timestamp + frame_id) |
height | int32_t | Image height (number of rows) |
width | int32_t | Image width (number of columns) |
distortion_model | str | Distortion model, e.g., "plumb_bob" |
D | list[double] | Distortion parameter array |
K | list[double] | Camera intrinsic matrix (9 elements) |
R | list[double] | Rectification matrix (9 elements) |
P | list[double] | Projection matrix (12 elements) |
binning_x | int32_t | Horizontal binning coefficient |
binning_y | int32_t | Vertical binning coefficient |
roi_x_offset | int32_t | ROI start x |
roi_y_offset | int32_t | ROI start y |
roi_height | int32_t | ROI height |
roi_width | int32_t | ROI width |
roi_do_rectify | bool | Whether to perform rectification |
BinocularCameraFrame
Binocular camera frame data structure, containing format and image frames.
Field Name | Type | Description |
---|---|---|
header | Header | Common message header (timestamp + frame_id) |
format | str | Image format |
data | list[uint8_t] | Left and right eye stitched image data, left half is left eye image, right half is right eye image |