Block Documentation
version 4.4.1 (Changelog)
Flight Commands
takeoff
Block
Code
drone. takeoff()Description
This functions makes the drone take off. CoDrone EDU takes off at an average height of 80 centimeters off the ground. A takeoff block must be used before any other flight command or flight movement. NOTE: The takeoff height cannot be modified.
Parameters
None
Returns
None
Example
land
Block
Code
drone. land()Description
This function makes the drone land by throttling down safely.
Parameters
None
Returns
None
Example
hover
Block
Code
drone. hover()Description
This function makes the drone hover in place for a duration in seconds.
Parameters
integer duration: the duration of the hover in seconds
Returns
None
Example
go [direction] for [seconds] seconds at [power] % power
Block
Code
drone. go()Description
This function flies the drone in a direction for a given duration and a power percentage.
Parameters
direction: forward, backward, up, down, left, right
integer duration: the duration of movement, in seconds
integer power: the power/speed of drone between 0 and 100
Returns
None
Example
go [direction] [distance] [units]
Block
Code
forward: drone.move_forward()
backward: drone.move_backward()
left: drone.move_left()
right: drone.move_right()
Description
This function flies the drone in a direction for a given distance. The units of the distance can be modified. NOTE: This block may require a "wait" block to prevent skipping the movement command.
Parameters
direction: forward, backward, up, down, left, right
float distance: the distance traveled
units: the units of the distance traveled
Returns
None
Example
go to coordinate (x, y, z) = ([x], [y], [z]) m
Block
Code
drone. send_absolute_position()Description
This function flies the drone to a given coordinate/position relative to its position before its first takeoff of the code execution.
Parameters
float x position: The desired x-position that the drone will fly to
float y position: The desired y-position that the drone will fly to
float z position: The desired z-position that the drone will fly to
Returns
None
Example
turn [direction] [degrees] degrees
Block
Code
left: drone.turn_left()
right: drone.turn_right()
Description
Turns right or left relative to the drone's current heading.
Parameters
integer degrees: angle of the turn between 0 and 180
Returns
None
Example
turn [direction] for [seconds] seconds at [power]% power
Block
Code
left:
drone.drone.set_roll(0)
drone.drone.set_pitch(0)
drone.drone.set_yaw(power)
drone.drone.set_throttle(0)
drone.drone.move(duration)
right:
drone.drone.set_roll(0)
drone.drone.set_pitch(0)
drone.drone.set_yaw(power)
drone.drone.set_throttle(0)
drone.drone.move(duration)
Description
Turns CoDrone EDU to the left or to the right for a duration in seconds at a percentange of power.
Parameters
direction: left, right
integer duration: the duration of the movement, in seconds
integer power: the power/speed of the drone between 0 and 100
Returns
None
Example
turn to heading [degrees]°
Block
Code
drone. turn_degree()Description
Turns right or left to a specified heading, in degrees, with respect to drone's initial heading. The initial heading is defined by the heading right after takeoff. The function will calculate the shortest path to the specified heading and turn in that direction.
Parameters
integer degree: angle of turn, in degrees. This function allows values more than 360, but the drone will not do more than a full rotation. To go to degree=450, it will not calculate the difference from starting heading (0) and turn for 1.25 revolutions. It will calculate the equivalent angle (90) and take the shortest rotation.
Returns
None
Example
set_[RPYT] to [power]%
Block
Code
drone. set_roll()drone. set_pitch()
drone. set_yaw()
drone. set_throttle()