Skip to content

Commit 833ed94

Browse files
committed
added time bridge
1 parent 56db45d commit 833ed94

File tree

7 files changed

+29
-14
lines changed

7 files changed

+29
-14
lines changed

lbr_bringup/launch/gazebo.launch.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ def generate_launch_description() -> LaunchDescription:
3838

3939
# Gazebo
4040
ld.add_action(GazeboMixin.include_gazebo()) # Gazebo has its own controller manager
41-
spawn_entity = GazeboMixin.node_spawn_entity(
42-
tf=world_robot_tf
41+
ld.add_action(GazeboMixin.node_clock_bridge())
42+
ld.add_action(
43+
GazeboMixin.node_create(tf=world_robot_tf)
4344
) # spawns robot in Gazebo through robot_description topic of robot_state_publisher
44-
ld.add_action(spawn_entity)
4545

4646
# controllers
4747
joint_state_broadcaster = LBRROS2ControlMixin.node_controller_spawner(

lbr_bringup/launch/move_group.launch.py

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def hidden_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
7575
"robot_description_semantic",
7676
PathJoinSubstitution([robot_name, "robot_description_semantic"]),
7777
),
78+
(
79+
"recognized_object_array",
80+
PathJoinSubstitution([robot_name, "recognized_object_array"]),
81+
),
7882
],
7983
condition=IfCondition(LaunchConfiguration("rviz")),
8084
)

lbr_bringup/lbr_bringup/gazebo.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ def include_gazebo(**kwargs) -> IncludeLaunchDescription:
1414
PythonLaunchDescriptionSource(
1515
PathJoinSubstitution(
1616
[
17-
FindPackageShare("gazebo_ros"),
17+
FindPackageShare("ros_gz_sim"),
1818
"launch",
19-
"gazebo.launch.py",
19+
"gz_sim.launch.py",
2020
]
21-
)
21+
),
2222
),
23+
launch_arguments={"gz_args": "-r empty.sdf"}.items(),
2324
**kwargs,
2425
)
2526

2627
@staticmethod
27-
def node_spawn_entity(
28+
def node_create(
2829
robot_name: Optional[Union[LaunchConfiguration, str]] = LaunchConfiguration(
2930
"robot_name", default="lbr"
3031
),
@@ -34,16 +35,27 @@ def node_spawn_entity(
3435
label = ["-x", "-y", "-z", "-R", "-P", "-Y"]
3536
tf = [str(x) for x in tf]
3637
return Node(
37-
package="gazebo_ros",
38-
executable="spawn_entity.py",
38+
package="ros_gz_sim",
39+
executable="create",
3940
arguments=[
4041
"-topic",
4142
"robot_description",
42-
"-entity",
43+
"-name",
4344
robot_name,
45+
"-allow_renaming",
4446
]
4547
+ [item for pair in zip(label, tf) for item in pair],
4648
output="screen",
4749
namespace=robot_name,
4850
**kwargs,
4951
)
52+
53+
@staticmethod
54+
def node_clock_bridge(**kwargs) -> Node:
55+
return Node(
56+
package="ros_gz_bridge",
57+
executable="parameter_bridge",
58+
arguments=["/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock"],
59+
output="screen",
60+
**kwargs,
61+
)

lbr_bringup/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<exec_depend>rclpy</exec_depend>
2121
<exec_depend>robot_state_publisher</exec_depend>
2222
<exec_depend>ros_gz_sim</exec_depend>
23+
<exec_depend>ros_gz_bridge</exec_depend>
2324
<exec_depend>rviz2</exec_depend>
2425
<exec_depend>xacro</exec_depend>
2526

lbr_description/gazebo/lbr_gazebo.xacro

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
<parameters>$(find lbr_ros2_control)/config/lbr_controllers.yaml</parameters>
1010
<ros>
1111
<namespace>/${robot_name}</namespace>
12-
<!-- remapping for controller manager inside Gazebo plugin -->
13-
<remapping>~/robot_description:=robot_description</remapping>
1412
</ros>
1513
</plugin>
1614
</gazebo>

lbr_description/lbr_description.dsv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share
1+
prepend-non-duplicate;GZ_SIM_RESOURCE_PATH;share

lbr_ros2_control/config/lbr_system_interface.xacro

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
</command_interface>
101101
<!-- only single command interface, refer
102102
https://github.com/ros-controls/gz_ros2_control/issues/182 -->
103-
<xacro:unless value="${sim}">
103+
<xacro:unless value="${mode == 'gazebo'}">
104104
<command_interface name="effort">
105105
<param name="min">-${max_torque}</param>
106106
<param name="max"> ${max_torque}</param>

0 commit comments

Comments
 (0)