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

Humble ignition gazebo #117

Merged
merged 33 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
66e9995
initial ignition gazebo changes
mhubii Sep 7, 2023
325447d
added sim run arg
mhubii Sep 7, 2023
000f4b5
added dep
mhubii Sep 7, 2023
173253b
added empty world
mhubii Sep 7, 2023
66feb9a
updated name argument
mhubii Sep 7, 2023
a8962b0
added classic mixin
mhubii Sep 7, 2023
5f40de3
added classic mixin
mhubii Sep 7, 2023
1633d06
Merge branch 'humble' into dev-humble-ignition-gazebo
mhubii Sep 8, 2023
7dc29c5
simplified urdfs
mhubii Sep 8, 2023
865fec7
fixed names
mhubii Sep 8, 2023
dfdf21e
updated ros2 control effort reject
mhubii Sep 8, 2023
d9a4065
updated tests
mhubii Sep 8, 2023
b0dfd9b
simplified gazebo xacro
mhubii Sep 8, 2023
2756ce9
renamed controller
mhubii Sep 8, 2023
b362ba5
removed robot name
mhubii Sep 8, 2023
0d67770
Merge branch 'humble' into dev-humble-ignition-gazebo
mhubii Oct 18, 2023
1e2746d
Merge branch 'humble' into dev-humble-ignition-gazebo
mhubii Jan 2, 2024
dcaa1c2
re-add position limits to system interface
mhubii Jan 2, 2024
3418768
fixed ign ros2 control dependency
mhubii Jan 2, 2024
fd6c748
updated launch
mhubii Jan 2, 2024
50fd8d5
added unless sim condition for parameters
mhubii Jan 2, 2024
4850fbd
fixed ign gazebo
mhubii Jan 3, 2024
ce194c8
simplified namespace
mhubii Jan 3, 2024
c6e94a2
use ign_ packages for humble
mhubii Jan 3, 2024
13809ea
use gz_sim instead of ign_gazebo
mhubii Jan 3, 2024
1322d3b
remvoed robot description parameter
mhubii Jan 3, 2024
910343d
controller manager: read robot description from state pub
mhubii Jan 3, 2024
0710ce6
added a remapping
mhubii Jan 3, 2024
6eb8a41
updated re-mappings
mhubii Jan 3, 2024
56db45d
Merge branch 'humble' into dev-humble-ignition-gazebo
mhubii Sep 27, 2024
833ed94
added time bridge
mhubii Sep 27, 2024
13ef9e5
bump version: 2.1.0 -> 2.1.1
mhubii Sep 27, 2024
febbf5c
2.1.1 notes
mhubii Sep 27, 2024
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
8 changes: 5 additions & 3 deletions lbr_bringup/launch/sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
)

from lbr_bringup import LBRMoveGroupMixin
from lbr_description import GazeboMixin, LBRDescriptionMixin, RVizMixin
from lbr_description import IgnitionGazeboMixin, LBRDescriptionMixin, RVizMixin
from lbr_ros2_control import LBRROS2ControlMixin


def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
ld = LaunchDescription()

robot_description = LBRDescriptionMixin.param_robot_description(sim=True)
ld.add_action(GazeboMixin.include_gazebo()) # Gazebo has its own controller manager
spawn_entity = GazeboMixin.node_spawn_entity()
ld.add_action(
IgnitionGazeboMixin.include_gazebo()
) # Gazebo has its own controller manager
spawn_entity = IgnitionGazeboMixin.node_spawn_entity()
ld.add_action(spawn_entity)
joint_state_broadcaster = LBRROS2ControlMixin.node_controller_spawner(
controller="joint_state_broadcaster"
Expand Down
14 changes: 7 additions & 7 deletions lbr_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>

<exec_depend>lbr_description</exec_depend>
<exec_depend>lbr_fri_ros2</exec_depend>
<exec_depend>lbr_ros2_control</exec_depend>
<exec_depend>controller_manager</exec_depend>
<exec_depend>ign_ros2_control</exec_depend>
<exec_depend>joint_state_broadcaster</exec_depend>
<exec_depend>joint_trajectory_controller</exec_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>lbr_description</exec_depend>
<exec_depend>lbr_fri_ros2</exec_depend>
<exec_depend>lbr_ros2_control</exec_depend>
<exec_depend>rclpy</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>gazebo_ros</exec_depend>
<exec_depend>gazebo_ros2_control</exec_depend>
<exec_depend>ros_ign_gazebo</exec_depend>
<exec_depend>rviz2</exec_depend>
<exec_depend>rclpy</exec_depend>
<exec_depend>xacro</exec_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
7 changes: 5 additions & 2 deletions lbr_description/gazebo/lbr.gazebo.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

<!-- ros_control-plugin -->
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<plugin name="ign_ros2_control::IgnitionROS2ControlPlugin"
filename="ign_ros2_control-system">
<parameters>$(find lbr_ros2_control)/config/lbr_controllers.yaml</parameters>
<robotNamespace>/${robot_name}</robotNamespace>
<ros>
<namespace>/${robot_name}</namespace>
</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;GAZEBO_MODEL_PATH;share
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share
7 changes: 6 additions & 1 deletion lbr_description/lbr_description/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .launch_mixin import GazeboMixin, LBRDescriptionMixin, RVizMixin
from .launch_mixin import (
GazeboMixin,
IgnitionGazeboMixin,
LBRDescriptionMixin,
RVizMixin,
)
41 changes: 39 additions & 2 deletions lbr_description/lbr_description/launch_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,52 @@ def node_spawn_entity(
"robot_description",
"-entity",
LaunchConfiguration("robot_name"),
"-robot_namespace",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify this functions

LaunchConfiguration("robot_name"),
],
output="screen",
namespace=LaunchConfiguration("robot_name"),
**kwargs,
)


