Interfaces repo - All interfaces including APIs, UIs etc go here
- SSH (pwd: a.i.makerspace1001)
- export ROS_MASTER_URI=???
For the Jetson Xavier with Ubuntu 18.04 installed, Docker containers have to be used in order to use ROS2 (Humble). The Dockerfile simply builds the Docker image for ROS2 with ros1_bridge packaged installed.
To use the ros1_bridge to network ROS1 and ROS2, the follow the steps below.
- Start roscore for ROS1 Melodic (natively installed on Xavier
source /opt/ros/melodic/setup.bash
roscore
- Build ROS2 Docker Container (if not already built)
cd ros-humble
sudo docker build -t ros-humble .
- Run ROS2 Docker
sudo docker run -it --name ros-humble --net=host ros-humble-volume:tf_static
- Source ros and ros1_bridge workspace
source /opt/ros/humble/setup.bash
source ros-humble-ros1-bridge/install/local_setup.bash
-
Start ros1_bridge node in ROS2 docker Dynamic bridge to bridge all topics
ros2 run ros1_bridge dynamic_bridge --bridge-all-topicsParameter bridge to bridge only selected topics and services: Load yaml file with mentioned topics and services to rosparam on ros1
### following commands are to be run on the fetch ###### cd ros-humble/config rosparam load bridge.yamlTo run the bridge with the updated params run the following from the ros2 docker
ros2 run ros1_bridge parameter_bridgeto add topics and services to bridge update bridge.yaml on the fetch in ~/ros-humble/config/
topics:
- topic: /odom # Topic name on both ROS 1 and ROS 2
type: nav_msgs/msg/Odometry # Type of topic to bridge - add ros2 msg type and not ros1
queue_size: 1 # Queue size
qos:
history: keep_last # OR keep_all, then you can omit
depthparameter below depth: 10 # Only required when history == keep_last reliability: reliable # OR best_effort durability: transient_local # OR volatile deadline: secs: 10 nsecs: 2345 lifespan: secs: 20 nsecs: 3456 liveliness: liveliness_system_default # Values from https://design.ros2.org/articles/qos_deadline_liveliness_lifespan.html, eg. LIVELINESS_AUTOMATIC liveliness_lease_duration: secs: 40 nsecs: 5678
#services_2_to_1:
#services_1_to_2:
Now, ROS2 within the container environment should be connected to ROS1.
### Example
1. In a different Jetson terminal, publish or subscribe to a topic.
source /opt/ros/melodic/setup.bash rostopic pub /chatter std_msgs/String hello
2. In a different ROS2 docker terminal, subscribe or publish to a topic.
source /opt/ros/humble/setup.bash ros2 topic echo /chatter
Note: the following terminal command can be used to start another Docker terminal.
sudo docker exec ros-humble /bin/bash