Skip to content

Commit

Permalink
Rename cartpole with cart (backport #214) (#217)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
mergify[bot] and ahcorde authored Jan 4, 2024
1 parent db38d87 commit 9afa0cd
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 47 deletions.
28 changes: 7 additions & 21 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ robot hardware interfaces between *ros2_control* and Gazebo.
<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<robot_param>robot_description</robot_param>
<robot_param_node>robot_state_publisher</robot_param_node>
<parameters>$(find gz_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
<parameters>$(find gz_ros2_control_demos)/config/cart_controller.yaml</parameters>
</plugin>
</gazebo>
Expand Down Expand Up @@ -200,32 +200,18 @@ and use the tag ``<controller_manager_prefix_node_name>`` to set the controller
<gazebo>
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="libgz_ros2_control-system">
<parameters>$(find gz_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
<parameters>$(find gz_ros2_control_demos)/config/cart_controller.yaml</parameters>
<controller_manager_prefix_node_name>controller_manager</controller_manager_prefix_node_name>
</plugin>
<gazebo>
This controller publishes the state of all resources registered to a
``hardware_interface::StateInterface`` to a topic of type ``sensor_msgs/msg/JointState``.
The following is a basic configuration of the controller.
The following is a basic configuration of the controllers:

.. code-block:: yaml
- ``joint_state_broadcaster``: This controller publishes the state of all resources registered to a ``hardware_interface::StateInterface`` to a topic of type ``sensor_msgs/msg/JointState``.
- ``joint_trajectory_controller``: This controller creates an action called ``/joint_trajectory_controller/follow_joint_trajectory`` of type ``control_msgs::action::FollowJointTrajectory``.

joint_state_controller:
ros__parameters:
type: joint_state_controller/JointStateController
This controller creates an action called ``/cart_pole_controller/follow_joint_trajectory`` of type ``control_msgs::action::FollowJointTrajectory``.

.. code-block:: yaml
cart_pole_controller:
ros__parameters:
type: joint_trajectory_controller/JointTrajectoryController
joints:
- slider_to_cart
write_op_modes:
- slider_to_cart
.. literalinclude:: ../gz_ros2_control_demos/config/cart_controller_position.yaml
:language: yaml


gz_ros2_control_demos
Expand Down
2 changes: 1 addition & 1 deletion gz_ros2_control_tests/tests/position_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate_test_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'cart',
'-allow_renaming', 'true'],
)

Expand Down
6 changes: 1 addition & 5 deletions gz_ros2_control_tests/urdf/test_cart_position.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from cartpole.xacro.urdf | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="cartopole">
<link name="world"/>
<link name="slideBar">
Expand Down Expand Up @@ -95,7 +91,7 @@
<gazebo>
<!-- Joint state publisher -->
<plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<parameters>$(find gz_ros2_control_tests)/config/cartpole_controller_position.yaml</parameters>
<parameters>$(find gz_ros2_control_tests)/config/cart_controller_position.yaml</parameters>
</plugin>
</gazebo>
</robot>
14 changes: 14 additions & 0 deletions ign_ros2_control_demos/config/cart_controller_effort.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
controller_manager:
ros__parameters:
update_rate: 1000 # Hz

effort_controller:
type: effort_controllers/JointGroupEffortController

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

effort_controller:
ros__parameters:
joints:
- slider_to_cart
19 changes: 19 additions & 0 deletions ign_ros2_control_demos/config/cart_controller_position.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
controller_manager:
ros__parameters:
update_rate: 100 # Hz

joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

joint_trajectory_controller:
ros__parameters:
joints:
- slider_to_cart
command_interfaces:
- position
state_interfaces:
- position
- velocity
22 changes: 22 additions & 0 deletions ign_ros2_control_demos/config/cart_controller_velocity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
controller_manager:
ros__parameters:
update_rate: 1000 # Hz

velocity_controller:
type: velocity_controllers/JointGroupVelocityController

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

imu_sensor_broadcaster:
type: imu_sensor_broadcaster/IMUSensorBroadcaster

velocity_controller:
ros__parameters:
joints:
- slider_to_cart

imu_sensor_broadcaster:
ros__parameters:
sensor_name: cart_imu_sensor
frame_id: imu
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'cart',
'-allow_renaming', 'true'],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'cart',
'-allow_renaming', 'true'],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'cart',
'-allow_renaming', 'true'],
)

Expand Down
2 changes: 1 addition & 1 deletion ign_ros2_control_demos/launch/diff_drive_example.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def generate_launch_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'diff_drive',
'-allow_renaming', 'true'],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def generate_launch_description():
executable='create',
output='screen',
arguments=['-string', doc.toxml(),
'-name', 'cartpole',
'-name', 'tricyle',
'-allow_renaming', 'true'],
)

Expand Down
6 changes: 1 addition & 5 deletions ign_ros2_control_demos/urdf/test_cart_effort.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from cartpole.xacro.urdf | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="cartopole">
<link name="world"/>
<link name="slideBar">
Expand Down Expand Up @@ -83,7 +79,7 @@
<gazebo>
<!-- Joint state publisher -->
<plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<parameters>$(find ign_ros2_control_demos)/config/cartpole_controller_effort.yaml</parameters>
<parameters>$(find ign_ros2_control_demos)/config/cart_controller_effort.yaml</parameters>
</plugin>
</gazebo>
</robot>
6 changes: 1 addition & 5 deletions ign_ros2_control_demos/urdf/test_cart_position.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from cartpole.xacro.urdf | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="cartopole">
<link name="world"/>
<link name="slideBar">
Expand Down Expand Up @@ -83,7 +79,7 @@
<gazebo>
<!-- Joint state publisher -->
<plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<parameters>$(find ign_ros2_control_demos)/config/cartpole_controller_position.yaml</parameters>
<parameters>$(find ign_ros2_control_demos)/config/cart_controller_position.yaml</parameters>
</plugin>
</gazebo>
</robot>
6 changes: 1 addition & 5 deletions ign_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from cartpole.xacro.urdf | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="cartopole">
<link name="slideBar">
<visual>
Expand Down Expand Up @@ -161,7 +157,7 @@
<gazebo>
<!-- Joint state publisher -->
<plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<parameters>$(find ign_ros2_control_demos)/config/cartpole_controller_velocity.yaml</parameters>
<parameters>$(find ign_ros2_control_demos)/config/cart_controller_velocity.yaml</parameters>
</plugin>
<plugin
filename="ignition-gazebo-imu-system"
Expand Down

0 comments on commit 9afa0cd

Please sign in to comment.