Skip to content

Commit 1983450

Browse files
pgoldjacobperron
authored andcommitted
Port to ROS 2 (foxy) (#8)
* CMake required version bumped to 3.5. * Fix README prerequisites. * Remove unneeded CMAKE_CXX_STANDARD. * Remove CreateDriver's priv_nh_ member.
1 parent 910a742 commit 1983450

26 files changed

+385
-393
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,20 @@ _* Not verified. Anyone who is able to verify that this driver works or not is e
6363
#### Prerequisites
6464

6565
* Internet connection
66-
* [ROS](http://wiki.ros.org/ROS/Installation) _Indigo_ or _Jade_
67-
* Ubuntu packages: `python-rosdep`, `python-catkin-tools`
66+
* [ROS](https://index.ros.org/doc/ros2/Installation) _Foxy_
67+
* Ubuntu packages: `python3-rosdep`, `python3-colcon-common-extensions`
6868

6969
``` bash
70-
$ sudo apt-get install python-rosdep python-catkin-tools
70+
$ sudo apt install python3-rosdep python3-colcon-common-extensions
7171
```
7272

7373
#### Compiling
7474

75-
1. Create a catkin workspace
75+
1. Create a colcon workspace
7676
``` bash
7777
$ cd ~
7878
$ mkdir -p create_ws/src
79-
$ cd create_ws
80-
$ catkin init
79+
$ cd create_ws
8180
```
8281

8382
2. Clone this repo
@@ -96,7 +95,7 @@ $ sudo apt-get install python-rosdep python-catkin-tools
9695
4. Build
9796
``` bash
9897
$ cd ~/create_ws
99-
$ catkin build
98+
$ colcon build
10099
```
101100
#### USB Permissions
102101
5. In order to connect to Create over USB, ensure your user is in the dialout group
@@ -112,7 +111,7 @@ $ sudo apt-get install python-rosdep python-catkin-tools
112111

113112
1. After compiling from source, don't forget to source your workspace:
114113
``` bash
115-
$ source ~/create_ws/devel/setup.bash
114+
$ source ~/create_ws/install/setup.bash
116115
```
117116
118117
2. Connect computer to Create's 7-pin serial port
@@ -124,17 +123,17 @@ $ sudo apt-get install python-rosdep python-catkin-tools
124123
125124
For Create 2 (Roomba 600/700 series):
126125
``` bash
127-
$ roslaunch create_bringup create_2.launch
126+
$ ros2 launch create_bringup create_2.launch
128127
```
129128
130129
For Create 1 (Roomba 500 series):
131130
``` bash
132-
$ roslaunch create_bringup create_1.launch
131+
$ ros2 launch create_bringup create_1.launch
133132
```
134133
135134
For Roomba 400 series:
136135
``` bash
137-
$ roslaunch create_bringup roomba_400.launch
136+
$ ros2 launch create_bringup roomba_400.launch
138137
```
139138
140139
#### Launch file arguments
@@ -145,7 +144,7 @@ $ roslaunch create_bringup roomba_400.launch
145144
For example, if you would like to disable the robot description and provide a custom configuration file:
146145
147146
```bash
148-
$ roslaunch create_bringup create_2.launch config:=/abs/path/to/config.yaml desc:=false
147+
$ ros2 launch create_bringup create_2.launch config:=/abs/path/to/config.yaml desc:=false
149148
```
150149
151150
### Parameters
@@ -222,7 +221,7 @@ angular.z (+) Rotate counter-clockwise (rad/s)
222221
`create_bringup` comes with a launch file for teleoperating Create with a joystick.
223222
224223
``` bash
225-
$ roslaunch create_bringup joy_teleop.launch [joy_config:=xbox360]
224+
$ ros2 launch create_bringup joy_teleop.launch [joy_config:=xbox360]
226225
```
227226
228227
There exists configuration files for the [Xbox 360 wired controller](https://www.amazon.ca/Microsoft-Xbox-360-Wired-Controller/dp/B003ZSN600) and the [Logitech F710 controller](http://gaming.logitech.com/en-ca/product/f710-wireless-gamepad). You can adapt these files for your preferred joystick configuration.

create_bringup/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
cmake_minimum_required(VERSION 2.8.3)
1+
cmake_minimum_required(VERSION 3.5)
22
project(create_bringup)
33

4-
find_package(catkin REQUIRED)
5-
6-
catkin_package()
4+
find_package(ament_cmake REQUIRED)
75

86
install(DIRECTORY config launch
9-
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
7+
DESTINATION share/${PROJECT_NAME}
108
PATTERN ".svn" EXCLUDE
119
)
10+
11+
ament_package()

create_bringup/config/default.yaml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
# The device path for the robot
2-
dev: "/dev/ttyUSB0"
1+
create_node:
2+
ros__parameters:
3+
# The device path for the robot
4+
dev: "/dev/ttyUSB0"
35

4-
# Baud rate. Passing this parameter overwrites the inferred value based on the robot_model
5-
# baud: 115200
6+
# Baud rate. Passing this parameter overwrites the inferred value based on the robot_model
7+
# baud: 115200
68

7-
# Base frame ID
8-
base_frame: "base_footprint"
9+
# Base frame ID
10+
base_frame: "base_footprint"
911

10-
# Odometry frame ID
11-
odom_frame: "odom"
12+
# Odometry frame ID
13+
odom_frame: "odom"
1214

13-
# Time (s) without receiving a velocity command before stopping the robot
14-
latch_cmd_duration: 0.2
15+
# Time (s) without receiving a velocity command before stopping the robot
16+
latch_cmd_duration: 0.2
1517

16-
# Internal loop update rate (Hz)
17-
loop_hz: 10.0
18+
# Internal loop update rate (Hz)
19+
loop_hz: 10.0
1820

19-
# Whether to publish the transform between odom_frame and base_frame
20-
publish_tf: true
21+
# Whether to publish the transform between odom_frame and base_frame
22+
publish_tf: true

create_bringup/config/log710.yaml

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
# Logitech F710 wireless controller
22
# Deadman (enable) button: Right Trigger
33
# D<>X button (located on the back panel) must be set to D
4-
teleop:
5-
piloting:
6-
type: topic
7-
message_type: "geometry_msgs/Twist"
8-
topic_name: cmd_vel
9-
deadman_buttons: [7]
10-
axis_mappings:
11-
-
12-
axis: 3 # Right thumb stick (up/down)
13-
target: linear.x
14-
scale: 0.4
15-
offset: 0.0
16-
-
17-
axis: 2 # Right thumb stick (left/right)
18-
target: angular.z
19-
scale: 2.5
20-
offset: 0.0
21-
dock:
22-
type: topic
23-
message_type: "std_msgs/Empty"
24-
topic_name: dock
25-
deadman_buttons: [3, 7] # RT + Y
26-
axis_mappings: []
27-
undock:
28-
type: topic
29-
message_type: "std_msgs/Empty"
30-
topic_name: undock
31-
deadman_buttons: [1, 7] # RT + A
32-
axis_mappings: []
4+
joy_teleop:
5+
ros__parameters:
6+
piloting:
7+
type: topic
8+
message_type: "geometry_msgs/msg/Twist"
9+
topic_name: cmd_vel
10+
deadman_buttons: [7]
11+
axis_mappings:
12+
-
13+
axis: 3 # Right thumb stick (up/down)
14+
target: linear.x
15+
scale: 0.4
16+
offset: 0.0
17+
-
18+
axis: 2 # Right thumb stick (left/right)
19+
target: angular.z
20+
scale: 2.5
21+
offset: 0.0
22+
dock:
23+
type: topic
24+
message_type: "std_msgs/msg/Empty"
25+
topic_name: dock
26+
deadman_buttons: [3, 7] # RT + Y
27+
axis_mappings: []
28+
undock:
29+
type: topic
30+
message_type: "std_msgs/msg/Empty"
31+
topic_name: undock
32+
deadman_buttons: [1, 7] # RT + A
33+
axis_mappings: []

create_bringup/config/xbox360.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# XBox 360 wired controller
2-
teleop:
3-
piloting:
4-
type: topic
5-
message_type: "geometry_msgs/Twist"
6-
topic_name: cmd_vel
7-
deadman_buttons: [] # No deadman buttons
8-
axis_mappings:
9-
-
10-
axis: 4 # Right thumb (up/down)
11-
target: linear.x
12-
scale: 0.4
13-
offset: 0.0
14-
-
15-
axis: 3 # Right thumb stick (left/right)
16-
target: angular.z
17-
scale: 2.5
18-
offset: 0.0
2+
joy_teleop:
3+
ros__parameters:
4+
piloting:
5+
type: topic
6+
message_type: "geometry_msgs/msg/Twist"
7+
topic_name: cmd_vel
8+
deadman_buttons: [] # No deadman buttons
9+
axis_mappings:
10+
-
11+
axis: 4 # Right thumb (up/down)
12+
target: linear.x
13+
scale: 0.4
14+
offset: 0.0
15+
-
16+
axis: 3 # Right thumb stick (left/right)
17+
target: angular.z
18+
scale: 2.5
19+
offset: 0.0
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
22
<launch>
3-
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
3+
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
44
<arg name="desc" default="true" />
55

6-
<node name="create_driver" pkg="create_driver" type="create_driver" output="screen">
7-
<rosparam command="load" file="$(arg config)" />
6+
<node name="create_driver" pkg="create_driver" exec="create_driver" output="screen">
7+
<param from="$(var config)" />
88
<param name="robot_model" value="CREATE_1" />
99
</node>
1010

1111
<!-- Robot description -->
12-
<include if="$(arg desc)" file="$(find create_description)/launch/create_1.launch" />
12+
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/create_1.xml" />
1313
</launch>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
22
<launch>
3-
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
3+
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
44
<arg name="desc" default="true" />
55

6-
<node name="create_driver" pkg="create_driver" type="create_driver" output="screen">
7-
<rosparam command="load" file="$(arg config)" />
6+
<node name="create_driver" pkg="create_driver" exec="create_driver" output="screen">
7+
<param from="$(var config)" />
88
<param name="robot_model" value="CREATE_2" />
99
</node>
1010

1111
<!-- Robot description -->
12-
<include if="$(arg desc)" file="$(find create_description)/launch/create_2.launch" />
12+
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/create_2.xml" />
1313
</launch>

create_bringup/launch/joy_teleop.launch

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
<launch>
33
<arg name="joy_dev" default="/dev/input/js0" />
44
<arg name="joy_config" default="xbox360" />
5-
<arg name="teleop_config" default="$(find create_bringup)/config/$(arg joy_config).yaml" />
5+
<arg name="teleop_config" default="$(find-pkg-share create_bringup)/config/$(var joy_config).yaml" />
66

7-
<rosparam file="$(arg teleop_config)" command="load" />
8-
9-
<node pkg="joy" type="joy_node" name="joy_node">
10-
<param name="dev" value="$(arg joy_dev)" />
7+
<node pkg="joy" exec="joy_node" name="joy_node">
8+
<param name="dev" value="$(var joy_dev)" />
119
<param name="deadzone" value="0.2" />
12-
<param name="autorepeat_rate" value="20" />
10+
<param name="autorepeat_rate" value="20.0" />
1311
</node>
1412

15-
<node pkg="joy_teleop" type="joy_teleop.py" name="joy_teleop">
13+
<node pkg="joy_teleop" exec="joy_teleop" name="joy_teleop">
14+
<param from="$(var teleop_config)" />
1615
</node>
1716
</launch>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
22
<launch>
3-
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
3+
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
44
<arg name="desc" default="true" />
55

6-
<node name="create_driver" pkg="create_driver" type="create_driver" output="screen">
7-
<rosparam command="load" file="$(arg config)" />
6+
<node name="create_driver" pkg="create_driver" exec="create_driver" output="screen">
7+
<param from="$(var config)" />
88
<param name="robot_model" value="ROOMBA_400" />
99
</node>
1010

1111
<!-- Robot description -->
12-
<include if="$(arg desc)" file="$(find create_description)/launch/roomba_400.launch" />
12+
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/roomba_400.xml" />
1313
</launch>

create_bringup/package.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212

1313
<author email="jacob@openrobotics.org">Jacob Perron</author>
1414

15-
<buildtool_depend>catkin</buildtool_depend>
15+
<buildtool_depend>ament_cmake</buildtool_depend>
1616

1717
<exec_depend>create_description</exec_depend>
1818
<exec_depend>create_driver</exec_depend>
1919
<exec_depend>joy</exec_depend>
2020
<exec_depend>joy_teleop</exec_depend>
2121

2222
<export>
23+
<build_type>ament_cmake</build_type>
2324
</export>
2425
</package>

0 commit comments

Comments
 (0)