Cardinal Perception is CSM's ROS2 perception package which comprises all the necessary prerequisites for advanced autonomy; most notably localization, path-planning and terrain analysis. It has been designed around using the SICK MultiScan136 3D-LiDAR as its only input, although is highly configrable and likely to support other LiDAR/IMU setups.
Important
CSM team members: Cardinal Perception is usually included as a submodule in larger robot code projects, where build/install procedures are integrated into a larger system/script. YOU SHOULD NOT NEED TO CLONE/USE THIS REPO ON ITS OWN!
Note
Cardinal Perception has been verified to build and function on ROS2 Humble (Ubuntu 22.04), Jazzy (Ubuntu 24.04) and Kilted (Ubuntu 24.04), on both x86-64 and aarch64 architectures, as well as WSL.
-
Install ROS2 if necessary
-
Setup your workspace and clone required repos
- Create directories:
mkdir ros-ws && cd ros-ws mkdir src && cd src
- Clone repos:
git clone https://github.com/Cardinal-Space-Mining/Cardinal-Perception -b main cardinal-perception git clone https://github.com/Cardinal-Space-Mining/launch-utils -b main launch-utils git clone https://github.com/Cardinal-Space-Mining/csm-metrics -b main csm-metrics
- Navigate back to your workspace directory for the following steps:
cd ..
- Create directories:
-
Use rosdep to install ROS package dependencies
- Initialize rosdep if necessary:
sudo rosdep init
- Update and install:
rosdep update rosdep install --ignore-src --from-paths ./src -r -y
- Initialize rosdep if necessary:
-
Install apt dependencies (should have already been resolved by rosdep)
sudo apt update sudo apt-get install libpcl-dev libopencv-dev
-
Build with colcon
colcon build \ --symlink-install \ --event-handlers console_direct+ \ --cmake-args=-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON source install/setup.bash
Tip
There are various compile-time configurations which are exposed as CMake options. These are all listed in the config generator template.
The best way to run Cardinal Perception is by using the included launchfile, which utilizes launch-utils to setup everything using the included JSON config:
ros2 launch cardinal_perception perception.launch.pyImportant
Review the following sections to ensure ROS2 and your config file are setup properly!
Cardinal Perception requires the following in order to run:
- A
sensor_msgs::msg::PointCloud2topic providing a 3D LiDAR scan. This can be live or from a bag. - A proper transform definition, usually published on
/tfand/tf_staticbyrobot_state_publisher. The launch-utils package provides a way to bundle the config for this and automatically launch this node - see the relevant docs for more information.
The following are not required but are useful in some situations:
- A
sensor_msgs::msg::Imutopic providing IMU samples. This is used by the LIO system to pre-align scans and can drastically improve localization quality when in featureless environments or if scan message reliability is decreased. Some LiDARs contain integrated IMUs in which case this is a freebe. - A set of
sensor_msgs::msg::Imageand accompanyingsensor_msgs::msg::CameraInfotopic for any number of cameras. These can be used to enable the optional AprilTag alignment pipeline.
As already alluded, Cardinal Perception uses the launch-utils package to handle configuration and launching. This is due to the fact that many other ROS2 nodes must be run alongside Cardinal Perception in order to accomplish anything useful. By default, the included launch system uses this file to configure and launch everything. This is merely a starting point which includes defaults for all the main parameters that can be used by Cardinal Perception, as well a barebones robot setup for the various boilerplate ROS2 nodes.
The primary config sections used by Cardinal Perception are:
perception: Configures the main perception node.tag_detection: Configures the AprilTag detector node.pplan_client: Configures (enables/disables) the path planning client node.
Due to the large number of paramters, up-to-date descriptions on what each one does have not been documented here. Old documentation can be referenced here for some parameters that haven't changed in a while, and more specific docs about this may be included in the future. Fortunately, many configs can be left unchanged and the most crucial ones are quite straightforward in what they do.
Tip
To better understand the config file layout, as well as boilerplate config sections, check out the relevant docs.
Tip
The example config is a cut down version of the primarly config used by CSM's LANCE robot(s). The full config can be found here.
The provided build command exports compile commands which can help VSCode's C/C++ extension resolve correct syntax highlighting. To ensure this is working, paste the following code into the c_cpp_properties.json file (under .vscode directory in a workspace):
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"intelliSenseMode": "linux-gcc-x64",
"cStandard": "c17",
"cppStandard": "c++17",
"compileCommands": [
"build/compile_commands.json"
]
}
],
"version": 4
}Last updated on 1/19/26
