Skip to content

Commit f742f4f

Browse files
author
Emiliano Borghi
committed
Add fix for real RPLidar A2
1 parent b2f9509 commit f742f4f

File tree

11 files changed

+217
-10
lines changed

11 files changed

+217
-10
lines changed

ca_bringup/launch/minimal.launch

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
<arg name="raspicam_receiver_IP" default="" doc="Raspicam client IP"/>
66
<arg name="laser" default="$(optenv LASER)" doc="Laser for mapping the environment"/>
77

8+
<arg name="rviz" default="$(optenv RVIZ false)" doc="Flag to use RViz"/>
9+
<arg name="rviz_config" value="$(optenv RVIZ_CONFIG)" doc="RViz configuration file"/>
10+
811
<include file="$(find ca_node)/launch/create_2.launch"/>
912

13+
<!-- RViz -->
14+
<!-- TODO: HAVE A PLACE IN COMMON WITH GAZEBO -->
15+
<include if="$(eval arg('rviz') or arg('rviz_config')!='' )"
16+
file="$(find ca_tools)/launch/rviz.launch">
17+
<arg name="config_file" value="$(arg rviz_config)"/>
18+
</include>
19+
1020
<!-- raspicam -->
1121
<include if="$(eval arg('raspicam_receiver_IP') != '')" file="$(find ca_visual_odometry)/launch/raspicam_stream.launch">
1222
<arg name="IP" value="$(arg raspicam_receiver_IP)"/>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# Software License Agreement (BSD License)
4+
#
5+
# Copyright (c) 2017, Tokyo Opensource Robotics Kyokai Association
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without
9+
# modification, are permitted provided that the following conditions
10+
# are met:
11+
#
12+
# * Redistributions of source code must retain the above copyright
13+
# notice, this list of conditions and the following disclaimer.
14+
# * Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
# * Neither the name of Tokyo Opensource Robotics Kyokai Association. nor the
19+
# names of its contributors may be used to endorse or promote products
20+
# derived from this software without specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
# POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
# Author: Ryosuke Tajima
36+
37+
# TODO: MAKE A FUNCTION WITH DUPLICATED CODE!!!
38+
39+
echo "remap the device serial port(ttyUSBX) to /dev/roomba"
40+
echo "roomba usb connection as /dev/roomba, check it using the command : ls -l /dev|grep ttyUSB"
41+
echo "start copy roomba.rules to /etc/udev/rules.d/"
42+
echo "roomba.rules"
43+
# sudo cp `rospack find ca_bringup`/scripts/roomba.rules /etc/udev/rules.d
44+
sudo cp roomba.rules /etc/udev/rules.d
45+
46+
echo "remap the device serial port(ttyUSBX) to rplidar"
47+
echo "rplidar usb connection as /dev/rplidar , check it using the command : ls -l /dev|grep ttyUSB"
48+
echo "start copy rplidar.rules to /etc/udev/rules.d/"
49+
echo "rplidar.rules"
50+
# sudo cp `rospack find ca_bringup`/scripts/rplidar.rules /etc/udev/rules.d
51+
sudo cp rplidar.rules /etc/udev/rules.d
52+
53+
echo " "
54+
echo "Restarting udev"
55+
echo ""
56+
sudo service udev reload
57+
sudo service udev restart
58+
echo "finish "
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
# Software License Agreement (BSD License)
4+
#
5+
# Copyright (c) 2017, Tokyo Opensource Robotics Kyokai Association
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without
9+
# modification, are permitted provided that the following conditions
10+
# are met:
11+
#
12+
# * Redistributions of source code must retain the above copyright
13+
# notice, this list of conditions and the following disclaimer.
14+
# * Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
# * Neither the name of Tokyo Opensource Robotics Kyokai Association. nor the
19+
# names of its contributors may be used to endorse or promote products
20+
# derived from this software without specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
# POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
# Author: Ryosuke Tajima
36+
37+
echo "delete remap the device serial port(ttyUSBX) to roomba"
38+
echo "sudo rm /etc/udev/rules.d/roomba.rules"
39+
sudo rm /etc/udev/rules.d/roomba.rules
40+
echo "delete remap the device serial port(ttyUSBX) to rplidar"
41+
echo "sudo rm /etc/udev/rules.d/rplidar.rules"
42+
sudo rm /etc/udev/rules.d/rplidar.rules
43+
echo " "
44+
echo "Restarting udev"
45+
echo ""
46+
sudo service udev reload
47+
sudo service udev restart
48+
echo "finish delete"

