Sensor Control Service
About 4691 wordsAbout 16 min
2025-05-29
Provides services for robot system sensors (Lidar/RGBD Camera/Binocular Camera). Through the SensorController, you can control robot sensors and obtain their status via RPC and topic mechanisms.
Interface Definition
SensorController
is a management class that encapsulates various robot sensors, supporting initialization, control, and data subscription for Laser Scan, RGBD Camera, and Binocular Camera.
SensorController
Item | Description |
---|---|
Function Name | SensorController |
Declaration | SensorController(); |
Overview | Constructor, initializes the sensor controller object. |
Note | Constructs internal state. |
~SensorController
Item | Description |
---|---|
Function Name | ~SensorController |
Declaration | virtual ~SensorController(); |
Overview | Destructor, releases all sensor resources. |
Note | Sensors should be closed before calling. |
Initialize
Item | Description |
---|---|
Function Name | Initialize |
Declaration | bool Initialize(); |
Overview | Initializes the controller, including resource allocation and driver loading. |
Return Value | true for success, false for failure. |
Note | Object must be constructed before calling. |
Shutdown
Item | Description |
---|---|
Function Name | Shutdown |
Declaration | void Shutdown(); |
Overview | Closes all sensor connections and releases resources. |
Note | Used together with Initialize. |
OpenChannelSwith
Item | Description |
---|---|
Function Name | OpenChannelSwith |
Declaration | Status OpenChannelSwith(); |
Overview | Opens the topic switch. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
CloseChannelSwith
Item | Description |
---|---|
Function Name | CloseChannelSwith |
Declaration | Status CloseChannelSwith(); |
Overview | Closes the topic switch. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with the open function. |
OpenLaserScan
Item | Description |
---|---|
Function Name | OpenLaserScan |
Declaration | Status OpenLaserScan(); |
Overview | Opens the lidar. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
CloseLaserScan
Item | Description |
---|---|
Function Name | CloseLaserScan |
Declaration | Status CloseLaserScan(); |
Overview | Closes the lidar. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with the open function. |
OpenRgbdCamera
Item | Description |
---|---|
Function Name | OpenRgbdCamera |
Declaration | Status OpenRgbdCamera(); |
Overview | Opens the RGBD camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
CloseRgbdCamera
Item | Description |
---|---|
Function Name | CloseRgbdCamera |
Declaration | Status CloseRgbdCamera(); |
Overview | Closes the RGBD camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with the open function. |
OpenBinocularCamera
Item | Description |
---|---|
Function Name | OpenBinocularCamera |
Declaration | Status OpenBinocularCamera(); |
Overview | Opens the binocular camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface. |
CloseBinocularCamera
Item | Description |
---|---|
Function Name | CloseBinocularCamera |
Declaration | Status CloseBinocularCamera(); |
Overview | Closes the binocular camera. |
Return Value | Status::OK for success, others for failure. |
Note | Blocking interface, used together with the open function. |
SubscribeTof
Item | Description |
---|---|
Function Name | SubscribeTof |
Declaration | void SubscribeTof(const TofCallback callback); |
Overview | Subscribe to TOF data. |
Parameter | callback: Callback function to handle received TOF data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeUltra
Item | Description |
---|---|
Function Name | SubscribeUltra |
Declaration | void SubscribeUltra(const UltraCallback callback); |
Overview | Subscribe to ultrasonic data. |
Parameter | callback: Callback function to handle received ultrasonic data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeHeadTouch
Item | Description |
---|---|
Function Name | SubscribeHeadTouch |
Declaration | void SubscribeHeadTouch(const HeadTouchCallback callback); |
Overview | Subscribe to head touch data. |
Parameter | callback: Callback function to handle received head touch data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeLaserScan
Item | Description |
---|---|
Function Name | SubscribeLaserScanr |
Declaration | void SubscribeLaserScan(const LaserScanCallback callback); |
Overview | Subscribe to lidar data. |
Parameter | callback: Callback function to handle received lidar data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeRgbDepthCameraInfo
Item | Description |
---|---|
Function Name | SubscribeRgbDepthCameraInfo |
Declaration | void SubscribeRgbDepthCameraInfo(const CameraInfoCallback callback); |
Overview | Subscribe to RGBD depth camera intrinsic data. |
Parameter | callback: Callback function to handle received RGBD depth camera intrinsic data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeRgbdDepthImage
Item | Description |
---|---|
Function Name | SubscribeRgbdDepthImage |
Declaration | void SubscribeRgbdDepthImage(const ImageCallback callback); |
Overview | Subscribe to RGBD depth image data. |
Parameter | callback: Callback function to handle received RGBD depth image data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeRgbdColorCameraInfo
Item | Description |
---|---|
Function Name | SubscribeRgbdColorCameraInfo |
Declaration | void SubscribeRgbdColorCameraInfo(const CameraInfoCallback callback); |
Overview | Subscribe to RGBD color image intrinsic data. |
Parameter | callback: Callback function to handle received RGBD color image intrinsic data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeRgbdColorImage
Item | Description |
---|---|
Function Name | SubscribeRgbdColorImage |
Declaration | void SubscribeRgbdColorImage(const ImageCallback callback); |
Overview | Subscribe to RGBD color image data. |
Parameter | callback: Callback function to handle received RGBD color image data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeImu
Item | Description |
---|---|
Function Name | SubscribeImu |
Declaration | void SubscribeImu(const ImuCallback callback); |
Overview | Subscribe to IMU data. |
Parameter | callback: Callback function to handle received IMU data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeLeftBinocularHighImg
Item | Description |
---|---|
Function Name | SubscribeLeftBinocularHighImg |
Declaration | void SubscribeLeftBinocularHighImg(const CompressedImageCallback callback); |
Overview | Subscribe to left high-quality binocular data. |
Parameter | callback: Callback function to handle received left high-quality binocular data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeLeftBinocularLowImg
Item | Description |
---|---|
Function Name | SubscribeLeftBinocularLowImg |
Declaration | void SubscribeLeftBinocularLowImg(const CompressedImageCallback callback); |
Overview | Subscribe to left low-quality binocular data. |
Parameter | callback: Callback function to handle received left low-quality binocular data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeRightBinocularLowImg
Item | Description |
---|---|
Function Name | SubscribeRightBinocularLowImg |
Declaration | void SubscribeRightBinocularLowImg(const CompressedImageCallback callback); |
Overview | Subscribe to right low-quality binocular data. |
Parameter | callback: Callback function to handle received right low-quality binocular data. |
Note | Non-blocking interface, callback will be invoked when data updates. |
SubscribeDepthImage
Item | Description |
---|---|
Function Name | SubscribeDepthImage |
Declaration | void SubscribeDepthImage(const ImageCallback callback); |
Overview | Subscribe to depth image. |
Parameter | callback: Callback function to handle received depth image. |
Note | Non-blocking interface, callback will be invoked when data updates. |
Type Definitions
Imu
— IMU Data Structure
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
orientation[4] | double[4] | Orientation quaternion (w, x, y, z) |
angular_velocity[3] | double[3] | Angular velocity (unit: rad/s) |
linear_acceleration[3] | double[3] | Linear acceleration (unit: m/s²) |
temperature | float | Temperature (unit: Celsius or other, should be specified) |
Header
— Common Message Header Structure
Field Name | Type | Description |
---|---|---|
stamp | int64_t | Timestamp (unit: nanoseconds) |
frame_id | std::string | Coordinate frame name |
PointField
— Point Field Description
Field Name | Type | Description |
---|---|---|
name | std::string | Field name (e.g., x, y, z, intensity) |
offset | int32_t | Starting byte offset |
datatype | int8_t | Data type (corresponding constant) |
count | int32_t | Number of elements per point for this field |
PointCloud2
— Point Cloud Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Message header |
height | int32_t | Number of rows |
width | int32_t | Number of columns |
fields | std::vector<PointField> | Array of point fields |
is_bigendian | bool | Byte order |
point_step | int32_t | Bytes per point |
row_step | int32_t | Bytes per row |
data | std::vector<uint8_t> | Raw point cloud byte data |
is_dense | bool | Is dense point cloud (no invalid points) |
Image
— Image Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Message header |
height | int32_t | Image height (pixels) |
width | int32_t | Image width (pixels) |
encoding | std::string | Encoding type (e.g., rgb8, mono8) |
is_bigendian | bool | Is big-endian mode |
step | int32_t | Bytes per image row |
data | std::vector<uint8_t> | Raw image byte data |
CameraInfo
— Camera Intrinsic and Distortion Information
Field Name | Type | Description |
---|---|---|
header | Header | Message header |
height | int32_t | Image height |
width | int32_t | Image width |
distortion_model | std::string | Distortion model (e.g., plumb_bob) |
D | std::vector<double> | Distortion parameter array |
K | double[9] | Camera intrinsic matrix |
R | double[9] | Rectification matrix |
P | double[12] | Projection matrix |
binning_x | int32_t | Horizontal binning factor |
binning_y | int32_t | Vertical binning factor |
roi_x_offset | int32_t | ROI starting x coordinate |
roi_y_offset | int32_t | ROI starting y coordinate |
roi_height | int32_t | ROI height |
roi_width | int32_t | ROI width |
roi_do_rectify | bool | Whether to rectify |
CompressedImage
— Compressed Image Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Message header |
format | std::string | Compression format (e.g., jpeg, png) |
data | std::vector<uint8_t> | Compressed image data |
LaserScan
— Lidar Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Message header |
angle_min | int32_t | Start angle (radians) |
angle_max | int32_t | End angle (radians) |
angle_increment | int32_t | Angle increment (radians) |
time_increment | int32_t | Time increment (seconds) |
scan_time | int32_t | Scan time (seconds) |
range_min | int32_t | Minimum range (meters) |
range_max | int32_t | Maximum range (meters) |
ranges | std::vector<double> | Range data array |
intensities | std::vector<double> | Intensity data array |
MultiArrayDimension
— Multi-dimensional Array Dimension Description
Field Name | Type | Description |
---|---|---|
label | std::string | Dimension label |
size | int32_t | Dimension size |
stride | int32_t | Stride |
MultiArrayLayout
— Multi-dimensional Array Layout Description
Field Name | Type | Description |
---|---|---|
dim_size | int32_t | Number of dimensions |
dim | std::vector<MultiArrayDimension> | Array of dimensions |
data_offset | int32_t | Data offset |
Float32MultiArray
— Float Multi-dimensional Array
Field Name | Type | Description |
---|---|---|
layout | MultiArrayLayout | Array layout information |
data | std::vector<float> | Float data array |
Int8
— 8-bit Integer Data Structure
Field Name | Type | Description |
---|---|---|
data | int8_t | 8-bit integer data |
HeadTouch
— Head Touch Data Structure
Item | Description |
---|---|
Type | Int8 |
Description | Head touch sensor data, using 8-bit integer format |