Skip to content

Commit

Permalink
added time bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
mhubii committed Sep 27, 2024
1 parent 56db45d commit 833ed94
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
6 changes: 3 additions & 3 deletions lbr_bringup/launch/gazebo.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def generate_launch_description() -> LaunchDescription:

# Gazebo
ld.add_action(GazeboMixin.include_gazebo()) # Gazebo has its own controller manager
spawn_entity = GazeboMixin.node_spawn_entity(
tf=world_robot_tf
ld.add_action(GazeboMixin.node_clock_bridge())
ld.add_action(
GazeboMixin.node_create(tf=world_robot_tf)
) # spawns robot in Gazebo through robot_description topic of robot_state_publisher
ld.add_action(spawn_entity)

# controllers
joint_state_broadcaster = LBRROS2ControlMixin.node_controller_spawner(
Expand Down
4 changes: 4 additions & 0 deletions lbr_bringup/launch/move_group.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def hidden_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
"robot_description_semantic",
PathJoinSubstitution([robot_name, "robot_description_semantic"]),
),
(
"recognized_object_array",
PathJoinSubstitution([robot_name, "recognized_object_array"]),
),
],
condition=IfCondition(LaunchConfiguration("rviz")),
)
Expand Down
26 changes: 19 additions & 7 deletions lbr_bringup/lbr_bringup/gazebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ def include_gazebo(**kwargs) -> IncludeLaunchDescription:
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
FindPackageShare("gazebo_ros"),
FindPackageShare("ros_gz_sim"),
"launch",
"gazebo.launch.py",
"gz_sim.launch.py",
]
)
),
),
launch_arguments={"gz_args": "-r empty.sdf"}.items(),
**kwargs,
)

@staticmethod
def node_spawn_entity(
def node_create(
robot_name: Optional[Union[LaunchConfiguration, str]] = LaunchConfiguration(
"robot_name", default="lbr"
),
Expand All @@ -34,16 +35,27 @@ def node_spawn_entity(
label = ["-x", "-y", "-z", "-R", "-P", "-Y"]
tf = [str(x) for x in tf]
return Node(
package="gazebo_ros",
executable="spawn_entity.py",
package="ros_gz_sim",
executable="create",
arguments=[
"-topic",
"robot_description",
"-entity",
"-name",
robot_name,
"-allow_renaming",
]
+ [item for pair in zip(label, tf) for item in pair],
output="screen",
namespace=robot_name,
**kwargs,
)

@staticmethod
def node_clock_bridge(**kwargs) -> Node:
return Node(
package="ros_gz_bridge",
executable="parameter_bridge",
arguments=["/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock"],
output="screen",
**kwargs,
)
1 change: 1 addition & 0 deletions lbr_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<exec_depend>rclpy</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>ros_gz_sim</exec_depend>
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>rviz2</exec_depend>
<exec_depend>xacro</exec_depend>

Expand Down
2 changes: 0 additions & 2 deletions lbr_description/gazebo/lbr_gazebo.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<parameters>$(find lbr_ros2_control)/config/lbr_controllers.yaml</parameters>
<ros>
<namespace>/${robot_name}</namespace>
<!-- remapping for controller manager inside Gazebo plugin -->
<remapping>~/robot_description:=robot_description</remapping>
</ros>
</plugin>
</gazebo>
Expand Down
2 changes: 1 addition & 1 deletion lbr_description/lbr_description.dsv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share
prepend-non-duplicate;GZ_SIM_RESOURCE_PATH;share
2 changes: 1 addition & 1 deletion lbr_ros2_control/config/lbr_system_interface.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</command_interface>
<!-- only single command interface, refer
https://github.com/ros-controls/gz_ros2_control/issues/182 -->
<xacro:unless value="${sim}">
<xacro:unless value="${mode == 'gazebo'}">
<command_interface name="effort">
<param name="min">-${max_torque}</param>
<param name="max"> ${max_torque}</param>
Expand Down

0 comments on commit 833ed94

Please sign in to comment.