franka_example_controllers ========================== This package contains a few controllers that can be seen as example of how to write controllers in ROS 2. Currently, a controller only has access to measured joint positions and joint velocities. Based on this information the controller can send torque commands. It is currently not possible to use other interfaces like the joint position interface. Example Controllers ------------------- This repo comes with a few example controllers located in the ``franka_example_controllers`` package. The following launch files are executed with the gripper by default. If you do not have the gripper attached you can disable the gripper in the launch file with ``load_gripper:=false``. Move-to-start ^^^^^^^^^^^^^ This controller moves the robot to its home configuration. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=move_to_start_example_controller .. _gravity_example: Gravity Compensation ^^^^^^^^^^^^^^^^^^^^ This is the simplest controller that we have and is a good starting point to write your own. It sends zero as torque command to all joints, which means that the robot only compensates its own weight. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=gravity_compensation_example_controller Gripper Example ^^^^^^^^^^^^^^^ Demonstrates the Franka *Action Interface* for controlling the Franka Hand (aka: Gripper). The controller submits *Goals* to repeatedly close, then reopen, the gripper given a hard-coded target grasp size with epsilon. It evaluates whether the grasp is successful or failed based on the object's size and the defined tolerances. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=gripper_example_controller Joint Impedance Example ^^^^^^^^^^^^^^^^^^^^^^^ The example moves joints 4 and 5 in a periodic movement that is very compliant. You can try to move the joints while it is running. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=joint_impedance_example_controller Joint Impedance With IK Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The example uses the LMA-Orocos solver from MoveIt service to compute the joint positions for the desired pose. The desired pose is to move the end-effector periodically in x and z directions. You can change the kinematic solver in the franka_fr3_moveit_config package, kinematics.yaml file. .. code-block:: shell ros2 launch franka_bringup joint_impedance_with_ik_example_controller.launch.py Model Example Controller ^^^^^^^^^^^^^^^^^^^^^^^^ This is a read-only controller which prints the coriolis force vector, gravity force vector, pose matrix of Joint4, Joint4 body jacobian and end-effector jacobian with respect to the base frame. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=model_example_controller Joint Position Example ^^^^^^^^^^^^^^^^^^^^^^ This example sends periodic position commands to the robot. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=joint_position_example_controller Joint Velocity Example ^^^^^^^^^^^^^^^^^^^^^^ This example sends periodic velocity commands to the 4th and 5th joint of the robot. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=joint_velocity_example_controller Cartesian Pose Example ^^^^^^^^^^^^^^^^^^^^^^ This example uses the CartesianPose interface to send periodic pose commands to the robot. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=cartesian_pose_example_controller Cartesian Orientation Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example uses CartesianOrientation interface to send periodic orientation commands around X axis of the end effector of the robot. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=cartesian_orientation_example_controller Cartesian Pose Elbow Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example sends periodic elbow commands while keeping the end effector pose constant. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=cartesian_elbow_example_controller Cartesian Velocity Example ^^^^^^^^^^^^^^^^^^^^^^^^^^ This example uses the CartesianVelocity interface to send periodic velocity commands to the robot. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=cartesian_velocity_example_controller Cartesian Elbow Example ^^^^^^^^^^^^^^^^^^^^^^^ This example uses the CartesianElbow interface to send periodic elbow commands to the robot while keeping the end effector velocity constant. .. code-block:: shell ros2 launch franka_bringup example.launch.py controller_name:=elbow_example_controller Writing Custom Controllers --------------------------- Compared to ``franka_ros`` we currently offer a reduced set of controller interfaces: * Joint positions * Joint velocities * Measured torques * Franka robot state * Franka robot model .. important:: Franka robot state is published through :doc:`franka_robot_state_broadcaster <../../franka_robot_state_broadcaster/doc/index>` package to the topic named `/franka_robot_state_broadcaster/robot_state` .. important:: Both Franka robot state and Franka robot model are advised to use through :doc:`franka_semantic_components <../../franka_semantic_components/doc/index>` class. They are stored in the state_interface as double pointers and casted back to their original objects inside the franka_semantic_component class. Example of using franka_model can be found in the franka_example_controllers package: `model_example_controller `_. You can base your own controller on one of the example controllers in this package. To compute kinematic and dynamic quantities of the robot you can use the joint states and the URDF of the robot in libraries like `KDL `_ (of which there is also a ROS 2 package available).