Skip to content

Commit

Permalink
Port to ROS 2 (foxy) (#8)
Browse files Browse the repository at this point in the history
* CMake required version bumped to 3.5.

* Fix README prerequisites.

* Remove unneeded CMAKE_CXX_STANDARD.

* Remove CreateDriver's priv_nh_ member.
  • Loading branch information
pgold authored and jacobperron committed Oct 13, 2020
1 parent 910a742 commit 1983450
Show file tree
Hide file tree
Showing 26 changed files with 385 additions and 393 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,20 @@ _* Not verified. Anyone who is able to verify that this driver works or not is e
#### Prerequisites

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

``` bash
$ sudo apt-get install python-rosdep python-catkin-tools
$ sudo apt install python3-rosdep python3-colcon-common-extensions
```

#### Compiling

1. Create a catkin workspace
1. Create a colcon workspace
``` bash
$ cd ~
$ mkdir -p create_ws/src
$ cd create_ws
$ catkin init
$ cd create_ws
```

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

1. After compiling from source, don't forget to source your workspace:
``` bash
$ source ~/create_ws/devel/setup.bash
$ source ~/create_ws/install/setup.bash
```
2. Connect computer to Create's 7-pin serial port
Expand All @@ -124,17 +123,17 @@ $ sudo apt-get install python-rosdep python-catkin-tools
For Create 2 (Roomba 600/700 series):
``` bash
$ roslaunch create_bringup create_2.launch
$ ros2 launch create_bringup create_2.launch
```
For Create 1 (Roomba 500 series):
``` bash
$ roslaunch create_bringup create_1.launch
$ ros2 launch create_bringup create_1.launch
```
For Roomba 400 series:
``` bash
$ roslaunch create_bringup roomba_400.launch
$ ros2 launch create_bringup roomba_400.launch
```
#### Launch file arguments
Expand All @@ -145,7 +144,7 @@ $ roslaunch create_bringup roomba_400.launch
For example, if you would like to disable the robot description and provide a custom configuration file:
```bash
$ roslaunch create_bringup create_2.launch config:=/abs/path/to/config.yaml desc:=false
$ ros2 launch create_bringup create_2.launch config:=/abs/path/to/config.yaml desc:=false
```
### Parameters
Expand Down Expand Up @@ -222,7 +221,7 @@ angular.z (+) Rotate counter-clockwise (rad/s)
`create_bringup` comes with a launch file for teleoperating Create with a joystick.
``` bash
$ roslaunch create_bringup joy_teleop.launch [joy_config:=xbox360]
$ ros2 launch create_bringup joy_teleop.launch [joy_config:=xbox360]
```
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.
Expand Down
10 changes: 5 additions & 5 deletions create_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(create_bringup)

find_package(catkin REQUIRED)

catkin_package()
find_package(ament_cmake REQUIRED)

install(DIRECTORY config launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
DESTINATION share/${PROJECT_NAME}
PATTERN ".svn" EXCLUDE
)

ament_package()
30 changes: 16 additions & 14 deletions create_bringup/config/default.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# The device path for the robot
dev: "/dev/ttyUSB0"
create_node:
ros__parameters:
# The device path for the robot
dev: "/dev/ttyUSB0"

# Baud rate. Passing this parameter overwrites the inferred value based on the robot_model
# baud: 115200
# Baud rate. Passing this parameter overwrites the inferred value based on the robot_model
# baud: 115200

# Base frame ID
base_frame: "base_footprint"
# Base frame ID
base_frame: "base_footprint"

# Odometry frame ID
odom_frame: "odom"
# Odometry frame ID
odom_frame: "odom"

# Time (s) without receiving a velocity command before stopping the robot
latch_cmd_duration: 0.2
# Time (s) without receiving a velocity command before stopping the robot
latch_cmd_duration: 0.2

# Internal loop update rate (Hz)
loop_hz: 10.0
# Internal loop update rate (Hz)
loop_hz: 10.0

# Whether to publish the transform between odom_frame and base_frame
publish_tf: true
# Whether to publish the transform between odom_frame and base_frame
publish_tf: true
59 changes: 30 additions & 29 deletions create_bringup/config/log710.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# Logitech F710 wireless controller
# Deadman (enable) button: Right Trigger
# D<>X button (located on the back panel) must be set to D
teleop:
piloting:
type: topic
message_type: "geometry_msgs/Twist"
topic_name: cmd_vel
deadman_buttons: [7]
axis_mappings:
-
axis: 3 # Right thumb stick (up/down)
target: linear.x
scale: 0.4
offset: 0.0
-
axis: 2 # Right thumb stick (left/right)
target: angular.z
scale: 2.5
offset: 0.0
dock:
type: topic
message_type: "std_msgs/Empty"
topic_name: dock
deadman_buttons: [3, 7] # RT + Y
axis_mappings: []
undock:
type: topic
message_type: "std_msgs/Empty"
topic_name: undock
deadman_buttons: [1, 7] # RT + A
axis_mappings: []
joy_teleop:
ros__parameters:
piloting:
type: topic
message_type: "geometry_msgs/msg/Twist"
topic_name: cmd_vel
deadman_buttons: [7]
axis_mappings:
-
axis: 3 # Right thumb stick (up/down)
target: linear.x
scale: 0.4
offset: 0.0
-
axis: 2 # Right thumb stick (left/right)
target: angular.z
scale: 2.5
offset: 0.0
dock:
type: topic
message_type: "std_msgs/msg/Empty"
topic_name: dock
deadman_buttons: [3, 7] # RT + Y
axis_mappings: []
undock:
type: topic
message_type: "std_msgs/msg/Empty"
topic_name: undock
deadman_buttons: [1, 7] # RT + A
axis_mappings: []
35 changes: 18 additions & 17 deletions create_bringup/config/xbox360.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# XBox 360 wired controller
teleop:
piloting:
type: topic
message_type: "geometry_msgs/Twist"
topic_name: cmd_vel
deadman_buttons: [] # No deadman buttons
axis_mappings:
-
axis: 4 # Right thumb (up/down)
target: linear.x
scale: 0.4
offset: 0.0
-
axis: 3 # Right thumb stick (left/right)
target: angular.z
scale: 2.5
offset: 0.0
joy_teleop:
ros__parameters:
piloting:
type: topic
message_type: "geometry_msgs/msg/Twist"
topic_name: cmd_vel
deadman_buttons: [] # No deadman buttons
axis_mappings:
-
axis: 4 # Right thumb (up/down)
target: linear.x
scale: 0.4
offset: 0.0
-
axis: 3 # Right thumb stick (left/right)
target: angular.z
scale: 2.5
offset: 0.0
8 changes: 4 additions & 4 deletions create_bringup/launch/create_1.launch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
<launch>
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
<arg name="desc" default="true" />

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

<!-- Robot description -->
<include if="$(arg desc)" file="$(find create_description)/launch/create_1.launch" />
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/create_1.xml" />
</launch>
8 changes: 4 additions & 4 deletions create_bringup/launch/create_2.launch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
<launch>
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
<arg name="desc" default="true" />

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

<!-- Robot description -->
<include if="$(arg desc)" file="$(find create_description)/launch/create_2.launch" />
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/create_2.xml" />
</launch>
13 changes: 6 additions & 7 deletions create_bringup/launch/joy_teleop.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
<launch>
<arg name="joy_dev" default="/dev/input/js0" />
<arg name="joy_config" default="xbox360" />
<arg name="teleop_config" default="$(find create_bringup)/config/$(arg joy_config).yaml" />
<arg name="teleop_config" default="$(find-pkg-share create_bringup)/config/$(var joy_config).yaml" />

<rosparam file="$(arg teleop_config)" command="load" />

<node pkg="joy" type="joy_node" name="joy_node">
<param name="dev" value="$(arg joy_dev)" />
<node pkg="joy" exec="joy_node" name="joy_node">
<param name="dev" value="$(var joy_dev)" />
<param name="deadzone" value="0.2" />
<param name="autorepeat_rate" value="20" />
<param name="autorepeat_rate" value="20.0" />
</node>

<node pkg="joy_teleop" type="joy_teleop.py" name="joy_teleop">
<node pkg="joy_teleop" exec="joy_teleop" name="joy_teleop">
<param from="$(var teleop_config)" />
</node>
</launch>
8 changes: 4 additions & 4 deletions create_bringup/launch/roomba_400.launch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
<launch>
<arg name="config" default="$(find create_bringup)/config/default.yaml" />
<arg name="config" default="$(find-pkg-share create_bringup)/config/default.yaml" />
<arg name="desc" default="true" />

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

<!-- Robot description -->
<include if="$(arg desc)" file="$(find create_description)/launch/roomba_400.launch" />
<include if="$(var desc)" file="$(find-pkg-share create_description)/launch/roomba_400.xml" />
</launch>
3 changes: 2 additions & 1 deletion create_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

<author email="[email protected]">Jacob Perron</author>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>

<exec_depend>create_description</exec_depend>
<exec_depend>create_driver</exec_depend>
<exec_depend>joy</exec_depend>
<exec_depend>joy_teleop</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
18 changes: 7 additions & 11 deletions create_description/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(create_description)

find_package(catkin REQUIRED COMPONENTS
roslaunch
)

catkin_package()

roslaunch_add_file_check(launch)
find_package(ament_cmake REQUIRED)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
DESTINATION share/${PROJECT_NAME}/launch
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY meshes/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/meshes
DESTINATION share/${PROJECT_NAME}/meshes
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY urdf/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/urdf
DESTINATION share/${PROJECT_NAME}/urdf
PATTERN ".svn" EXCLUDE
)

