Sensor Control Service
About 3157 wordsAbout 11 min
2025-07-0810:23:13
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 |
---|---|
Function Name | SensorController |
Function Declaration | SensorController(); |
Function Overview | Constructor, initializes sensor controller object. |
Notes | Constructs internal state. |
~SensorController
Item | Content |
---|---|
Function Name | ~SensorController |
Function Declaration | virtual ~SensorController(); |
Function Overview | Destructor, releases all sensor resources. |
Notes | Sensors should be closed before calling. |
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. |
OpenLidar
Item | Content |
---|---|
Function Name | OpenLidar |
Function Declaration | Status OpenLidar(); |
Function Overview | Open LiDAR. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface. |
CloseLidar
Item | Content |
---|---|
Function Name | CloseLidar |
Function Declaration | Status CloseLidar(); |
Function Overview | Close LiDAR. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface, used in conjunction with open function. |
OpenRgbdCamera
Item | Content |
---|---|
Function Name | OpenRgbdCamera |
Function Declaration | Status OpenRgbdCamera(); |
Function Overview | Open RGBD camera (head). |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface. |
CloseRgbdCamera
Item | Content |
---|---|
Function Name | CloseRgbdCamera |
Function Declaration | Status CloseRgbdCamera(); |
Function Overview | Close RGBD camera. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface, used in conjunction with open function. |
OpenBinocularCamera
Item | Content |
---|---|
Function Name | OpenBinocularCamera |
Function Declaration | Status OpenBinocularCamera(); |
Function Overview | Open binocular camera. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface. |
CloseBinocularCamera
Item | Content |
---|---|
Function Name | CloseBinocularCamera |
Function Declaration | Status CloseBinocularCamera(); |
Function Overview | Close binocular camera. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface. |
SubscribeLidarImu
Item | Content |
---|---|
Function Name | SubscribeLidarImu |
Function Declaration | void SubscribeLidarImu(const LidarImuCallback& callback); |
Function Overview | Subscribe to LiDAR IMU data |
Parameter Description | callback: Data processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeLidarPointCloud
Item | Content |
---|---|
Function Name | SubscribeLidarPointCloud |
Function Declaration | void SubscribeLidarPointCloud(const LidarPointCloudCallback& callback); |
Function Overview | Subscribe to LiDAR point cloud data |
Parameter Description | callback: Point cloud processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeHeadRgbdColorImage
Item | Content |
---|---|
Function Name | SubscribeHeadRgbdColorImage |
Function Declaration | void SubscribeHeadRgbdColorImage(const RgbdImageCallback& callback); |
Function Overview | Subscribe to head RGBD color image data |
Parameter Description | callback: Image processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeHeadRgbdDepthImage
Item | Content |
---|---|
Function Name | SubscribeHeadRgbdDepthImage |
Function Declaration | void SubscribeHeadRgbdDepthImage(const RgbdImageCallback& callback); |
Function Overview | Subscribe to head RGBD depth image data |
Parameter Description | callback: Image processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeHeadRgbdCameraInfo
Item | Content |
---|---|
Function Name | SubscribeHeadRgbdCameraInfo |
Function Declaration | void SubscribeHeadRgbdCameraInfo(const RgbdCameraInfoCallback& callback); |
Function Overview | Subscribe to head RGBD camera parameters |
Parameter Description | callback: Parameter processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeBinocularImage
Item | Content |
---|---|
Function Name | SubscribeBinocularImage |
Function Declaration | void SubscribeBinocularImage(const BinocularImageCallback& callback); |
Function Overview | Subscribe to binocular camera image frames |
Parameter Description | callback: Image frame processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
SubscribeBinocularCameraInfo
Item | Content |
---|---|
Function Name | SubscribeBinocularCameraInfo |
Function Declaration | void SubscribeBinocularCameraInfo(const RgbdCameraInfoCallback& callback); |
Function Overview | Subscribe to binocular camera parameters |
Parameter Description | callback: Parameter processing function after receiving data |
Notes | Non-blocking interface, callback function will be called when data is updated. |
Type Definitions
Imu
— IMU Data Structure
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
orientation[4] | std::array<double, 4> | Attitude quaternion (w, x, y, z) |
angular_velocity[3] | std::array<double, 3> | Angular velocity (unit: rad/s) |
linear_acceleration[3] | std::array<double, 3> | Linear acceleration (unit: m/s²) |
temperature | float | Temperature (unit: Celsius or other, unit 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 (such as x, y, z, intensity) |
offset | int32_t | Starting byte offset |
datatype | int8_t | Data type (corresponding constant) |
count | int32_t | Number of elements this field contains per point |
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 | vector<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 | vector<uint8_t> | Raw point cloud byte data |
is_dense | bool | Whether dense point cloud |
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 (such as rgb8, mono8) |
is_bigendian | bool | Whether big-endian mode |
step | int32_t | Number of bytes per image row |
data | vector<uint8_t> | Raw image byte data |
CameraInfo
— Camera Intrinsic Parameters 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 (such as plumb_bob) |
D | vector<double> | Distortion parameter array |
K | std::array<double, 9> | Camera intrinsic parameter matrix |
R | std::array<double, 9> | Rectification matrix |
P | std::array<double, 12> | Projection matrix |
binning_x | int32_t | Horizontal binning coefficient |
binning_y | int32_t | Vertical binning coefficient |
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 perform rectification |
BinocularCameraFrame
— Binocular Camera Frame Data Structure
Field Name | Type | Description |
---|---|---|
header | Header | Common message header |
format | std::string | Image format |
data | vector<uint8_t> | Left eye and binocular stitched image data, left half is left eye image, right half is right eye image |