NeuronBot2 is the newest version of NeuronBot made by Adlink, which fully supports ROS 1 and ROS 2.
This package includes the functions to bring up the robot, to make it SLAM, to navigate, and to simulate it with your own computer, testing the same functions mentioned before.
Users are able to checkout to different branches of this package to run on ROS 1 and ROS 2, please check different branches.
Install ROS 2 development tools
sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
libbullet-dev \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
openssh-server \
wget
Git clone NeuronBot2 and other related sources
mkdir -p ~/neuronbot2_ros2_ws/src
cd ~/neuronbot2_ros2_ws/
wget https://raw.githubusercontent.com/Adlink-ROS/neuronbot2_ros2.repos/humble/neuronbot2_ros2.repos
vcs import src < neuronbot2_ros2.repos
Install other dependencies
cd ~/neuronbot2_ros2_ws/
source /opt/ros/humble/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -r -y --rosdistro humble
Initialze NeuronBot2 ttyUSB nodes,
neuronbot_init.sh
is needed to be run only once for the first setup. If you use NeuronBot2 for simulation only, not for the real robot, then you can skip this step.
cd ~/neuronbot2_ros2_ws/src/neuronbot2/neuronbot2_tools/neuronbot2_init/
sudo ./neuronbot2_init.sh
Colcon build the package
cd ~/neuronbot2_ros2_ws/
source /opt/ros/humble/setup.bash
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
source ~/neuronbot2_ros2_ws/install/local_setup.bash
Now, it's time to launch your NeuronBot2 and do a Robotic-Hello-World thing -- teleop it.
If you are looking for the NeuronBot2 simulation, please jump to Bring up in Simulation.
Open a new terminal (Ctrl + Alt + t).
source /opt/ros/humble/setup.bash
source ~/neuronbot2_ros2_ws/install/local_setup.bash
ros2 launch neuronbot2_bringup bringup_launch.py
source /opt/ros/humble/setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Follow the hints and start to cruise your NeuronBot2.
Launch SLAM as well as Rviz.
We provide three slam methods.
ros2 launch neuronbot2_slam gmapping_launch.py open_rviz:=true
ros2 launch neuronbot2_slam slam_toolbox_launch.py open_rviz:=true
ros2 launch neuronbot2_slam cartographer_launch.py open_rviz:=true
Teleop NeuronBot2 to explore the world
# Run on the other terminal
source /opt/ros/humble/setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Save the map
source /opt/ros/humble/setup.bash
ros2 run nav2_map_server map_saver_cli -f <map_dir>/<map_name>
The map is ready and SLAM can be turned off.
ros2 launch neuronbot2_nav bringup_launch.py map:=<full_path_to_your_map_name.yaml> open_rviz:=true
Set Estimation
Click "2D Pose Estimate", and set estimation to the approximate location of robot on the map.
Set Goal
Click "2D Nav Goal", and set goal to any free space on the map.
Specify the model path for Gazebo
source /opt/ros/humble/setup.bash
source ~/neuronbot2_ros2_ws/install/local_setup.bash
Launch Gazebo simulation.
There are two worlds for users to explore.
ros2 launch neuronbot2_gazebo neuronbot2_world.launch.py world_model:=mememan_world.model
ros2 launch neuronbot2_gazebo neuronbot2_world.launch.py world_model:=phenix_world.model
Teleop it in the world
Users are able to control the NeuronBot2 with the following rosnode. Run it with the other terminal.
source /opt/ros/humble/local_setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard
p.s. To alleviate CPU consumption, close GAZEBO GUI by clicking x. This will not end the simulation server, which is running backend
Launch SLAM as well as Rviz while the Gazebo simulation is running.
We provide three slam methods.
ros2 launch neuronbot2_slam gmapping_launch.py open_rviz:=true use_sim_time:=true
ros2 launch neuronbot2_slam slam_toolbox_launch.py open_rviz:=true use_sim_time:=true
ros2 launch neuronbot2_slam cartographer_launch.py open_rviz:=true use_sim_time:=true
Teleop NeuronBot2 to explore the world
# Run on the other terminal
source /opt/ros/humble/setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Save the map
source /opt/ros/humble/setup.bash
ros2 run nav2_map_server map_saver_cli -f <map_dir>/<map_name>
Then, you shall turn off SLAM.
Once users obtain the map, pgm file, and yaml file, navigation is good to go.
Launch Navigation as well as Rviz while the Gazebo simulation is running. If you haven't finished SLAM to get the map files, no worries, you can use the default maps mememan and phenix we have built for you.
Bringup all navigation nodes with specific parameters
ros2 launch neuronbot2_nav bringup_launch.py map:=$HOME/neuronbot2_ros2_ws/src/neuronbot2/neuronbot2_nav/map/mememan.yaml open_rviz:=true use_sim_time:=true
Try navigation on your own map. Put the
ros2 launch neuronbot2_nav bringup_launch.py map:=<map_name>.yaml open_rviz:=true use_sim_time:=true
Supported parameters and its value for launch files
map: phenix.yaml | mememan.yaml (default)
open_rviz: true | false (default)
use_sim_time: true | false (default) # if you run navigation in simulation, then use_sim_time must be set to true
You can also run localization and navigation in separate terminals.
# terminal 1
ros2 launch neuronbot2_nav localization_launch.py use_sim_time:=true
# terminal 2
ros2 launch neuronbot2_nav navigation_launch.py use_sim_time:=true
# terminal 3
ros2 launch neuronbot2_nav rviz_view_launch.py use_sim_time:=true
Set Estimation
Click "2D Pose Estimate", and set estimation to the approximate location of robot on the map.
Set Goal
Click "2D Nav Goal", and set goal to any free space on the map.
To run this demo, users should execute Gazebo server and Navigation (with Rviz for visualization) first.
source /opt/ros/humble/setup.bash
source ~/neuronbot2_ros2_ws/install/local_setup.bash
Run Behavior Tree
Please go to check this repos: https://github.com/Adlink-ROS/BT_ros2