Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
18 changes: 0 additions & 18 deletions example_16/bringup/launch/demo_test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,8 @@
class DiffbotChainedControllersTest(Node):
def __init__(self):
super().__init__("diffbot_chained_controllers_demo_helper_node")
# Enable feedforward control via service call
self.client_left_ = self.create_client(
SetBool, "/pid_controller_left_wheel_joint/set_feedforward_control"
)
self.client_right_ = self.create_client(
SetBool, "/pid_controller_right_wheel_joint/set_feedforward_control"
)
self.publisher_ = self.create_publisher(TwistStamped, "/cmd_vel", 10)

def set_feedforward_control(self):
while not self.client_left_.wait_for_service(timeout_sec=1.0):
self.get_logger().info(
"Waiting for left feedforward control service to be available..."
)
while not self.client_right_.wait_for_service(timeout_sec=1.0):
self.get_logger().info(
"Waiting for right feedforward control service to be available..."
)

request_left = SetBool.Request()
request_left.data = True
future_left = self.client_left_.call_async(request_left)
Expand Down Expand Up @@ -73,7 +56,6 @@ def publish_cmd_vel(self, delay=0.1):
if __name__ == "__main__":
rclpy.init()
test_node = DiffbotChainedControllersTest()
test_node.set_feedforward_control()
test_node.publish_cmd_vel(delay=0.1)
rclpy.spin(test_node)
test_node.destroy_node()
Expand Down
20 changes: 4 additions & 16 deletions example_16/doc/userdoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,15 @@ Tutorial steps

There are also two ``[unclaimed]`` interfaces from diff_drive_controller, one for angular velocity and one for linear velocity. These are provided by the diff_drive_controller because it is chainable. You can ignore them since we don't use them in this example.

4. We specified ``feedforward_gain`` as part of ``gains`` in diffbot_chained_controllers.yaml. To actually enable feedforward mode for the pid_controller, we need to use a service provided by pid_controller. Let's enable it.

.. code-block:: shell

ros2 service call /pid_controller_left_wheel_joint/set_feedforward_control std_srvs/srv/SetBool "data: true" && \
ros2 service call /pid_controller_right_wheel_joint/set_feedforward_control std_srvs/srv/SetBool "data: true"

You should get

.. code-block:: shell

response:
std_srvs.srv.SetBool_Response(success=True, message='')

5. To see the pid_controller in action, let's subscribe to the controler_state topic, e.g. pid_controller_left_wheel_joint/controller_state topic.
4. To see the pid_controller in action, let's subscribe to the controler_state topic, e.g. pid_controller_left_wheel_joint/controller_state topic.

.. code-block:: shell

ros2 topic echo /pid_controller_left_wheel_joint/controller_state

6. Now we are ready to send a command to move the robot. Send a command to *Diff Drive Controller* by opening another terminal and executing
5. Now we are ready to send a command to move the robot. Send a command to *Diff Drive Controller* by opening another terminal and executing

.. code-block:: shell

Expand All @@ -115,7 +103,7 @@ Tutorial steps

You should now see robot is moving in circles in *RViz*.

7. In the terminal where launch file is started, you should see the commands being sent to the wheels and how they are gradually stabilizing to the target velocity similar to following output.
6. In the terminal where launch file is started, you should see the commands being sent to the wheels and how they are gradually stabilizing to the target velocity similar to following output.

.. code-block:: shell

Expand All @@ -133,7 +121,7 @@ Tutorial steps
[ros2_control_node-1] command 52.27 for 'left_wheel_joint/velocity'!


8. Let's go back to the terminal where we subscribed to the controller_state topic and see the changing states.
7. Let's go back to the terminal where we subscribed to the controller_state topic and see the changing states.

.. code-block:: shell

Expand Down
Loading