ca_bringup/scripts/roomba.rules

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# set the udev rule , make the device_port be fixed by roomba
2+
#
3+
# Software License Agreement (BSD License)
4+
#
5+
# Copyright (c) 2017, Tokyo Opensource Robotics Kyokai Association
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without
9+
# modification, are permitted provided that the following conditions
10+
# are met:
11+
#
12+
# * Redistributions of source code must retain the above copyright
13+
# notice, this list of conditions and the following disclaimer.
14+
# * Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
# * Neither the name of Tokyo Opensource Robotics Kyokai Association. nor the
19+
# names of its contributors may be used to endorse or promote products
20+
# derived from this software without specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
# POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
# Author: Ryosuke Tajima
36+
37+
KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE:="0777", SYMLINK+="roomba"
38+
KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE:="0777", SYMLINK+="roomba"

ca_bringup/scripts/rplidar.rules

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# set the udev rule , make the device_port be fixed by rplidar
2+
#
3+
# Software License Agreement (BSD License)
4+
#
5+
# Copyright (c) 2017, Tokyo Opensource Robotics Kyokai Association
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without
9+
# modification, are permitted provided that the following conditions
10+
# are met:
11+
#
12+
# * Redistributions of source code must retain the above copyright
13+
# notice, this list of conditions and the following disclaimer.
14+
# * Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
# * Neither the name of Tokyo Opensource Robotics Kyokai Association. nor the
19+
# names of its contributors may be used to endorse or promote products
20+
# derived from this software without specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
# POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
# Author: Ryosuke Tajima
36+
37+
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="rplidar"

ca_driver/config/default.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# Robot model
2+
robot_model: "CREATE_2"
3+
14
# The device path for the robot
2-
dev: "/dev/ttyUSB0"
5+
dev: "/dev/roomba"
36

47
# Baud rate. Passing this parameter overwrites the inferred value based on the robot_model
5-
# baud: 115200
8+
baud: 115200
69

710
# Base frame ID
811
base_frame: "base_footprint"

ca_node/launch/create_2.launch

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<rosparam command="load" file="$(arg config)" />
1212

1313
<param name="namespace" value="$(arg ns)"/>
14-
<param name="robot_model" value="CREATE_2" />
1514
<param name="tf_prefix" value="$(arg tf_prefix)"/>
1615
</node>
1716

docker/docker_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ def create_directory(directory):
4343
if (os.path.isdir(directory)): return
4444
run_command("mkdir -p {}".format(directory))
4545
run_command("sudo chown {0}:{0} {1}".format(get_user(), directory))
46+
47+
def mount_resource(device):
48+
# Mount hardware resource if it exists in the host
49+
if os.path.isdir(device):
50+
return "--volume=\"{0}:{0}:shared\"".format(device)
51+
return ""

docker/run

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def run_dev_environment(command, ros="melodic", gazebo="9"):
3838
# VSCode needs HOME to be defined in order to work in the container
3939
docker_args.append("-e HOME=/home/{}".format(user_docker))
4040

41-
# USB devices and dialout group for the real robot
42-
docker_args.append("--volume=\"/dev/bus:/dev/bus:shared\"")
43-
docker_args.append("--group-add=dialout")
41+
# USB devices for the real robot
42+
docker_args.append(ut.mount_resource("/dev/roomba"))
43+
docker_args.append(ut.mount_resource("/dev/rplidar"))
4444

4545
# To allow installing packages
4646
docker_args.append("--group-add=sudo")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
serial_port: "/dev/rplidar"
2+
serial_baudrate: 115200
3+
inverted: False
4+
angle_compensate: True

0 commit comments

Comments
 (0)