Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GZ to ROS topic bridge #114

Open
wants to merge 2 commits into
base: jazzy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions xarm_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ endif()
install(DIRECTORY
worlds
launch
config
DESTINATION share/${PROJECT_NAME}/
)

Expand Down
5 changes: 5 additions & 0 deletions xarm_gazebo/config/gz_bridge.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions xarm_gazebo/launch/_robot_beside_table_gz.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down