Skip to content

Commit 9d96a86

Browse files
Release/Flexiv ROS 2 Humble 0.9.1 (#27)
1 parent e509b61 commit 9d96a86

28 files changed

+598
-112
lines changed

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# To run checks over all the files in the repo manually:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or run checks automatically every time before commit:
6+
#
7+
# pre-commit install
8+
#
9+
# See https://pre-commit.com for more information
10+
# See https://pre-commit.com/hooks.html for more hooks
11+
repos:
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.4.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: check-yaml
18+
args: [--allow-multiple-documents]
19+
- id: check-added-large-files
20+
args: [--maxkb=500]
21+
- id: pretty-format-json
22+
args: [--no-sort-keys, --autofix, --indent=4]
23+
24+
- repo: https://github.com/myint/docformatter
25+
rev: v1.7.5
26+
hooks:
27+
- id: docformatter
28+
args: [--in-place]
29+
30+
- repo: https://github.com/psf/black
31+
rev: 23.9.1
32+
hooks:
33+
- id: black
34+
language_version: python3
35+
args: [--line-length=88]
36+
37+
- repo: local
38+
hooks:
39+
- id: clang-format
40+
name: clang-format
41+
description: Format files with ClangFormat.
42+
entry: clang-format -i
43+
language: system
44+
files: \.(c|cc|cxx|cpp|cu|h|hh|hpp|hxx|java|js|m|proto)$
45+
args: ["-fallback-style=none"]

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ This project was developed for ROS 2 Foxy (Ubuntu 20.04) and Humble (Ubuntu 22.0
7676
source install/setup.bash
7777
```
7878

79-
**NOTE**: Remember to source the setup file and the workspace whenever a new terminal is opened:
80-
81-
```bash
82-
source /opt/ros/humble/setup.bash
83-
source ~/flexiv_ros2_ws/install/setup.bash
84-
```
79+
> [!NOTE]
80+
> Remember to source the setup file and the workspace whenever a new terminal is opened:
81+
> ```bash
82+
> source /opt/ros/humble/setup.bash
83+
> source ~/flexiv_ros2_ws/install/setup.bash
84+
> ```
8585
8686
## Usage
8787
88-
**NOTE**: the instruction below is only a quick reference, see the [Flexiv ROS 2 Documentation](https://rdk.flexiv.com/manual/ros2_packages.html) for more information.
88+
> [!NOTE]
89+
> The instruction below is only a quick reference, see the [Flexiv ROS 2 Documentation](https://rdk.flexiv.com/manual/ros2_packages.html) for more information.
8990
9091
The prerequisites of using ROS 2 with Flexiv Rizon robot are [enable RDK on the robot server](https://rdk.flexiv.com/manual/getting_started.html#activate-rdk-server) and [establish connection](https://rdk.flexiv.com/manual/getting_started.html#establish-connection) between the workstation PC and the robot.
9192
@@ -111,13 +112,15 @@ The main launch file to start the robot driver is the `rizon.launch.py` - it loa
111112
ros2 launch flexiv_bringup rizon.launch.py robot_ip:=[robot_ip] local_ip:=[local_ip] rizon_type:=rizon4
112113
```
113114
114-
**NOTE**: To test whether the connection between ROS and the robot is established, you could disable the starting of RViz first by setting the `start_rviz` launch argument to false.
115115
- Test with fake hardware (`ros2_control` capability):
116116
117117
```bash
118118
ros2 launch flexiv_bringup rizon.launch.py robot_ip:=dont-care local_ip:=dont-care use_fake_hardware:=true
119119
```
120120
121+
> [!TIP]
122+
> To test whether the connection between ROS and the robot is established, you could disable the starting of RViz first by setting the `start_rviz` launch argument to false.
123+
121124
2. Publish commands to controllers
122125
123126
- To send the goal position to the controller by using the node from `flexiv_test_nodes`, start the following command in a new terminal:
@@ -133,8 +136,6 @@ The main launch file to start the robot driver is the `rizon.launch.py` - it loa
133136
ros2 launch flexiv_bringup rizon.launch.py robot_ip:=[robot_ip] local_ip:=[local_ip] robot_controller:=joint_impedance_controller
134137
```
135138
136-
**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).
137-
138139
Open a new terminal and run the launch file:
139140
140141
```bash
@@ -143,7 +144,11 @@ The main launch file to start the robot driver is the `rizon.launch.py` - it loa
143144
144145
The robot should run a sine-sweep motion with joint impedance control.
145146
146-
**NOTE**: joint impedance control is not supported in fake/simulated hardware.
147+
> [!NOTE]
148+
> 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).
149+
150+
> [!NOTE]
151+
> Joint impedance control is not supported in fake/simulated hardware.
147152
148153
### Using MoveIt
149154
@@ -169,4 +174,15 @@ The robot driver (`rizon.launch.py`) publishes the following feedback states to
169174
- `/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`](https://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/WrenchStamped.html)]
170175
- `/tcp_pose_broadcaster/tcp_pose`: Measured TCP pose expressed in base frame $^{0}T_{TCP}$ in position $[m]$ and quaternion. [[`geometry_msgs/PoseStamped.msg`](https://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/PoseStamped.html)]
171176
172-
**NOTE**: The topic names of the broadcasters are specified in `flexiv_bringup/config/rizon_controllers.yaml`
177+
> [!NOTE]
178+
> The topic names of the broadcasters are specified in `flexiv_bringup/config/rizon_controllers.yaml`
179+
180+
### GPIO
181+
182+
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)*.
183+
184+
The digital output ports on the control box can be set by publishing to the topic `/gpio_controller/gpio_outputs`. For example:
185+
186+
```bash
187+
ros2 topic pub /gpio_controller/gpio_outputs flexiv_msgs/msg/GPIOStates "{states: [{pin: 0, state: true}, {pin: 2, state: true}]}"
188+
```

flexiv_bringup/config/rizon_controllers.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@ controller_manager:
55
forward_position_controller:
66
type: position_controllers/JointGroupPositionController
77

8-
joint_impedance_controller:
9-
type: flexiv_controllers/JointImpedanceController
8+
rizon_arm_controller:
9+
type: joint_trajectory_controller/JointTrajectoryController
1010

1111
joint_state_broadcaster:
1212
type: joint_state_broadcaster/JointStateBroadcaster
1313

1414
force_torque_sensor_broadcaster:
1515
type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
1616

17+
joint_impedance_controller:
18+
type: flexiv_controllers/JointImpedanceController
19+
20+
gpio_controller:
21+
type: flexiv_controllers/GPIOController
22+
1723
external_wrench_in_base_broadcaster:
1824
type: flexiv_controllers/ExternalTcpWrenchBroadcaster
1925

2026
external_wrench_in_tcp_broadcaster:
2127
type: flexiv_controllers/ExternalTcpWrenchBroadcaster
22-
28+
2329
tcp_pose_state_broadcaster:
2430
type: flexiv_controllers/TcpPoseStateBroadcaster
2531

26-
rizon_arm_controller:
27-
type: joint_trajectory_controller/JointTrajectoryController
28-
2932
force_torque_sensor_broadcaster:
3033
ros__parameters:
3134
sensor_name: force_torque_sensor
@@ -40,7 +43,7 @@ external_wrench_in_tcp_broadcaster:
4043
external_wrench_in_base_broadcaster:
4144
ros__parameters:
4245
sensor_name: external_wrench_in_base
43-
frame_id: base_link
46+
frame_id: flange
4447
topic_name: external_wrench_in_base
4548

4649
tcp_pose_state_broadcaster:
@@ -91,7 +94,6 @@ rizon_arm_controller:
9194
state_publish_rate: 100.0
9295
action_monitor_rate: 20.0
9396
allow_partial_joints_goal: false
94-
allow_integration_in_goal_trajectories: true
9597
constraints:
9698
stopped_velocity_tolerance: 0.01
9799
goal_time: 0.0

flexiv_bringup/launch/rizon.launch.py

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
from launch.actions import DeclareLaunchArgument, RegisterEventHandler
33
from launch.conditions import IfCondition
44
from launch.event_handlers import OnProcessExit
5-
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
5+
from launch.substitutions import (
6+
Command,
7+
FindExecutable,
8+
LaunchConfiguration,
9+
PathJoinSubstitution,
10+
)
611
from launch_ros.actions import Node
712
from launch_ros.substitutions import FindPackageShare
813

@@ -118,7 +123,7 @@ def generate_launch_description():
118123
)
119124
robot_description = {"robot_description": robot_description_content}
120125

121-
# RViZ
126+
# RViZ
122127
rviz_config_file = PathJoinSubstitution(
123128
[FindPackageShare("flexiv_description"), "rviz", "view_rizon.rviz"]
124129
)
@@ -165,50 +170,79 @@ def generate_launch_description():
165170
joint_state_broadcaster_spawner = Node(
166171
package="controller_manager",
167172
executable="spawner",
168-
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
173+
arguments=[
174+
"joint_state_broadcaster",
175+
"--controller-manager",
176+
"/controller_manager",
177+
],
169178
)
170-
179+
171180
# Run force torque sensor broadcaster
172181
force_torque_sensor_broadcaster_spawner = Node(
173182
package="controller_manager",
174183
executable="spawner",
175-
arguments=["force_torque_sensor_broadcaster", "--controller-manager", "/controller_manager"],
184+
arguments=[
185+
"force_torque_sensor_broadcaster",
186+
"--controller-manager",
187+
"/controller_manager",
188+
],
176189
)
177-
190+
178191
# Run external wrench in base broadcaster
179192
external_wrench_in_base_broadcaster_spawner = Node(
180193
package="controller_manager",
181194
executable="spawner",
182-
arguments=["external_wrench_in_base_broadcaster", "--controller-manager", "/controller_manager"],
195+
arguments=[
196+
"external_wrench_in_base_broadcaster",
197+
"--controller-manager",
198+
"/controller_manager",
199+
],
183200
)
184-
201+
185202
# Run external wrench in tcp broadcaster
186203
external_wrench_in_tcp_broadcaster_spawner = Node(
187204
package="controller_manager",
188205
executable="spawner",
189-
arguments=["external_wrench_in_tcp_broadcaster", "--controller-manager", "/controller_manager"],
206+
arguments=[
207+
"external_wrench_in_tcp_broadcaster",
208+
"--controller-manager",
209+
"/controller_manager",
210+
],
190211
)
191-
212+
192213
# Run tcp pose state broadcaster
193214
tcp_pose_state_broadcaster_spawner = Node(
194215
package="controller_manager",
195216
executable="spawner",
196-
arguments=["tcp_pose_state_broadcaster", "--controller-manager", "/controller_manager"],
217+
arguments=[
218+
"tcp_pose_state_broadcaster",
219+
"--controller-manager",
220+
"/controller_manager",
221+
],
222+
)
223+
224+
# Run gpio controller
225+
gpio_controller_spawner = Node(
226+
package="controller_manager",
227+
executable="spawner",
228+
arguments=["gpio_controller", "--controller-manager", "/controller_manager"],
197229
)
198-
230+
199231
# Delay rviz start after `joint_state_broadcaster`
200232
delay_rviz_after_joint_state_broadcaster_spawner = RegisterEventHandler(
201233
event_handler=OnProcessExit(
202234
target_action=joint_state_broadcaster_spawner,
203235
on_exit=[rviz_node],
204236
)
205237
)
206-
238+
207239
# Delay start of robot_controller after `joint_state_broadcaster`
208-
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = RegisterEventHandler(
209-
event_handler=OnProcessExit(
210-
target_action=joint_state_broadcaster_spawner,
211-
on_exit=[robot_controller_spawner],
240+
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = (
241+
RegisterEventHandler(
242+
event_handler=OnProcessExit(
243+
target_action=joint_state_broadcaster_spawner,
244+
on_exit=[robot_controller_spawner],
245+
)
212246
)
213247
)
214248

@@ -220,6 +254,7 @@ def generate_launch_description():
220254
external_wrench_in_base_broadcaster_spawner,
221255
external_wrench_in_tcp_broadcaster_spawner,
222256
tcp_pose_state_broadcaster_spawner,
257+
gpio_controller_spawner,
223258
delay_rviz_after_joint_state_broadcaster_spawner,
224259
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner,
225260
]

0 commit comments

Comments
 (0)