The following is a constantly updating question and answer page with common questions posed by students regarding this project. Please check if your question is answered here before seeking other solutions.
- 1. How do I make a mission?
- 2. What is the objective of the mission?
- 3. How do I read LiDAR returns from code?
- 4. What is the field of view (FoV) of the LiDAR?
- 5. What are the intensity returns from the LiDAR?
- 6. How do I tell the drone to go in a specific direction?
- 7. What is the competition terrain like?
- 8. What are the kinematic capabilities of the drone we are flying?
- 9. What is contour flight?
- 10. How will my team be scored?
- 11. How do I generate the scored metrics?
The objective for you is to write an altitude selection algorithm, while the rest of the mission logistics are handled for you. To get started, use the template mission using the mission construct or the template mission using the goto_location construct.
If you already have something that's working or would prefer to work something out from scratch, you are welcome to continue using that as it will help with your creativity score.
The mission is written using Python and asyncronous calls to the MAVSDK library. Missions are constructed as API calls for the drone to start up, takeoff, complete mission, and land. For examples, check out the MAVSDK examples.
The objective of the mission is to go from start to finish following the AGL value as closely as possible as fast as possible.
Below are the pertitent values to your mission (relative to the origin of the terrain):
- Start (in meters x, y, z): [0, 0, 0]
- This is where the drone is spawned automatically by PX4
- Finish (in meters x, y, z): [38, 0, 1]
- Target AGL: 3 m
NOTE: The AGL tracker plug in will spawn the drone at [0, 0, 0]. If you don't have the AGL tracker setup correctly, PX4 will start your drone slightly offset, which is not correct.
Gazebo is the software that handles the sensor simulation and is the software that publishes the returns. The internal structure of the communication is implemented using Protocol Buffers and you can listen for the messages using external software. This is what Py3Gazebo is for in our case.
If you have successfully installed Py3Gazebo, you should be able to run the file tutorial/demos/demo_lidar_read.py, which will print out LiDAR readings every 5 seconds for 20 seconds total. You must have PX4 and Gazebo running with the LiDAR model enabled.
To test your knowledge and understanding, please read along the LaserScan tutorial and help make it complete. By the end of the tutorial you should be more familiar with:
- Checking and acquiring more information on the published data from Gazebo
- Looking at a "snapshot" from the published data from Gazebo
- The structure of the 'LaserScan' topic
- Iterating through the known output of our 'LaserScan' topic
The LiDAR ranges are returned in a flattened 1D array that has the 20 horizontal ranges superimposed on each other ([v1h1 .. v20h1 v1h2 .. v20h2 v1h3 .. v20h3 ...]
). The returns are ordered minimum to maximum based on the FoV ranges reported in the LaserScan message. The top vertical ray corresponds to 0 deg, while the one looking straight down corresponds to -90 deg. Similarly, the right half of horizontal returns is negative degrees, the left half is positive degress, and the middle is 0 degs.
Teams should experiment reading the LiDAR while Gazebo is running to convince themselves that they understand the order of the returned ranges.
This LiDAR's FoV is defined as
- Horizontal: -30 to 30 degs, 3 deg increments, 0 degs points directly in front of vehicle
- Vertical: -90 to 0 degs, 10 deg increments, 0 degs points directly in front of vehicle, -90 degs points directly down
- Range: 0.2 m to 10 m, with infinity indicating an unreturned ray
For further information, check out the LiDAR definition in the models/lidar/model.sdf file, within the <ray>
element.
A typical LiDAR returns an intensity value, which is a measure of the intensity of the returned beam. This means that this return measures the reflectivity of the surface to the wavelength of the beams cast by the LiDAR.
This value is irrelevant for the purposes of this competition.
You can tell the drone to go to a specific location by appending a mission item with the desired location to the mission and uploading the mission to the drone (as in the mission example), or you can use the drone.action.goto_location
command (as in the goto example). Note that the goto_location
command does not block while executing and you will not know from code when you have reached the waypoint unless you also monitor your position.
Specifying locations, as opposed to directions of flight, is the preferred way of commanding the drone for this competition.
For more examples, check out the MAVSDK examples.
The competition terrain is a wavy structure with active area dimensions of 40x40 m and a maximum height of 5 m. The terrain is positioned at 0 deg N, 0 deg W, at 0 m altitude. If you don't find that's the case for you, make sure you run source set_home.sh
in the terminal before launching Gazebo and PX4.
The terrain definition is located in worlds/models/terrain2d/model.sdf if you seek further information.
NOTE: The heights in the terrain are defined by a heightmap. If the terrain you are working with does not match what is defined by the heightmap, make sure that you have pulled from this git repository and ran the setup script again. The terrain heightmap looks like this (black = 0m, white = 5m):
The drone has a default set of parameters with default values.
The following are pertinent to this competition:
- Max horizontal velocity: 12 m/s
- Max ascent velocity: 3 m/s
- Max descent velocity: 1 m/s
Countour flight is a type of terrain flight, where the aircraft is flying near terrain in order perform surveillance, survey, avoid detection or other reasons. In addition to contour flight, terrain flight also includes low-level flight, and Nap of the Earth (NOE) flight. The following is a brief explanation of each type, in decreasing order of distance to the ground and increasing order of pilot workload.
- Low-level flight: flight low to the ground where the aircraft is holding a steady airspeed and altitude
- Contour flight: constant airspeed flight that flies close to the ground and varies altitude to match the terrain
- Nap of the Earth: flight that attempts to stay extremely close to the ground by varying both airspeed and altitude to match the terrain relief
Your goal is to implement contour flight, so you will have to maneuver the drone to follow the terrain relief, but try to maintain a constant airspeed.
The altitudes at which these modes of flight are performed is dependent on vehicle capabilities, weather conditions, pilot workload, and any number of other conditions. For the purposes of this competition, you will perform your contour flight as close to the terrain as possible while not colliding with it.
For further reading on terrain flight, reference this article by the International Association of Natural Resource Pilots.
Teams will be ranked based on their performance in three areas: time, accuracy of AGL tracking, and a judge's score. A team's total score is determined by
The judges score will consist of (but is not limited to):
- Creativity
- Teamwork
- Presentation
- Customer satisfaction (e.g. reliability, testability, etc.)
The only metric that will be scored live is the judge's score. For the other two, teams will submit their times and averages as reported by the AGL tracker Gazebo plugin. Teams should follow the instructions in section How do I generate the scored metrics? for submitting these items.
For the presentation only, teams will also be required to create a video showcasing their strategy and results. This video will be shown during the team's presentation. The teams are free to structure their presentation as they see fit, but we recommend that teams use this reel to aid the team in showcasing their strategy and in talking about their development process. As such, this reel does not have to show the entire flight. This video will be uploaded to YouTube and the link will be submitted with the times and averages.
The competition will be derived by your best AGL performance which is ultimately dependent on your the motion planning algorithm to navigate the provided terrain.
First, to validate running PX4 we would like to view your trajectory via a log output of your terminal:
# Terminal #1: Inside PX4/PX4-Autopilot directory
make px4_sitl gazebo___terrain2d 2>&1 | tee team_name.txt
Where the output file should be changed from "team_name.txt" to something more logical and identifiable.
NOTE: To better gauge your vehicle's progress while the mission is running, you would need an extra terminal to monitor the output to the log:
# Terminal #2: Viewing only a select portion from the PX4 Output
# Inside PX4/PX4-Autopilot directory, this will highlight the Agl Tracker Plugin output
tail -f team_name.txt | grep "AGL"
To verify other attributes and the veracity of the code, we will be requesting that you submit an official Gazebo log as well.
We suggest using the GAZEBO GUI to record a log to whatever directory you want. This can be found on the top-right of the screen i.e. CTRL+D (Not record a VIDEO) and press the red 'record' twice, once to initiate, another time to end. By default, the logs are saved in your ~/.gazebo/log
directory by default, but you can change it by clicking Browse...
and selecting another directory.
Of course, on a third terminal, run your mission's python code
# Terminal 3: Run mission python code
python3 ./your/python/code
Finally, by running PX4 SITL with the proper 'AglTracker' Plugin you will find a '.csv' within your PX4 build directory that we will be using for the scoring template as well.
# Inside PX4/PX4-Autopilot directory
cd build/px4_sitl_default/tmp
NOTE: Please rename your .csv, to <team_name>
.csv
From all of the above, we will know your final score and final time! Thank you for everything!
If you wish to record from Ubuntu, perform the following terminal command in order to increase the timeout on screencapture.
gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 1800
To start the recording, press ctrl+shift+alt+R
. Press this key combo again to stop the recording. The video in .webm
format will be located in your Videos folder.
If you wish to screen record from a different operating system while in a remote terminal, please find instructions for MacOS and Windows10.
One member from each team will have to submit the following items by sending an email to momentum.scores@gmail.com. Format the email like this:
Subject: Team #: team_name
Body:
- AGL score
- Time score
- YouTube link to video reel if ready, or send separately NLT 8PM 27 JAN
Attached (replace <team_name>
with your actual team name or team number):
- Log of prints output from plugin, renamed to the format
<team_name>.txt
- Information about your drone's path, renamed to the format
<team_name>.csv
- Gazebo log, renamed to the format
<team_name>.log