A minimal ROS package to visualize an Ouster OS1-64 sensor model in RViz against an existing, namespaced TF tree.
This package provides a simple way to display the 3D model of an Ouster OS1-64 sensor in RViz. It is specifically designed for situations where another ROS node or a rosbag is already publishing the sensor's coordinate frames (TFs), especially when those frames are published with a ROS namespace (e.g., /os1/os_sensor).
It correctly handles the common problem of linking a URDF model (which uses a tf_prefix with underscores, like os1_lidar) to an existing TF tree that uses namespaces (like os1/os_lidar).
- ROS Noetic (or a similar version with
catkin). - A running
roscore. - An active data source (e.g., a
rosbag playcommand or a live driver) that is publishing the sensor's TF frames.
-
Clone this repository into your catkin workspace's
srcdirectory:cd ~/your_catkin_ws/src/ git clone <URL_to_your_repository>
-
Build the workspace:
cd ~/your_catkin_ws/ catkin_make
-
Source the workspace to make the package available in your environment:
source devel/setup.bash
This package is designed to run alongside your existing data source. You will typically use two terminals.
In your first terminal, start the node or rosbag that publishes your sensor's data and TF frames.
Example using rosbag play:
# This bag must publish TF frames like /os1/os_sensor, /os1/os_lidar, etc.
rosbag play your_ouster_data.bag --clockIn your second terminal, run the launch file from this package.
roslaunch ouster_description visualize.launch tf_prefix:=os1The tf_prefix argument is crucial. It must match the namespace used in your TF data.
- If your frames are
os1/os_sensor,os1/os_lidar-> usetf_prefix:=os1 - If your frames are
my_robot/sensor_link,my_robot/lidar_link-> usetf_prefix:=my_robot
You should now see an RViz window with the Ouster sensor model correctly positioned relative to your other TF frames.
This package uses a few key components to solve the visualization problem:
-
urdf/my_ouster_model.urdf.xacro: This is the top-level robot description file. It defines a dummyworldlink and instantiates the Ouster model fromOS1-64.urdf.xacro, attaching it to thisworldlink. -
launch/visualize.launch: This is the main entry point. It does three things:- Loads the URDF from
my_ouster_model.urdf.xacroto the/robot_descriptionparameter. - Starts the
robot_state_publisherto publish the internal transforms of the sensor model (e.g., the transform fromos1toos1_imu). - Starts a
static_transform_publisherto create a "bridge".
- Loads the URDF from
The key to this package is the static_transform_publisher node launched in visualize.launch. It publishes a single, static transform that connects the namespaced frame from your data source (e.g., os1/os_sensor) to the world link defined in our URDF.
This bridge is what solves the "No transform from [world] to [base_footprint]" error in RViz, snapping the sensor model into the correct place within your robot's main TF tree.