Create Maze_Competition/Simulator_Instructions.txt
Browse files
Maze_Competition/Simulator_Instructions.txt
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Requirements:
|
| 2 |
+
Have ubuntu 22.04
|
| 3 |
+
Have ssh keys set up
|
| 4 |
+
Gaming controller (ex: xbox,ps, etc.)
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
Instructions to Set up RDD2 drone with SLAM and nav2 capability
|
| 8 |
+
|
| 9 |
+
Step 1 install Cognipilot (*make sure you have ssh key set up on this device prior to install)
|
| 10 |
+
|
| 11 |
+
sudo apt-get update
|
| 12 |
+
sudo apt-get install git wget -y
|
| 13 |
+
mkdir -p ~/cognipilot/installer
|
| 14 |
+
wget -O ~/cognipilot/installer/install_cognipilot.sh https://raw.githubusercontent.com/cognipilot/helmet/main/install/install_cognipilot.sh
|
| 15 |
+
chmod a+x ~/cognipilot/installer/install_cognipilot.sh
|
| 16 |
+
/bin/bash ~/cognipilot/installer/install_cognipilot.sh
|
| 17 |
+
|
| 18 |
+
When prompted:
|
| 19 |
+
|
| 20 |
+
1) airy
|
| 21 |
+
2) brave
|
| 22 |
+
3) main
|
| 23 |
+
|
| 24 |
+
Enter a CogniPilot release (number) to use: 2
|
| 25 |
+
|
| 26 |
+
Using CogniPilot main development branch.
|
| 27 |
+
|
| 28 |
+
1) native
|
| 29 |
+
2) navqplus
|
| 30 |
+
|
| 31 |
+
Enter a CogniPilot installer type (number) to use: 1
|
| 32 |
+
|
| 33 |
+
Clone repositories with git using already setup github ssh keys [y/n]? y
|
| 34 |
+
|
| 35 |
+
Source your bashrc when finished installing as prompted
|
| 36 |
+
|
| 37 |
+
source ~/.bashrc
|
| 38 |
+
|
| 39 |
+
Step 2 Build the cognipilot workspace
|
| 40 |
+
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
|
| 41 |
+
|
| 42 |
+
cd ~/bin
|
| 43 |
+
./build_workspace
|
| 44 |
+
|
| 45 |
+
When prompted:
|
| 46 |
+
Clone repositories with git using already setup github ssh keys [y/n]? y
|
| 47 |
+
|
| 48 |
+
Using git with ssh, best for developers.
|
| 49 |
+
1) b3rb
|
| 50 |
+
2) rdd2
|
| 51 |
+
|
| 52 |
+
Enter a platform (number) to build: 2
|
| 53 |
+
|
| 54 |
+
Source your bashrc when finished installing as prompted
|
| 55 |
+
|
| 56 |
+
source ~/.bashrc
|
| 57 |
+
|
| 58 |
+
*if you get an error rerun once or twice it sometimes times out when building especially the first time
|
| 59 |
+
|
| 60 |
+
Step 3 add resources needed for competition
|
| 61 |
+
|
| 62 |
+
Add map world file
|
| 63 |
+
|
| 64 |
+
Download this file
|
| 65 |
+
https://github.com/ksommerkohrt/dream_world/blob/main/worlds/maze.sdf
|
| 66 |
+
|
| 67 |
+
Copy the file and move it to the worlds directory (this can also be done in the file explorer as well)
|
| 68 |
+
cd ~/Downloads
|
| 69 |
+
mv maze.sdf ~/cognipilot/cranium/src/dream_world/worlds
|
| 70 |
+
|
| 71 |
+
Go to cranium directory and build changes so the new world file is recognized
|
| 72 |
+
cd ~/cognipilot/cranium
|
| 73 |
+
colcon build --symlink-install
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
Replace nav2 yaml file (optional)*
|
| 77 |
+
|
| 78 |
+
*the yaml file above uses the rotation shim controller and has slowed down the drone to make it
|
| 79 |
+
a bit more realistic but this solution still is not 100% successful
|
| 80 |
+
|
| 81 |
+
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
|
| 82 |
+
|
| 83 |
+
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
|
| 84 |
+
|
| 85 |
+
Or you could also develop your own plugins. The process involved in doing so is described here
|
| 86 |
+
https://docs.nav2.org/plugin_tutorials/index.html
|
| 87 |
+
|
| 88 |
+
Download this file
|
| 89 |
+
https://github.com/ksommerkohrt/rdd2/blob/main/rdd2_nav2/config/nav2.yaml
|
| 90 |
+
|
| 91 |
+
Copy the file and move it to the config directory (this can also be done in the file explorer)
|
| 92 |
+
cd ~/Downloads
|
| 93 |
+
mv nav2.yaml ~/cognipilot/cranium/src/rdd2/rdd2_nav2/config
|
| 94 |
+
|
| 95 |
+
Step 4 run the simulation in the maze world
|
| 96 |
+
cd ~/cognipilot/ws/cerebri
|
| 97 |
+
git pull
|
| 98 |
+
rm -rf install
|
| 99 |
+
west update
|
| 100 |
+
west build -t install
|
| 101 |
+
ros2 launch rdd2_gz_bringup sil.launch.py electrode:=true world:=maze
|
| 102 |
+
|
| 103 |
+
Step 5 set up drone to accept nav2 goals
|
| 104 |
+
Press green triangle (ps) or y button (xbox) to put the drone in cmd_vel mode
|
| 105 |
+
Press right bumper to put the the drone in offboard mode
|
| 106 |
+
Press right trigger to arm the drone
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
How to set up autonomous exploration*
|
| 111 |
+
|
| 112 |
+
git clone git@github.com:ksommerkohrt/frontier_exploration_maze.git
|
| 113 |
+
cd ~/frontier_exploration_maze
|
| 114 |
+
colcon build
|
| 115 |
+
|
| 116 |
+
After you launch the robot and prepare it to accept nav2 goals in one terminal open another and run:
|
| 117 |
+
source install/setup.bash
|
| 118 |
+
ros2 launch frontier_exploration classical_exploration.launch.py
|
| 119 |
+
|
| 120 |
+
*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
|
| 121 |
+
|
| 122 |
+
How to create map
|
| 123 |
+
Once your robot has completed the maze in a new terminal run:
|
| 124 |
+
ros2 run nav2_map_server map_saver_cli -f ~/cognipilot/cranium/src/rdd2/rdd2_nav2/maps/maze
|
| 125 |
+
|
| 126 |
+
How to load your map and use it to navigate:
|
| 127 |
+
|
| 128 |
+
Go to cranium directory and build changes so the new world file is recognized
|
| 129 |
+
cd ~/cognipilot/cranium
|
| 130 |
+
colcon build --symlink-install
|
| 131 |
+
|
| 132 |
+
cd ~/cognipilot/ws/cerebri
|
| 133 |
+
git pull
|
| 134 |
+
rm -rf install
|
| 135 |
+
west update
|
| 136 |
+
west build -t install
|
| 137 |
+
ros2 launch rdd2_gz_bringup sil.launch.py nav2:=true localization:=localization rviz:=true world:=maze
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|