From abcc653487e09ee125600e548e10f37f7e58572c Mon Sep 17 00:00:00 2001 From: Anirudh Krishnan Komaralingam Date: Sun, 26 Jan 2025 03:14:32 +0000 Subject: [PATCH 1/2] bridge gz and ros topics --- xarm_gazebo/CMakeLists.txt | 1 + xarm_gazebo/config/gz_bridge.yaml | 5 +++++ .../launch/_robot_beside_table_gz.launch.py | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 xarm_gazebo/config/gz_bridge.yaml diff --git a/xarm_gazebo/CMakeLists.txt b/xarm_gazebo/CMakeLists.txt index 4355a24..34093d5 100644 --- a/xarm_gazebo/CMakeLists.txt +++ b/xarm_gazebo/CMakeLists.txt @@ -71,6 +71,7 @@ endif() install(DIRECTORY worlds launch + config DESTINATION share/${PROJECT_NAME}/ ) diff --git a/xarm_gazebo/config/gz_bridge.yaml b/xarm_gazebo/config/gz_bridge.yaml new file mode 100644 index 0000000..0e53da3 --- /dev/null +++ b/xarm_gazebo/config/gz_bridge.yaml @@ -0,0 +1,5 @@ +- ros_topic_name: "clock" + gz_topic_name: "clock" + ros_type_name: "rosgraph_msgs/msg/Clock" + gz_type_name: "gz.msgs.Clock" + direction: GZ_TO_ROS \ No newline at end of file diff --git a/xarm_gazebo/launch/_robot_beside_table_gz.launch.py b/xarm_gazebo/launch/_robot_beside_table_gz.launch.py index cfa36ab..983e73d 100644 --- a/xarm_gazebo/launch/_robot_beside_table_gz.launch.py +++ b/xarm_gazebo/launch/_robot_beside_table_gz.launch.py @@ -170,6 +170,18 @@ def launch_setup(context, *args, **kwargs): parameters=[{'use_sim_time': True}], ) + # bridge gz and ros topics + bridge_params = os.path.join(get_package_share_directory('xarm_gazebo'),'config','gz_bridge.yaml') + ros_gz_bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + arguments=[ + '--ros-args', + '-p', + f'config_file:={bridge_params}' + ] + ) + # rviz with moveit configuration rviz_config_file = PathJoinSubstitution([FindPackageShare(moveit_config_package_name), 'rviz', 'planner.rviz' if no_gui_ctrl.perform(context) == 'true' else 'moveit.rviz']) rviz2_node = Node( @@ -233,6 +245,12 @@ def launch_setup(context, *args, **kwargs): on_start=gazebo_spawn_entity_node, ) ), + RegisterEventHandler( + event_handler=OnProcessStart( + target_action=robot_state_publisher_node, + on_start=ros_gz_bridge, + ) + ), RegisterEventHandler( condition=IfCondition(show_rviz), event_handler=OnProcessExit( From c4dca718f7ef2d35af0a94e840f1cef9996ecfa0 Mon Sep 17 00:00:00 2001 From: Anirudh Krishnan Komaralingam Date: Sun, 26 Jan 2025 03:16:16 +0000 Subject: [PATCH 2/2] fix - missing reference in ros2control causing build failure --- .../include/xarm_controller/hardware/uf_robot_system_hardware.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarm_controller/include/xarm_controller/hardware/uf_robot_system_hardware.h b/xarm_controller/include/xarm_controller/hardware/uf_robot_system_hardware.h index c0288ca..6e01dab 100644 --- a/xarm_controller/include/xarm_controller/hardware/uf_robot_system_hardware.h +++ b/xarm_controller/include/xarm_controller/hardware/uf_robot_system_hardware.h @@ -21,7 +21,7 @@ #include "hardware_interface/system_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/types/hardware_interface_type_values.hpp" -#include "hardware_interface/visibility_control.h" +// #include "hardware_interface/visibility_control.h" #include "controller_manager_msgs/srv/list_controllers.hpp" #include "controller_manager_msgs/srv/switch_controller.hpp" #include "xarm_api/xarm_driver.h"