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 c0288cac..6e01dab4 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" diff --git a/xarm_gazebo/CMakeLists.txt b/xarm_gazebo/CMakeLists.txt index 4355a249..34093d5d 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 00000000..0e53da3a --- /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 cfa36ab1..983e73d0 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(