This repository contains two ROS2 packages:
Provides navigation capabilities for the Apple Kraken vehicle.
Allows the Apple Kraken vehicle to operate autonomously.
CycloneDDS
sudo apt install ros-${ROS_DISTRO}-cyclonedds ros-${ROS_DISTRO}-rmw-cyclonedds-cpp
It is required that CycloneDDS
implementation is chosen in every working terminal:
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
You will need to install the appropriate ROS2 package. Refer to setup requirements for the ROS2 Gem
In addition to the required packages for the ROS2 gem, you will also need some additional ROS2 packages.
Make sure to source the proper distribution's setup script
For Ubuntu 20.04 + ROS2 Galactic:
source /opt/ros/galactic/setup.bash
For Ubuntu 22.04 + ROS2 Humble:
source /opt/ros/humble/setup.bash
Run the following command to install the remaining required packages
sudo apt install ros-${ROS_DISTRO}-slam-toolbox ros-${ROS_DISTRO}-navigation2 ros-${ROS_DISTRO}-nav2-bringup ros-${ROS_DISTRO}-pointcloud-to-laserscan ros-${ROS_DISTRO}-teleop-twist-keyboard ros-${ROS_DISTRO}-ackermann-msgs ros-${ROS_DISTRO}-topic-tools
You will also need colcon installed in order to build the workspace. Run the following command to install.
sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install python3-colcon-common-extensions
The o3de_kraken_orchestration package uses the python-statemachine library.\ You can install it by running the following command
pip install python-statemachine
Note: Make sure you have the pip Python package manager installed.
O3DE
.o3de-ros-gem
.ROSConDemo
.Source ROS2 (assumed humble
)
source /opt/ros/humble/setup.bash
Build the workspace
cd ./kraken_nav
colcon build --symlink-install
ROSConDemo
Main
CTRL+G
Please make sure that the enviroment is correct.
Note that you need to set it up for every console.
You can consider adding it to your ~/.bashrc
.
Make sure that you have ROS2 workspace sourced
source ./kraken_nav/install/setup.bash
Make sure that you have CycleDDS
as middleware
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
Start teleoperation launch, make sure that you have your joystick plugged in
ros2 launch o3de_kraken_nav teleop.launch.py namespace:=apple_kraken_rusty_1
Spawn a single robot
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line1'}'
You should be able to drive the robot
Note: Slam is turned off by default since we have ground truth information about the robot's position from the simulator. However, it is possible to enable
slam_toolbox
forcefully. You can allow slam by addinguse_slam:=True
to the navigation launch command.
Run the navigation stack
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_1 rviz:=True
Spawn the robot
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line1'}'
You should be able to send goal to the robot.
Make sure that that you use only the first 2D Goal Pose
Note: Slam is turned off by default since we have ground truth information about the robot's position from the simulator. However, it is possible to enable
slam_toolbox
forcefully. You can allow slam by addinguse_slam:=True
to the navigation launch command.
Run the first navigation stack with Rviz
param set to True
:
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_1 rviz:=True
Run the navigation stack for rest of the robots (in separate terminals):
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_shiny_2 rviz:=False
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_3 rviz:=False
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_shiny_4 rviz:=False
Spawn multiple robots
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line1'}' &&
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_shiny', xml: 'line2'}' &&
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line3'}' &&
ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_shiny', xml: 'line4'}'
You should be able to send goals to multiple robots.
In this scenario on top of four navigation stacks, the orchestrator nodes are executed. Those are providing navigation stacks with goals and trigger apple gathering.
Run the first navigation stack with Rviz
param set to True
:
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_1 rviz:=True
Run the navigation stack for the rest of the robots (in separate terminals):
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_shiny_2 rviz:=False
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_3 rviz:=False
ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_shiny_4 rviz:=False
Run the orchestration nodes for all the robots (in separate terminals):
ros2 run o3de_kraken_orchestration kraken_orchestration_node --ros-args -p robot_name:=apple_kraken_rusty_1 -p spawn_line:=line1
ros2 run o3de_kraken_orchestration kraken_orchestration_node --ros-args -p robot_name:=apple_kraken_shiny_2 -p spawn_line:=line2
ros2 run o3de_kraken_orchestration kraken_orchestration_node --ros-args -p robot_name:=apple_kraken_rusty_3 -p spawn_line:=line3
ros2 run o3de_kraken_orchestration kraken_orchestration_node --ros-args -p robot_name:=apple_kraken_shiny_4 -p spawn_line:=line4