| Requirements: | |
| Have ubuntu 22.04 | |
| Have ssh keys set up | |
| Gaming controller (ex: xbox,ps, etc.) | |
| Instructions to Set up RDD2 drone with SLAM and nav2 capability | |
| Step 1 install Cognipilot (*make sure you have ssh key set up on this device prior to install) | |
| sudo apt-get update | |
| sudo apt-get install git wget -y | |
| mkdir -p ~/cognipilot/installer | |
| wget -O ~/cognipilot/installer/install_cognipilot.sh https://raw.githubusercontent.com/cognipilot/helmet/main/install/install_cognipilot.sh | |
| chmod a+x ~/cognipilot/installer/install_cognipilot.sh | |
| /bin/bash ~/cognipilot/installer/install_cognipilot.sh | |
| When prompted: | |
| 1) airy | |
| 2) brave | |
| 3) main | |
| Enter a CogniPilot release (number) to use: 2 | |
| Using CogniPilot main development branch. | |
| 1) native | |
| 2) navqplus | |
| Enter a CogniPilot installer type (number) to use: 1 | |
| Clone repositories with git using already setup github ssh keys [y/n]? y | |
| Source your bashrc when finished installing as prompted | |
| source ~/.bashrc | |
| Step 2 Build the cognipilot workspace | |
| The previous step should have created a bin directory in the directory you installed cognipilot in. go to the bin directory then run build_workspace | |
| cd ~/bin | |
| ./build_workspace | |
| When prompted: | |
| Clone repositories with git using already setup github ssh keys [y/n]? y | |
| Using git with ssh, best for developers. | |
| 1) b3rb | |
| 2) rdd2 | |
| Enter a platform (number) to build: 2 | |
| Source your bashrc when finished installing as prompted | |
| source ~/.bashrc | |
| *if you get an error rerun once or twice it sometimes times out when building especially the first time | |
| Step 3 add resources needed for competition | |
| Add map world file | |
| Download this file | |
| https://github.com/ksommerkohrt/dream_world/blob/main/worlds/maze.sdf | |
| Copy the file and move it to the worlds directory (this can also be done in the file explorer as well) | |
| cd ~/Downloads | |
| mv maze.sdf ~/cognipilot/cranium/src/dream_world/worlds | |
| Go to cranium directory and build changes so the new world file is recognized | |
| cd ~/cognipilot/cranium | |
| colcon build --symlink-install | |
| Replace nav2 yaml file (optional)* | |
| *the yaml file above uses the rotation shim controller and has slowed down the drone to make it | |
| a bit more realistic but this solution still is not 100% successful | |
| The original yaml file is the default yaml file for a rover as such it presumes the drone can brake quickly like a wheeled vehicle and often hits walls | |
| You can start from either yaml file and tune a feasible solution either by using plugins discussed here: https://docs.nav2.org/plugins/index.html?highlight=plugin | |
| Or you could also develop your own plugins. The process involved in doing so is described here | |
| https://docs.nav2.org/plugin_tutorials/index.html | |
| Download this file | |
| https://github.com/ksommerkohrt/rdd2/blob/main/rdd2_nav2/config/nav2.yaml | |
| Copy the file and move it to the config directory (this can also be done in the file explorer) | |
| cd ~/Downloads | |
| mv nav2.yaml ~/cognipilot/cranium/src/rdd2/rdd2_nav2/config | |
| Step 4 run the simulation in the maze world | |
| cd ~/cognipilot/ws/cerebri | |
| git pull | |
| rm -rf install | |
| west update | |
| west build -t install | |
| ros2 launch rdd2_gz_bringup sil.launch.py electrode:=true world:=maze | |
| Step 5 set up drone to accept nav2 goals | |
| Press green triangle (ps) or y button (xbox) to put the drone in cmd_vel mode | |
| Press right bumper to put the the drone in offboard mode | |
| Press right trigger to arm the drone | |
| How to set up autonomous exploration* | |
| git clone git@github.com:ksommerkohrt/frontier_exploration_maze.git | |
| cd ~/frontier_exploration_maze | |
| colcon build | |
| After you launch the robot and prepare it to accept nav2 goals in one terminal open another and run: | |
| source install/setup.bash | |
| ros2 launch frontier_exploration classical_exploration.launch.py | |
| *If this fails and says there are no remaining frontiers part of the way through the maze sometimes rerunning it will allow the robot to exit the maze | |
| How to create map | |
| Once your robot has completed the maze in a new terminal run: | |
| ros2 run nav2_map_server map_saver_cli -f ~/cognipilot/cranium/src/rdd2/rdd2_nav2/maps/maze | |
| How to load your map and use it to navigate: | |
| Go to cranium directory and build changes so the new world file is recognized | |
| cd ~/cognipilot/cranium | |
| colcon build --symlink-install | |
| cd ~/cognipilot/ws/cerebri | |
| git pull | |
| rm -rf install | |
| west update | |
| west build -t install | |
| ros2 launch rdd2_gz_bringup sil.launch.py nav2:=true localization:=localization rviz:=true world:=maze | |