ament_package()
5 changes: 3 additions & 2 deletions create_description/launch/create_1.launch
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<launch>
<param name="robot_description" command="$(find xacro)/xacro '$(find create_description)/urdf/create_1.urdf.xacro'" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen" />
<node name="robot_state_publisher" pkg="robot_state_publisher" exec="robot_state_publisher" output="screen">
<param name="robot_description" type="str" value="$(command '$(find-pkg-prefix xacro)/bin/xacro $(find-pkg-share create_description)/urdf/create_1.urdf.xacro')" />
</node>
</launch>
5 changes: 3 additions & 2 deletions create_description/launch/create_2.launch
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<launch>
<param name="robot_description" command="$(find xacro)/xacro '$(find create_description)/urdf/create_2.urdf.xacro'" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen" />
<node name="robot_state_publisher" pkg="robot_state_publisher" exec="robot_state_publisher" output="screen">
<param name="robot_description" type="str" value="$(command '$(find-pkg-prefix xacro)/bin/xacro $(find-pkg-share create_description)/urdf/create_2.urdf.xacro')" />
</node>
</launch>
7 changes: 4 additions & 3 deletions create_description/launch/roomba_400.launch
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<launch>
<!-- TODO(jacobperron): Add Roomba URDF and mesh to use here instead of Create 1 model -->
<param name="robot_description" command="$(find xacro)/xacro '$(find create_description)/urdf/create_1.urdf.xacro'" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen" />
<node name="robot_state_publisher" pkg="robot_state_publisher" exec="robot_state_publisher" output="screen">
<!-- TODO(jacobperron): Add Roomba URDF and mesh to use here instead of Create 1 model -->
<param name="robot_description" type="str" value="$(command '$(find-pkg-prefix xacro)/bin/xacro $(find-pkg-share create_description)/urdf/create_1.urdf.xacro')" />
</node>
</launch>
Loading

0 comments on commit 1983450

Please sign in to comment.