Initialising drone object with Drone IP
and Port
as arguements. If nothing is given as arguement, the default values defined in pluto.py
are used.
client = Drone("192.168.4.1","23")
For connecting the drone, initialise an object of class pluto and call
client.connect()
To disconnect the drone
client.disconnect()
For arming and disarming the drone, use the following functions
client.arm() # arm the drone
client.disarm() # disarm the drone
client.takeoff() # take off
client.land() # land
To perform a backflip.
client.flip()
The drone can be steered in a particular direction by setting the values of throttle, pitch, roll and yaw. ( range of values is from : -600 to 600)
client.roll_speed(100,duration=2) #A roll of 100 for 2 seconds
client.pitch_speed(100,duration=2) #A pitch of 100 for 2 seconds
client.throttle_speed(100,duration=2) #A throttle of 100 for 2 seconds
client.yaw_speed(100,duration=2) #A yaw of 100 for 2 seconds
To send all values at once
# roll,pitch,throttle,yaw of value 100 each for 2 seconds
client.set_all_speed(100,100,100,100,duration=2)
To reset the drone commands to the intial values, call
client.reset_speed()
To balance the drift in drone at central values of Roll, Pitch,Throttle, Yaw
, the trim function
client.trim(5,-5,0,0)
The argument format is
(roll, pitch, throttle, yaw)
The sign of values should be opposite to which the drift is observed.
For Roll: right hand side -> positive
For Pitch: forward -> positive
For Throttle: upwards -> positive
For Yaw: Clockwise -> positive
To receive data from the drone, the following functions can be called:
client.get_height() #Returns height of the drone
client.get_vario() #Returns the rate of change of height
client.get_roll() #Returns the value of roll of the drone
client.get_pitch() #Returns the value of pitch of the drone
client.get_yaw() #Returns the value of yaw of the drone
client.acc_x() #Returns the value of accelerometer(x-axis) of the drone
client.acc_y() #Returns the value of accelerometer(y-axis) of the drone
client.acc_z() #Returns the value of accelerometer(z-axis) of the drone
client.get_gyro_x() #Returns the value of gyrometer(x-axis) of the drone
client.get_gyro_y() #Returns the value of gyrometer(y-axis) of the drone
client.get_gyro_z() #Returns the value of gyrometer(z-axis) of the drone
client.get_mag_x() #Returns the value of magnetometer(x-axis) of the drone
client.get_mag_y() #Returns the value of magnetometer(y-axis) of the drone
client.get_mag_z() #Returns the value of magnetometer(z-axis) of the drone
client.get_battery() #Returns the value of battery of the drone in volts