control package

Submodules

control.commands module

class control.commands.Pluto(host='192.168.4.1', port=23)

Bases: object

An instance of this class can be used to interact with the drone. A connection is established with the drone when an instance of this class is created.

Optionally the host and port of the drone can be specified.

arm()

Arms the drone.

disarm()

Disarms the drone.

getAltitude()

Returns the altitude and vario of the drone.

getAnalog()

Returns the battery voltage, mAH drawn, RSSI and amperage of the drone.

land()

Sends instruction for landing.

rc(roll, pitch, throttle, yaw)

This function sends the roll, pitch, throttle and yaw values to the drone as a RC message.

takeoff()

Sends instruction for taking off.

control.connection module

class control.connection.Connection(host='192.168.4.1', port=23)

Bases: object

An instance of this class can be used to establish a connection with the pluto and send/receive data from it. This is a basic wrapper around the socket class.

Optionally the host and port of the drone can be specified.

connect()

Establishes a connection with the pluto.

disconnect()

Disconnects from the pluto.

receive()

Receives packets from the pluto. The packet is validated and the payload is returned.

send(data)

Sends data to the pluto.

control.packets module

control.packets.calculateChecksum(packet)

This function returns the checksum of a packet. A byte array of the packet should be passed as a parameter.

control.packets.createPacket(dir, cmd, data=[])

Creates a packet to be sent to the drone. Returns a properly structured packet which can be sent to the drone.

Parameters:
  • dir – The direction in which your message goes.

  • cmd – Command code.

  • data – Payload data sent to the drone.

control.poshold module

class control.poshold.PosHold(estimator, pos=[0, 0, 1], host='192.168.4.1')

Bases: object

An instance of this class can be used to hold the drone at the specified position (passed as a parameter). PID control is used which is implemented using the simple_pid package.

Parameters:
  • estimator – An instance of the posision estimator class.

  • pos – Position to be held.

  • host – IP Address of the drone.

hold(pos=[0, 0, 1], duration=10)
Parameters:
  • pos – The 3D coordinates at which the drone must be held.

  • duration – The duration in seconds for which the position must be held.

Module contents