Skip to main content

Python User API

This section presents a set of user-defined functions implemented in Python.

Functions

gyroGetRaw(self, waitingTime : float = 2.0)

Returns a list of angular velocity sensor values(x, y, z) from OrbiCraft 3D telemetry, or an empty list if the message timeout has been exceeded.

waitingTime : float - waiting time for telemetry (by default 2 seconds)

gyroRequestRaw(self, waitingTime : float = 2.0)

Requests regular carrier telemetry and returns a list of DUS values (x, y, z) or an empty list if the message timeout has been exceeded. Telemetry is received at the rate of requests.

waitingTime : float - waiting time for telemetry (by default 2 seconds)

gyroSetOffset(self, x : float, y : float, z : float, waitingMsgid : float = 2.0)

Sets the zero offset for the DUS. Returns True on success, otherwise False if the ACK timeout has been exceeded.

  • x : float - zero offset x;
  • y : float - zero offset y;
  • z : float - zero offset z;

waitingTime : float - response waiting time (2 seconds by default).

magGyroSetTelemetryPeriod(self, period : int, waitingTime : float = 2.0)

Sets the period for regular telemetry of the magnetometer and DUS. Returns True on success, otherwise False if the ACK timeout has been exceeded.

waitingTime : float - response waiting time (default is 2 seconds)

magGetRaw(self, waitingTime : float = 2.0)

Returns a list of magnetometer values (x, y, z) from OrbiCraft 3D telemetry, or an empty list if the message timeout has been exceeded.

waitingTime : float - response waiting time (default is 2 seconds)

cpp magRequestRaw(self, waitingTime : float = 2.0) Requests regular carrier telemetry and returns a list of magnetometer values (x, y, z) or an empty list if the message timeout has been exceeded. Telemetry is received at the rate of requests.

waitingTime : float - response waiting time (default is 2 seconds)

magSetOffset(self, x : int, y : int, z : int, waitingTime : float = 2.0)

Sets the offset for the magnetometer. Each value must be divided by 14 before sending the command. Returns True on success, otherwise False if the ACK timeout has been exceeded.

  • x : float - zero offset x;
  • y : float - zero offset y;
  • z : float - zero offset z;

waitingTime : float - response waiting time (default is 2 seconds)

motorGetSpeed(self, motorAddr : str, waitingTime : float = 2.0)

Returns the angular velocity of the specified flywheel from OrbiCraft 3D telemetry or None if the message timeout has been exceeded.

motorAddr : str - address of the flywheel ('0xA', '0xB' ..)

waitingTime : float - response waiting time (default is 2 seconds)

motorGetTorque(self, motorAddr : str, waitingTime : float = 2.0)

Returns the torque of the specified flywheel from OrbiCraft 3D telemetry or None if the message timeout has been exceeded.

motorAddr : str - address of the flywheel ('0xA', '0xB' ..)

waitingTime : float - response waiting time (default is 2 seconds)

motorSetSpeed(self, motorAddr : str, speed : float, waitingTime : float = 2.0)

Sets the angular velocity of the flywheel. Returns True on success, otherwise False if the ACK timeout has been exceeded.

motorAddr : str - address of the flywheel ('0xA', '0xB' ..)

speed : float - flywheel speed in rpm

waitingTime : float - response waiting time (default is 2 seconds)

motorSetTorque(self, motorAddr : str, torque : float, time : int, waitingTime : float = 2.0)

Sets the torque for the selected flywheel. Returns True on success, otherwise False if the ACK timeout has been exceeded.

motorAddr : str - address of the flywheel ('0xA', '0xB' ..)

torque : float - torque

time : int - application time of the moment

waitingTime : float - response waiting time (default is 2 seconds)

motorSetTelemetryPeriod(self, motorAddr : str, period : int, waitingTime : float = 2.0)

Sets the telemetry period for the specified flywheel. Returns True on success, otherwise False if the ACK timeout has been exceeded.

motorAddr : str - address of the flywheel ('0xA', '0xB' ..)

period : int - telemetry period in ms

waitingTime : float - response waiting time (default is 2 seconds)

motorSetPeriodAll(self, period : int, waitingTime : float = 2.0)

Sets the telemetry period for flywheels with addresses 0xA, 0xB and 0xC. Returns True on success, otherwise False if the waiting time for ACK messages has been exceeded.

