diff --git a/doc/index.rst b/doc/index.rst index d47d016e..00a7ebb3 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -146,7 +146,7 @@ robot hardware interfaces between *ros2_control* and Gazebo. robot_description robot_state_publisher - $(find gz_ros2_control_demos)/config/cartpole_controller.yaml + $(find gz_ros2_control_demos)/config/cart_controller.yaml @@ -200,32 +200,18 @@ and use the tag ```` to set the controller - $(find gz_ros2_control_demos)/config/cartpole_controller.yaml + $(find gz_ros2_control_demos)/config/cart_controller.yaml controller_manager -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 diff --git a/gz_ros2_control_tests/tests/position_test.py b/gz_ros2_control_tests/tests/position_test.py index f20f7f70..a39db16a 100755 --- a/gz_ros2_control_tests/tests/position_test.py +++ b/gz_ros2_control_tests/tests/position_test.py @@ -77,7 +77,7 @@ def generate_test_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'cart', '-allow_renaming', 'true'], ) diff --git a/gz_ros2_control_tests/urdf/test_cart_position.xacro.urdf b/gz_ros2_control_tests/urdf/test_cart_position.xacro.urdf index b1bd6e3b..0c22bf4d 100644 --- a/gz_ros2_control_tests/urdf/test_cart_position.xacro.urdf +++ b/gz_ros2_control_tests/urdf/test_cart_position.xacro.urdf @@ -1,8 +1,4 @@ - - - - @@ -95,7 +91,7 @@ - $(find gz_ros2_control_tests)/config/cartpole_controller_position.yaml + $(find gz_ros2_control_tests)/config/cart_controller_position.yaml diff --git a/ign_ros2_control_demos/config/cart_controller_effort.yaml b/ign_ros2_control_demos/config/cart_controller_effort.yaml new file mode 100644 index 00000000..920e4651 --- /dev/null +++ b/ign_ros2_control_demos/config/cart_controller_effort.yaml @@ -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 diff --git a/ign_ros2_control_demos/config/cart_controller_position.yaml b/ign_ros2_control_demos/config/cart_controller_position.yaml new file mode 100644 index 00000000..f51d2fa5 --- /dev/null +++ b/ign_ros2_control_demos/config/cart_controller_position.yaml @@ -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 diff --git a/ign_ros2_control_demos/config/cart_controller_velocity.yaml b/ign_ros2_control_demos/config/cart_controller_velocity.yaml new file mode 100644 index 00000000..7215d760 --- /dev/null +++ b/ign_ros2_control_demos/config/cart_controller_velocity.yaml @@ -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 diff --git a/ign_ros2_control_demos/launch/cart_example_effort.launch.py b/ign_ros2_control_demos/launch/cart_example_effort.launch.py index 3953494e..4bd27da5 100644 --- a/ign_ros2_control_demos/launch/cart_example_effort.launch.py +++ b/ign_ros2_control_demos/launch/cart_example_effort.launch.py @@ -56,7 +56,7 @@ def generate_launch_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'cart', '-allow_renaming', 'true'], ) diff --git a/ign_ros2_control_demos/launch/cart_example_position.launch.py b/ign_ros2_control_demos/launch/cart_example_position.launch.py index c1a8beb4..ffbeae6a 100644 --- a/ign_ros2_control_demos/launch/cart_example_position.launch.py +++ b/ign_ros2_control_demos/launch/cart_example_position.launch.py @@ -56,7 +56,7 @@ def generate_launch_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'cart', '-allow_renaming', 'true'], ) diff --git a/ign_ros2_control_demos/launch/cart_example_velocity.launch.py b/ign_ros2_control_demos/launch/cart_example_velocity.launch.py index 1a72809c..d69b4130 100644 --- a/ign_ros2_control_demos/launch/cart_example_velocity.launch.py +++ b/ign_ros2_control_demos/launch/cart_example_velocity.launch.py @@ -56,7 +56,7 @@ def generate_launch_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'cart', '-allow_renaming', 'true'], ) diff --git a/ign_ros2_control_demos/launch/diff_drive_example.launch.py b/ign_ros2_control_demos/launch/diff_drive_example.launch.py index 70ba1f2d..d0147161 100644 --- a/ign_ros2_control_demos/launch/diff_drive_example.launch.py +++ b/ign_ros2_control_demos/launch/diff_drive_example.launch.py @@ -57,7 +57,7 @@ def generate_launch_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'diff_drive', '-allow_renaming', 'true'], ) diff --git a/ign_ros2_control_demos/launch/tricycle_drive_example.launch.py b/ign_ros2_control_demos/launch/tricycle_drive_example.launch.py index ffe431c3..42c47c88 100644 --- a/ign_ros2_control_demos/launch/tricycle_drive_example.launch.py +++ b/ign_ros2_control_demos/launch/tricycle_drive_example.launch.py @@ -57,7 +57,7 @@ def generate_launch_description(): executable='create', output='screen', arguments=['-string', doc.toxml(), - '-name', 'cartpole', + '-name', 'tricyle', '-allow_renaming', 'true'], ) diff --git a/ign_ros2_control_demos/urdf/test_cart_effort.xacro.urdf b/ign_ros2_control_demos/urdf/test_cart_effort.xacro.urdf index 6fa0af31..5c0b3e96 100644 --- a/ign_ros2_control_demos/urdf/test_cart_effort.xacro.urdf +++ b/ign_ros2_control_demos/urdf/test_cart_effort.xacro.urdf @@ -1,8 +1,4 @@ - - - - @@ -83,7 +79,7 @@ - $(find ign_ros2_control_demos)/config/cartpole_controller_effort.yaml + $(find ign_ros2_control_demos)/config/cart_controller_effort.yaml diff --git a/ign_ros2_control_demos/urdf/test_cart_position.xacro.urdf b/ign_ros2_control_demos/urdf/test_cart_position.xacro.urdf index eeff47ec..7dc19a5c 100644 --- a/ign_ros2_control_demos/urdf/test_cart_position.xacro.urdf +++ b/ign_ros2_control_demos/urdf/test_cart_position.xacro.urdf @@ -1,8 +1,4 @@ - - - - @@ -83,7 +79,7 @@ - $(find ign_ros2_control_demos)/config/cartpole_controller_position.yaml + $(find ign_ros2_control_demos)/config/cart_controller_position.yaml diff --git a/ign_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf b/ign_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf index 59a960a1..8b91c252 100644 --- a/ign_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf +++ b/ign_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf @@ -1,8 +1,4 @@ - - - - @@ -161,7 +157,7 @@ - $(find ign_ros2_control_demos)/config/cartpole_controller_velocity.yaml + $(find ign_ros2_control_demos)/config/cart_controller_velocity.yaml