class IgnitionGazeboMixin:
# https://answers.gazebosim.org//question/28813/how-to-spawn-a-urdf-robot-into-a-ignition-gazebo-world-from-ros2/
@staticmethod
def include_gazebo(**kwargs) -> IncludeLaunchDescription:
return IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
FindPackageShare("ros_ign_gazebo"),
"launch",
"ign_gazebo.launch.py",
]
),
),
launch_arguments={"ign_args": "-r empty.sdf"}.items(),
**kwargs,
)

@staticmethod
def node_spawn_entity(
robot_name: Optional[Union[LaunchConfiguration, str]] = None, **kwargs
) -> Node:
if robot_name is None:
robot_name = LaunchConfiguration("robot_name")
return Node(
package="ros_ign_gazebo",
executable="create",
arguments=[
"-topic",
"robot_description",
"-name",
LaunchConfiguration("robot_name"),
],
namespace=robot_name,
output="screen",
**kwargs,
)


class LBRDescriptionMixin:
@staticmethod
def param_robot_description(
Expand Down
4 changes: 2 additions & 2 deletions lbr_description/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<buildtool_depend>ament_cmake_pytest</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>

<exec_depend>gazebo_ros2_control</exec_depend>
<exec_depend>ign_ros2_control</exec_depend>
<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>tf2_ros</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>
<exec_depend>tf2_ros</exec_depend>
<exec_depend>xacro</exec_depend>

<test_depend>python3-pytest</test_depend>
Expand Down
3 changes: 1 addition & 2 deletions lbr_description/urdf/iiwa14/iiwa14_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@
<origin xyz="0 0 0.035" rpy="0 0 0" />
</joint>

<link name="link_ee">
</link>
<link name="link_ee" />

<xacro:lbr_gazebo robot_name="${robot_name}" />
<!-- TODO: move modes to args, decouple urdf/gazebo/controls -->
Expand Down
3 changes: 1 addition & 2 deletions lbr_description/urdf/iiwa7/iiwa7_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,7 @@
<origin xyz="0 0 0.035" rpy="0 0 0" />
</joint>

<link name="link_ee">
</link>
<link name="link_ee" />

<xacro:lbr_gazebo robot_name="${robot_name}" />
<!-- TODO: move modes to args, decouple urdf/gazebo/controls -->
Expand Down
3 changes: 1 addition & 2 deletions lbr_description/urdf/med14/med14_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@
<origin xyz="0 0 0.035" rpy="0 0 0" />
</joint>

<link name="link_ee">
</link>
<link name="link_ee" />

<xacro:lbr_gazebo robot_name="${robot_name}" />
<!-- TODO: move modes to args, decouple urdf/gazebo/controls -->
Expand Down
3 changes: 1 addition & 2 deletions lbr_description/urdf/med7/med7_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@
<origin xyz="0 0 0.035" rpy="0 0 0" />
</joint>

<link name="link_ee">
</link>
<link name="link_ee" />

<xacro:lbr_gazebo robot_name="${robot_name}" />
<!-- TODO: move modes to args, decouple urdf/gazebo/controls -->
Expand Down
25 changes: 16 additions & 9 deletions lbr_ros2_control/config/lbr_system_interface.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!-- define hardware including parameters, also gazebo -->
<xacro:if value="${sim}">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
<plugin>ign_ros2_control/IgnitionSystem</plugin>
</hardware>
</xacro:if>
<xacro:unless value="${sim}">
Expand Down Expand Up @@ -110,18 +110,25 @@
<xacro:macro name="joint_interface"
params="name min_position max_position max_velocity max_torque sim">
<joint name="${name}">
<param name="min_position">${min_position}</param>
<param name="max_position">${max_position}</param>
<param name="max_velocity">${max_velocity}</param>
<param name="max_torque">${max_torque}</param>
<!-- parameters only used for real driver -->
<xacro:unless value="${sim}">
<param name="min_position">${min_position}</param>
<param name="max_position">${max_position}</param>
<param name="max_velocity">${max_velocity}</param>
<param name="max_torque">${max_torque}</param>
</xacro:unless>
<command_interface name="position">
<param name="min">${min_position}</param>
<param name="max">${max_position}</param>
</command_interface>
<command_interface name="effort">
<param name="min">-${max_torque}</param>
<param name="max"> ${max_torque}</param>
</command_interface>
<!-- only single command interface, refer
https://github.com/ros-controls/gz_ros2_control/issues/182 -->
<xacro:unless value="${sim}">
<command_interface name="effort">
<param name="min">-${max_torque}</param>
<param name="max"> ${max_torque}</param>
</command_interface>
</xacro:unless>
<state_interface name="position" />
<state_interface name="velocity" />
<state_interface name="effort" />
Expand Down
Loading