0
0
Drone Programmingprogramming~10 mins

ArduPilot SITL setup in Drone Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the SITL simulator with the default plane model.

Drone Programming
import dronekit_sitl
sitl = dronekit_sitl.start_default([1])
Drag options to blanks, or click blank then click option'
Amodel='rover'
Bmodel='copter'
Cmodel='plane'
Dmodel='submarine'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong model name like 'copter' or 'rover' when starting the plane simulator.
2fill in blank
medium

Complete the code to connect to the SITL instance using the correct connection string.

Drone Programming
from dronekit import connect
connection_string = '[1]'
vehicle = connect(connection_string, wait_ready=True)
Drag options to blanks, or click blank then click option'
A'udp:127.0.0.1:14550'
B'tcp:127.0.0.1:5760'
C'serial:/dev/ttyUSB0:57600'
D'udp:192.168.1.1:14550'
Attempts:
3 left
💡 Hint
Common Mistakes
Using TCP instead of UDP for SITL connection.
Using wrong IP address or port.
3fill in blank
hard

Fix the error in the code to properly stop the SITL simulator.

Drone Programming
sitl = dronekit_sitl.start_default()
# some code
sitl.[1]()
Drag options to blanks, or click blank then click option'
Ashutdown
Bstop
Cclose
Dterminate
Attempts:
3 left
💡 Hint
Common Mistakes
Using shutdown() or terminate() which do not exist for SITL.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each waypoint index to its latitude if latitude is greater than 0.

Drone Programming
waypoint_dict = {i: wp[1] for i, wp in enumerate(waypoints) if wp[2] 0}
Drag options to blanks, or click blank then click option'
A.lat
B>
C<
D.lon
Attempts:
3 left
💡 Hint
Common Mistakes
Using longitude instead of latitude.
Using less than instead of greater than.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps the uppercase waypoint name to its altitude if altitude is above 10.

Drone Programming
altitude_map = [1]: [2] for wp in waypoints if wp.altitude [3] 10}
Drag options to blanks, or click blank then click option'
Awp.name.upper()
Bwp.altitude
C>
Dwp.name.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase names instead of uppercase.
Using less than or equal to instead of greater than.