Skip to content

songhat/ros1_bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

编译ros humble源码

unset ROS_DISTRO unset ROS_ROOT unset ROS_PACKAGE_PATH unset ROS_MASTER_URI unset ROS_VERSION unset ROS_PYTHON_VERSION unset ROSLISP_PACKAGE_DIRECTORIES

colcon build --symlink-install --parallel-workers 2

编译ros1 msgs源码

source /opt/ros/noetic/setup.bash catkin_make_isolated

编译ros2 msgs源码

source ~/ros2_humble/install/setup.bash colcon build --symlink-install --parallel-workers 2

编译ros1 brige源码

source /opt/ros/noetic/setup.bash source ~/bridge_ws/ros1_msgs_ws/devel_isolated/setup.bash source ~/ros2_humble/install/setup.bash source ~/bridge_ws/ros2_msgs_ws/install/local_setup.bash colcon build

测试ros1 bridge

shell 1: 运行roscore

source /opt/ros/noetic/setup.bash roscore

shell 2: 运行ros1 bridge

source ~/bridge_ws/bridge_ws/install/setup.bash export ROS_MASTER_URI=http://localhost:11311

ros2 run ros1_bridge dynamic_bridge --print-pairs # 查看支持的消息类型

ros2 run ros1_bridge dynamic_bridge --bridge-all-topics

shell 3: 测试消息传输

ros2发送消息

source ~/bridge_ws/ros2_msgs_ws/install/setup.bash ros2 topic pub /joint_command bridge_msgs/JointCommand "{positions: [0.123]}"

shell 4: ros1接收消息

source /opt/ros/noetic/setup.bash source ~/bridge_ws/ros1_msgs_ws/devel_isolated/setup.bash rostopic echo /joint_command

测试容器之间的ros1 bridge

ros1容器: 运行roscore

source /opt/ros/noetic/setup.bash roscore

ros1 bridge容器: 运行ros1 bridge

source ~/bridge_ws/bridge_ws/install/setup.bash
#export ROS_MASTER_URI=http://ros1:11311
# ros2 run ros1_bridge dynamic_bridge --print-pairs # 查看支持的消息类型
ros2 run ros1_bridge dynamic_bridge --bridge-all-topics

shell 3: 测试消息传输

ros2发送消息

source ~/bridge_ws/ros2_msgs_ws/install/setup.bash ros2 topic pub /joint_command bridge_msgs/JointCommand "{positions: [0.123]}"

shell 4: ros1接收消息

source /opt/ros/noetic/setup.bash source ~/bridge_ws/ros1_msgs_ws/devel_isolated/setup.bash rostopic echo /joint_command

常用命令

rosmsg list | grep bri ros2 interface list | grep bri

常见问题

ros1先source才不会影响ros2的环境变量 ros1中的setup.bash等于ros2的local_setup.bash

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published