ROS 2 navigation pakcages for Raspberry Pi Mouse V3
First of all, you need to install Ubuntu 18.04 and ROS 2 Dashing Diademata on your Raspberry Pi 3 B and PC. Please refer the official ROS 2 installation process: https://index.ros.org/doc/ros2/Installation/Crystal/Linux-Install-Binary/
sudo apt install python3-colcon-common-extensions python3-rosdep python3-argcomplete
sudo rosdep init
rosdep update
Set the environmental variable ROS_DOMAIN_ID
to specify your network configuration.
The ROS_DOMAIN_ID
is a number between 0
and 255
.
export ROS_DOMAIN_ID=XXX
git clone https://github.com/rt-net/RaspberryPiMouse.git
cd RaspberryPiMouse/src/drivers
make
sudo make install
sudo insmod rtmouse.ko
sudo usermod -aG dialout $USER
mkdir -p ~/ros/dashing/src
cd ~/ros/dashing/src
git clone https://github.com/youtalk/raspimouse_ros2.git -b ignore-cartographer-navigation2
cd raspimouse_ros2
git submodule update --init
cd ../..
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source ~/ros/dashing/install/setup.bash
mkdir -p ~/ros/dashing/src
cd ~/ros/dashing/src
git clone https://github.com/youtalk/raspimouse_ros2.git
cd raspimouse_ros2
git submodule update --init
cd ../..
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source ~/ros/dashing/install/setup.bash
Run Raspberry Pi Mouse and RPLiDAR A1M8 drivers.
ros2 launch raspimouse_bringup robot.launch.py
Enable Raspberry Pi Mouse.
ros2 lifecycle set raspimouse_driver configure && \
ros2 lifecycle set raspimouse_driver activate && \
ros2 service call /motor_power std_srvs/SetBool '{data: true}'
Run Rviz2.
ros2 launch raspimouse_bringup rviz2.launch.py
Run teleop_twist_keyboard
.
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Note that the default linear speed is too fast.
Please decrease the linear speed to 0.15 [m/s] or lower by pressing x
key several times.
Do the same as above.
First do the same as above. Then move around a floor while recording the bag file for SLAM data.
sudo apt install 'ros-dashing-ros2bag*' 'ros-dashing-rosbag2*'
ros2 bag record -a -o ./raspimouse_slam.bag
Run raspimouse_cartographer
to generate 2D map.
ros2 launch raspimouse_cartographer cartographer.launch.py
Play the bag file recorded before.
ros2 bag play ~/raspimouse_slam.bag
Save map files if the quaility of the map on RViz2 is acceptable.
ros2 run nav2_map_server map_saver -f ~/.ros/map
Note that a sample bag file and map data are stored following directories.
- Bag file: https://github.com/youtalk/raspimouse_bags/tree/master/raspimouse_slam.bag
- Map data: https://github.com/youtalk/raspimouse_ros2/tree/master/raspimouse_navigation2/map
Do the same as above.
Run raspimouse_navigation2
to launch RViz2 with the navigation configuration.
Note that please wait seconds to complete launching navigation nodes.
ros2 launch raspimouse_navigation2 navigation2.launch.py map:=/home/$USER/.ros/map.yaml
Press 2D Pose Estimate
button to initialize the robot pose. Then Press Navigation2 Goal
to give the goal pose.
The robot will start moving along the path to the goal pose.