period : int - telemetry period in ms (50..5000)

waitingTime : float - message waiting time for each flywheel (default 2 sec)

sunSensorGetRaw(self, sensorAddr : str, waitingTime : float = 2.0)

Returns a list of 3 components (x, y, z) of the vector pointing to the sun from the selected solar sensor, or an empty list if the message timeout is exceeded. To get the normalized component of the vector, you need x_norm = x / sqrt(x^2 + y^2 + z^2).

sensorAddr : str - address of the solar sensor ('0x10', '0x11', ..)

waitingTime : float - response waiting time (default is 2 seconds)

sunSensorGetDeltaPhi(self, sensorAddr : str, waitingTime : float = 2.0)

Returns a list with Delta and Phi angles from the selected solar sensor from OrbiCraft 3D telemetry, or an empty list if the telemetry timeout was exceeded or the data from the sensor came with a non-validity flag. Delta is the angle between the normal to the solar sensor and the vector directed at the sun. Phi is the angle of rotation around the normal to the solar sensor.

sensorAddr : str - address of the solar sensor ('0x10', '0x11', ..)

waitingTime : float - response waiting time (default is 2 seconds)

sunSensorsSetTelemetryPeriod(self, sensorAddr : str, period : int, waitingTime : float = 2.0)

Sets the telemetry period for the specified solar sensor. Returns True on success, otherwise False if the waiting time for ACK messages has been exceeded.

sensorAddr : str - sensor address ('0x10', ...)

period : int - period in ms

waitingTime : float - response waiting time (default is 2 seconds)

sunSensorsSetPeriodAll(self, period : int, waitingTime : float = 2.0)

Sets the telemetry period for all solar sensors. Returns True on success, otherwise False if the waiting time for ACK messages has been exceeded.

period : int - period in ms

waitingTime : float - response waiting time (default is 2 seconds)

cameraTakePhoto(self, angle : int)

Take a photo on a raspberry camera. Returns True on success, otherwise False.

angle : int - Camera rotation (0, 90, 180, 270), hail

receiveMsg(self, msgid : str, addrFrom : str, waitingTime=2.0)

A message is waiting. If the message is accepted during the time, waitingTime returns the received message, otherwise None.

msgid : str - id of the expected message

addrFrom : str is the address of the sender's device (waiting for a response) in the format '0xF'

waitingTime : float - message waiting time

receiveMsgs(self, waitingMsgids, addrFrom : str, waitingTime=2.0)

Waiting for a message. If messages are accepted during the time, waitingTime returns a list of received messages in the order of the waitingMsgids list, otherwise an empty list.

waitingMsgids - list of expected messages in hex format ('0xB10')

addrFrom : str is the address of the sender's device(waiting for a response) in hex format('0xF')

waitingTime : float - message waiting time

sendMsgAndWaitAnswer(self, msgidToSend: str, addrFrom: str , addrTo: str, length: int, data, waitingMsgid: str, waitingTime=2.0)

Send a message and expect one message in response. If messages are accepted during the time, waitingTime returns a message with waitingMsgid, otherwise None.

msgidToSend : str - id of the message to send

addrFrom : str - sender's address in hex format ('0xF')

addrTo : str - the recipient's address in hex format ('0xA')

length : int - the length of the data packet message in bytes

data - data package (bytearray)

waitingMsgid : str - id of the expected message

waitingTime : float - message waiting time

sendMsgAndWaitAnswers(self, msgidToSend: str, addrFrom: str , addrTo: str, length: int, data, waitingMsgids, waitingTime=2.0)

Send a message and expect one message in response. If messages are accepted during the waiting Time, it returns a message with the waitingMsgid, otherwise an empty list.

msgidToSend : str - id of the message to send

addrFrom : str - sender's address in hex format ('0xF')

addrTo : str - the recipient's address in hex format ('0xA')

length : int - the length of the data packet message in bytes

data - data package (bytearray)

**waiting Msgid - list of expected messages

**waiting Time : float - message waiting time

pushThumbsToTerra2(self, num: int)

Starts the transfer of all thumbs from OrbiCraft 3D to Terra Ground Control. Returns True on success, otherwise False.

num : int - the thumb number from which the transfer begins

pushPhotoToTerra2(self, num: int)

Starts the transfer of photos from OrbiCraft 3D to Terra Ground Control. Returns True on success, otherwise False.

num : int - photo number