Skip to content

Commit

Permalink
Rename cartpole (#252) (#254)
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit b39074a)

Co-authored-by: Christoph Fröhlich <[email protected]>
  • Loading branch information
mergify[bot] and christophfroehlich authored Jan 1, 2024
1 parent f6a2a9b commit e5b5b7c
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 60 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 Classic.
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<robot_param>robot_description</robot_param>
<robot_param_node>robot_state_publisher</robot_param_node>
<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
<parameters>$(find gazebo_ros2_control_demos)/config/cart_controller.yaml</parameters>
</plugin>
</gazebo>
Expand Down Expand Up @@ -202,32 +202,18 @@ Use the tag ``<parameters>`` inside ``<plugin>`` to set the YAML file with the c
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
<parameters>$(find gazebo_ros2_control_demos)/config/cart_controller.yaml</parameters>
</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_state_controller:
ros__parameters:
type: joint_state_controller/JointStateController
- ``joint_trajectory_controller``: This controller creates an action called ``/joint_trajectory_controller/follow_joint_trajectory`` of type ``control_msgs::action::FollowJointTrajectory``.

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:: ../gazebo_ros2_control_demos/config/cart_controller.yaml
:language: yaml

gazebo_ros2_control_demos
==========================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def generate_launch_description():

spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'cartpole'],
'-entity', 'cart'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -71,12 +71,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_joint_trajectory_controller],
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def generate_launch_description():

spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'cartpole'],
'-entity', 'cart'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -72,12 +72,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_joint_trajectory_controller],
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def generate_launch_description():

spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'cartpole'],
'-entity', 'cart'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -75,12 +75,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_joint_trajectory_controller],
)
),
Expand Down
6 changes: 3 additions & 3 deletions gazebo_ros2_control_demos/launch/diff_drive.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
'-entity', 'diffbot'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -72,12 +72,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_diff_drive_base_controller],
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def generate_launch_description():
'-entity', 'gripper'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -73,12 +73,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_gripper_controller],
)
),
Expand Down
6 changes: 3 additions & 3 deletions gazebo_ros2_control_demos/launch/tricycle_drive.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
'-entity', 'tricycle'],
output='screen')

load_joint_state_controller = ExecuteProcess(
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
Expand All @@ -82,12 +82,12 @@ def generate_launch_description():
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
on_exit=[load_joint_state_broadcaster],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
target_action=load_joint_state_broadcaster,
on_exit=[load_tricycle_controller],
)
),
Expand Down
8 changes: 2 additions & 6 deletions gazebo_ros2_control_demos/urdf/test_cart_effort.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?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">
<robot name="cart">
<link name="world"/>
<link name="slideBar">
<visual>
Expand Down Expand Up @@ -68,7 +64,7 @@

<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller_effort.yaml</parameters>
<parameters>$(find gazebo_ros2_control_demos)/config/cart_controller_effort.yaml</parameters>
</plugin>
</gazebo>
</robot>
8 changes: 2 additions & 6 deletions gazebo_ros2_control_demos/urdf/test_cart_position.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?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">
<robot name="cart">
<link name="world"/>
<link name="slideBar">
<visual>
Expand Down Expand Up @@ -67,7 +63,7 @@

<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
<parameters>$(find gazebo_ros2_control_demos)/config/cart_controller.yaml</parameters>
</plugin>
</gazebo>
</robot>
8 changes: 2 additions & 6 deletions gazebo_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?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">
<robot name="cart">
<link name="world"/>
<link name="slideBar">
<visual>
Expand Down Expand Up @@ -97,7 +93,7 @@

<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find gazebo_ros2_control_demos)/config/cartpole_controller_velocity.yaml</parameters>
<parameters>$(find gazebo_ros2_control_demos)/config/cart_controller_velocity.yaml</parameters>
</plugin>
</gazebo>
</robot>

0 comments on commit e5b5b7c

Please sign in to comment.