flexiv_ros2
flexiv_ros2 copied to clipboard
ROS 2 integration of RDK for Flexiv robots.
Flexiv ROS 2
For ROS 2 users to easily work with RDK, the APIs of RDK are wrapped into ROS packages in flexiv_ros2. Key functionalities like real-time joint torque and position control are supported, and the integration with ros2_control framework and MoveIt! 2 is also implemented.
References
Flexiv RDK main webpage contains important information like RDK user manual and network setup.
Compatibility
| Supported OS | Supported ROS 2 distribution |
|---|---|
| Ubuntu 20.04 | Foxy Fitzroy |
| Ubuntu 22.04 | Humble Hawksbill |
Release Status
| ROS 2 Distro | Foxy | Humble |
|---|---|---|
| Branch | foxy | humble |
| Release Status |
Getting Started
This project was developed for ROS 2 Foxy (Ubuntu 20.04) and Humble (Ubuntu 22.04). Other versions of Ubuntu and ROS 2 may work, but are not officially supported.
-
Install ROS 2 Humble via Debian Packages
-
Install
colconand additional ROS packages:sudo apt install -y \ python3-colcon-common-extensions \ python3-rosdep2 \ libeigen3-dev \ ros-humble-xacro \ ros-humble-tinyxml2-vendor \ ros-humble-ros2-control \ ros-humble-realtime-tools \ ros-humble-control-toolbox \ ros-humble-moveit \ ros-humble-ros2-controllers \ ros-humble-test-msgs \ ros-humble-joint-state-publisher \ ros-humble-joint-state-publisher-gui \ ros-humble-robot-state-publisher \ ros-humble-rviz2 -
Setup workspace:
mkdir -p ~/flexiv_ros2_ws/src cd ~/flexiv_ros2_ws/src git clone https://github.com/flexivrobotics/flexiv_ros2.git cd flexiv_ros2/ git submodule update --init --recursive -
Install dependencies:
cd ~/flexiv_ros2_ws rosdep update rosdep install --from-paths src --ignore-src --rosdistro humble -r -y -
Build and source the workspace:
cd ~/flexiv_ros2_ws source /opt/ros/humble/setup.bash colcon build --symlink-install source install/setup.bash
[!NOTE] Remember to source the setup file and the workspace whenever a new terminal is opened:
source /opt/ros/humble/setup.bash source ~/flexiv_ros2_ws/install/setup.bash
Usage
[!NOTE] The instruction below is only a quick reference, see the Flexiv ROS 2 Documentation for more information.
The prerequisites of using ROS 2 with Flexiv Rizon robot are enable RDK on the robot server and establish connection between the workstation PC and the robot.
The main launch file to start the robot driver is the rizon.launch.py - it loads and starts the robot hardware, joint states broadcaster, force torque sensor broadcaster, TCP wrench and TCP pose broadcasters, and robot controller and opens RViZ. The arguments for the launch file are as follows:
robot_ip(required) - IP address of the robot server (remote).local_ip(required) - IP address of the workstation PC (local).rizon_type(default: rizon4) - type of the Flexiv Rizon robot. (rizon4, rizon4s or rizon10)use_fake_hardware(default: false) - startsFakeSysteminstead of real hardware. This is a simple simulation that mimics joint command to their states.start_rviz(deafult: true) - starts RViz automatically with the launch file.fake_sensor_commands(default: false) - enables fake command interfaces for sensors used for simulations. Used only ifuse_fake_hardwareparameter is true.robot_controller(default: rizon_arm_controller) - robot controller to start. Available controllers: forward_position_controller, rizon_arm_controller, joint_impedance_controller.
(Details about other launch files can be found in flexiv_bringup)
Example Commands
-
Start robot, or fake hardware:
-
Test with real robot:
ros2 launch flexiv_bringup rizon.launch.py robot_ip:=[robot_ip] local_ip:=[local_ip] rizon_type:=rizon4 -
Test with fake hardware (
ros2_controlcapability):ros2 launch flexiv_bringup rizon.launch.py robot_ip:=dont-care local_ip:=dont-care use_fake_hardware:=true
-
[!TIP] To test whether the connection between ROS and the robot is established, you could disable the starting of RViz first by setting the
start_rvizlaunch argument to false.
-
Publish commands to controllers
-
To send the goal position to the controller by using the node from
flexiv_test_nodes, start the following command in a new terminal:ros2 launch flexiv_bringup test_joint_trajectory_controller.launch.pyThe joint position goals can be changed in
flexiv_bringup/config/joint_trajectory_position_publisher.yaml -
To test another controller, define it using the
robot_controllerlaunch argument, for example thejoint_impedance_controller:ros2 launch flexiv_bringup rizon.launch.py robot_ip:=[robot_ip] local_ip:=[local_ip] robot_controller:=joint_impedance_controllerOpen a new terminal and run the launch file:
ros2 launch flexiv_bringup sine_sweep_impedance.launch.pyThe robot should run a sine-sweep motion with joint impedance control.
-
[!NOTE] The command starts the robot in the joint torque mode. In this mode, gravity and friction are compensated only for the robot without any attached objects (e.g. the gripper, camera).
[!NOTE] Joint impedance control is not supported in fake/simulated hardware.
Using MoveIt
You can also run the MoveIt example and use the MotionPlanning plugin in RViZ to start planning:
ros2 launch flexiv_bringup rizon_moveit.launch.py robot_ip:=[robot_ip] local_ip:=[local_ip]
Test with fake hardware:
ros2 launch flexiv_bringup rizon_moveit.launch.py robot_ip:=dont-care local_ip:=dont-care use_fake_hardware:=true
Robot States
The robot driver (rizon.launch.py) publishes the following feedback states to the respective ROS topics:
/joint_states: Measured joint states of the robot: joint position, velocity and torque. [sensor_msgs/JointState.msg]/external_wrench_in_tcp_broadcaster/external_wrench_in_tcp: Estimated external wrench applied on TCP and expressed in TCP frame $^{TCP}F_{ext}$ in force $[N]$ and moment $[Nm]$. [geometry_msgs/WrenchStamped.msg]/external_wrench_in_base_broadcaster/external_wrench_in_base: Estimated external wrench applied on TCP and expressed in base frame $^{0}F_{ext}$ in force $[N]$ and moment $[Nm]$. [geometry_msgs/WrenchStamped.msg]/force_torque_sensor_broadcaster/wrench: Force-torque (FT) sensor raw reading in flange frame: $^{flange}F_{raw}$ in force $[N]$ and moment $[Nm]$. The value is 0 if no FT sensor is installed. [geometry_msgs/WrenchStamped.msg]/tcp_pose_broadcaster/tcp_pose: Measured TCP pose expressed in base frame $^{0}T_{TCP}$ in position $[m]$ and quaternion. [geometry_msgs/PoseStamped.msg]
[!NOTE] The topic names of the broadcasters are specified in
flexiv_bringup/config/rizon_controllers.yaml
GPIO
All digital inputs on the robot control box can be accessed via the ROS topic /gpio_controller/gpio_inputs, which publishes the current state of all the 16 digital input ports (True: port high, false: port low).
The digital output ports on the control box can be set by publishing to the topic /gpio_controller/gpio_outputs. For example:
ros2 topic pub /gpio_controller/gpio_outputs flexiv_msgs/msg/GPIOStates "{states: [{pin: 0, state: true}, {pin: 2, state: true}]}"