Contain motor module with related structures and functions. More...
Data Structures | |
struct | rxMotor_t |
structure with received values from motor interface More... | |
Typedefs | |
typedef enum motorstatus | status_t |
Status values returned in reply from command sent to motor interface. More... | |
Enumerations | |
enum | motorstatus { SUCCESS = 100, LOADED_IN_EEPROM, WRONG_CHECKSUM = 1, INVALID_COMMAND, WRONG_TYPE, INVALID_VALUE, EEPROM_LOCKED, CMD_UNAVAILABLE } |
Status values returned in reply from command sent to motor interface. More... | |
Functions | |
void | motorUp (void) |
Vehicle float up towards the surface - Move piston down. More... | |
void | motorDown () |
More... | |
void | motorStop () |
More... | |
void | enablePistonBottomLimit () |
More... | |
void | enablePistonTopLimit () |
void | sendCmd (uint8_t, uint8_t, uint8_t, uint8_t, long) |
Send command to motor controller interface. More... | |
void | receiveReply (uint8_t motorReply[]) |
More... | |
void | setPistonPosition () |
More... | |
void | setReferencePositionToZero () |
More... | |
float | getPistonPosition () |
More... | |
float | getMotorSpeed () |
More... | |
void | motorEnableLimitSwitches () |
More... | |
void | MotorTest () |
More... | |
void | motorInit () |
More... | |
float | getAxisParameterValue (uint8_t parameter) |
More... | |
float | getMotorEEPROMValue (uint8_t parameter) |
More... | |
float | getMotorFirmwareVersion () |
More... | |
void | stopMotorAtSurface () |
More... | |
void | setSurfaceReferencePoint () |
More... | |
void | receiveReply (uint8_t *) |
Receive reply message from motor controller interface. More... | |
Variables | |
rxMotor_t | rxMotor = {0} |
Reply message instance. More... | |
mission_t | mission |
Create mission struct instance. More... | |
Contain motor module with related structures and functions.
typedef enum motorstatus status_t |
Status values returned in reply from command sent to motor interface.
enum motorstatus |
void enablePistonBottomLimit | ( | ) |
void enablePistonTopLimit | ( | ) |
float getAxisParameterValue | ( | uint8_t | ) |
Read axis paramter value.
[in] | parameter | axis parameter from which to read its value |
float getMotorEEPROMValue | ( | uint8_t | ) |
Read EEPROM value.
[in] | parameter | axis parameter from which to read its EEPROM value |
float getMotorFirmwareVersion | ( | void | ) |
Read Firmware version value.
float getMotorSpeed | ( | void | ) |
request motor speed - internal value [-2048, 2048]
float getPistonPosition | ( | void | ) |
request piston position
void motorDown | ( | ) |
Vehicle dive deeper away from the surface - Move piston up.
void motorEnableLimitSwitches | ( | void | ) |
Enable limit switches.
void motorInit | ( | void | ) |
Initialize and configure motor.
Enable limit switches, and set configuration data
< Set max current -max motor power- (0-255).
< Set standby current (0-255) * [4/255 A].
< Set power-down delay to enter standby current (1-65535) * [10 msec].
< Set time for which the motor current is cut off after velocity reaches zero (0 - 65535) [10 msec] 0 means never.
< Set max positioning speed (integer) [1 - 2047].
< Set max speed in velocity mode (integer) [1 - 2047].
< Set pulse divisor to 1 - make sure to not exeed physical limits.
void motorStop | ( | ) |
stop motor
void MotorTest | ( | void | ) |
Test motor.
Enable limit switches, run motor (piston) down for 2 sec, stop, run motor (piston) up for 2 sec, stop.
void motorUp | ( | ) |
Vehicle float up towards the surface - Move piston down.
void receiveReply | ( | uint8_t * | ) |
Receive reply message from motor controller interface.
The function is called by uart_handler if checksum is correct. The data is stored in rxMotor.
[in] | motorReply | data array with received data from uart handler. |
void receiveReply | ( | uint8_t | motorReply[] | ) |
Send command to motor controller interface.
[in] | addr | Module address |
[in] | Cmd | Command to be executed |
[in] | Type | Command type number |
[in] | motor | Motor or bank number |
[in] | value | Value to be written in case requested by command - MSB first |
void setPistonPosition | ( | void | ) |
Move piston to a specific position between 0.0 mm and 55.0 mm.
Move piston to a specific position between 0.0 mm and 55.0 mm. 1 mm linear movement = 51200 (256∗200) MVP estimated MVP range : −2816000.0 (51200∗−55) (5.5 cm) to 0 (0.0 cm) The piston will stop when en limit switch is reached
void setReferencePositionToZero | ( | void | ) |
Set motor position counter to zero.
set position counter to 0, to define reference at surface.
void setSurfaceReferencePoint | ( | void | ) |
Set surface reference point to zero.
Move piston position all the way to the bottom (maximum volum, minimum density). When bottom limit switch is triggered, set reference point to zero in order to define surface level. This is done to make sure vehicle float to surface, even in case of system reset.
< To clear limit switch before re-trigger
void stopMotorAtSurface | ( | void | ) |
Stop motor when surface is reached.
To make motor is powered down to standby current the motor is manualy stopped when bottom limit switch is triggered, unless running mission.
mission_t mission |
Create mission struct instance.
rxMotor_t rxMotor = {0} |
Reply message instance.