PlatformInterface¶
Interface¶
The PlatformInterface is an interface to the hardware abstraction module running on a platform. It allows access to hardware features such as digital inputs / outputs, analog inputs, power relays and the LCD.
Most functions require a special permission, see pilot.permission_e.
Functions¶
Charging Functions¶
-
void
charge
()¶ Attempts to charge the platform’s batteries when connected to a charging station. Will return upon completion of charging process. In case of an error (such as no contact to the charging station) an exception will be thrown. Requires permission
CHARGE
.
-
void
start_charging
()¶ Attempts to start the charging process at a charging station. Returns immediately in case of success, or throws an exception. Requires permission
CHARGE
.
-
void
stop_charging
()¶ Stops the charging process at a charging station. Returns immediately in case of success, or throws an exception. Requires permission
CHARGE
.
Input / Output Functions¶
-
void
set_relay
(int channel, bool state)¶ Switch a relay on or off, depending on
state
.channel
is an index from 0 to 3 (in most cases) denoting the relay to switch. Requires permissionRELAY_CONTROL
.
-
void
set_digital_output
(int channel, bool state)¶ Switches a digital output to the specified
state
.channel
is an index from 0 to 15 (in most cases) denoting the output pin. Requires permissionRELAY_CONTROL
as well as an installed IOBoard.
-
void
set_display_text
(string line)¶ Sets the first line on the LCD to the given text, for the next 30 seconds. Requires permission
DISPLAY_CONTROL
.
-
float
read_analog_input
(int channel)¶ Reads the voltage of an analog input in [V].
-
bool
read_digital_input
(int channel)¶ Reads the state of a digital input.
-
void
wait_for_digital_input
(int channel, bool state)¶ Waits for a digitial input to reach the specified
state
. If it’s already reached will return immediately.channel
is an index from 0 to 15 (in most cases) denoting the input pin. Requires permissionCONST_REQUEST
as well as an installed IOBoard.
Other Functions¶
-
void
shutdown
()¶ Will terminate the process, shutdown the machine and turn off the platform. Cannot be undone except by turning on the platform by hand again. Requires permission
SHUTDOWN_HOST
, see vnx.permission_e.