Skip to main content

Overview

This page describes the ROS2 topics and services provided by lx_camera_ros in the V2 localization module.

Compile

Install the Qt5 Core and Network components. Installation commands vary by Linux distribution; the following example uses Ubuntu:
Download the libzip source from the libzip download page and compile it according to the official instructions. Run the following command from /lx_camera_ros:

Run

Recompile after changing the YAML configuration file. Changes do not take effect until the project is rebuilt.

ROS2 topic interfaces

Before testing an interface, power on the camera, wait about 30 seconds, and start the ROS2 SDK node.

Receive localization pose

ROS2 continuously receives the camera’s x, y, and theta values, publishes the values and the quaternion converted from theta to LxCamera_LocationPoseResult, and broadcasts the pose through TF.

Receive localization status

ROS2 receives the camera’s localization status (true or false) at 1 Hz and publishes it as std_msgs::msg::Bool on LxCamera_LocationResult.

Receive camera storage usage

ROS2 receives the camera’s storage usage ratio at 2 Hz and publishes it as std_msgs::msg::Float32 on LxCamera_Capacity_Status.

Receive the faulty module name

ROS2 receives the name of a faulty module from the camera and publishes it as std_msgs::msg::String on LxCamera_Module_Error.

Receive mapping progress

After mapping starts, ROS2 publishes the progress (0–100) as std_msgs::msg::Int32 on LxCamera_Mapping_Progress.

Receive mapping status

After mapping starts, ROS2 publishes the mapping status as std_msgs::msg::Bool on LxCamera_MappingState.

Set parameters

Publish a std_msgs::msg::String message to LxCamera_SetParam. The message contains nine floating-point values separated by commas: x,y,z,yaw,pitch,roll,x,y,yaw. The first six values define the camera pose; the last three define the LiDAR pose. After a successful update, the corresponding values in the [Laser1] and [Camera1] sections of /home/fr1511b/hontai/params/config_install_FL21500HAF.ini are updated.

Switch maps

Publish a std_msgs::msg::String message containing the name of a completed map to LxCamera_SwitchMap. Refresh the camera web interface. If the displayed map name changes, the switch succeeded.

Download a map

  1. Publish a std_msgs::msg::String message to LxCamera_DownloadMap.
  2. The message contains two fields: save_path, an absolute path on the host computer, and mapname, the .zip file name of a completed map on the camera.
  3. After a successful download, the specified host path contains the map archive. Extract it to obtain a PGM map file and a YAML configuration file.

Upload odometry

Publish nav_msgs::msg::Odometry data to /sim/odom (the topic can be changed).

Relocalize

  1. Publish geometry_msgs::msg::PoseWithCovarianceStamped data to LxCamera_UploadReloc.
  2. The pose contains the LiDAR pose: x, y, and yaw.
  3. Relocalization succeeds when the position shown in the camera web interface updates to the sent pose.
Quaternions are constrained and must not be filled in arbitrarily. Use the Euler-to-quaternion converter to convert an Euler yaw angle to quaternion xyzw values.

Message type prefixes

The host computer communicates with the camera over UDP. The first four bytes of each message identify the interface data type:

ROS2 service interfaces

Mapping, map switching, map downloading, and relocalization are also available through ROS2 services. A service response of true indicates success; false indicates failure.
Use ros2 service call for the following commands. Map names must not start with a number and must be no longer than 30 characters.

Build a map

Service name: /LxCamera_Mapping_srv Service definition:
Call the service:

Switch maps

Service name: /LxCamera_SwitchMap_srv Service definition:
Call the service:

Download a map

Service name: /LxCamera_DownloadMap_srv Service definition:
Call the service:

Relocalize

Service name: /LxCamera_UploadReloc_srv Service definition:
Call the service:

Get the current map name

Service name: /LxCamera_GetCurMapname_srv Service definition:
Call the service:

Get the current map list

Service name: /LxCamera_GetMapList_srv Service definition:
Call the service:

Exit mapping

Service name: /LxCamera_ExitMapping_srv Service definition:
Call the service:

Delete a map

Service name: /LxCamera_EraseMap_srv Service definition:
Call the service:

Download a heat map

Service name: /LxCamera_DownloadHeatMap_srv Service definition:
Call the service:

Incremental mapping

Service name: /LxCamera_IncMapping_srv Service definition:
Call the service: