sudo apt install ros-foxy-control-msgs \
ros-foxy-xacro \
ros-foxy-angles \
ros-foxy-ros2-control \
ros-foxy-realtime-tools \
ros-foxy-control-toolbox \
ros-foxy-moveit \
ros-foxy-ros2-controllers \
ros-foxy-joint-state-publisher \
ros-foxy-joint-state-publisher-gui \
ros-foxy-ament-cmake-clang-format \
python3-colcon-common-extensions
mkdir -p ~/franka_ros2_ws/src
source /opt/ros/foxy/setup.bash
cd ~/franka_ros2_ws
git clone https://github.com/frankaemika/franka_ros2.git src/franka_ros2
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
source install/setup.sh
This repo comes with a few example controllers located in the franka_example_controllers package. To run those examples you first have to set the Panda in the correct mode:
This example moves the robot to the home position.
ros2 launch franka_bringup move_to_start_example_controller.launch.py robot_ip:=172.16.0.2
This example sets the robot in gravity compensation mode. It sends zero as torque command to all joints, which means that the robot only compensates the robots original weight.
Warning: The lab's robot may have a camera attached to it and in some positions this controller doesn't compensate it's weight. Be careful and provide the correction needed so that the robot doesn't fall.
ros2 launch franka_bringup gravity_compensation_example_controller.launch.py robot_ip:=172.16.0.2
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.
ros2 launch franka_bringup joint_impedance_example_controller.launch.py robot_ip:=172.16.0.2
Use the following launch file to start the gripper:
ros2 launch franka_gripper gripper.launch.py robot_ip:=172.16.0.2
In a different tab you can now perform the homing and send a grasp command.
ros2 action send_goal /panda_gripper/homing franka_msgs/action/Homing {}
ros2 action send_goal -f /panda_gripper/grasp franka_msgs/action/Grasp "{width: 0.0254, speed: 0.03, force: 100}"
To stop the grasping, you can use stop service.
ros2 service call /panda_gripper/stop std_srvs/srv/Trigger {}
ros2 action send_goal -f /panda_gripper/move franka_msgs/action/Move "{width: 0.07, speed: 0.03}"