Buoyancy Firmware  1.0
Buoyancy Vehicle Firmware Documentation
motor program file

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...
 

Detailed Description

Contain motor module with related structures and functions.

Typedef Documentation

◆ status_t

typedef enum motorstatus status_t

Status values returned in reply from command sent to motor interface.

Enumeration Type Documentation

◆ motorstatus

Status values returned in reply from command sent to motor interface.

Enumerator
SUCCESS 
LOADED_IN_EEPROM 
WRONG_CHECKSUM 
INVALID_COMMAND 
WRONG_TYPE 
INVALID_VALUE 
EEPROM_LOCKED 
CMD_UNAVAILABLE 

Function Documentation

◆ enablePistonBottomLimit()

void enablePistonBottomLimit ( )

◆ enablePistonTopLimit()

void enablePistonTopLimit ( )

◆ getAxisParameterValue()

float getAxisParameterValue ( uint8_t  )

Read axis paramter value.

Parameters
[in]parameteraxis parameter from which to read its value
Returns
value received axis parameter value

◆ getMotorEEPROMValue()

float getMotorEEPROMValue ( uint8_t  )

Read EEPROM value.

Parameters
[in]parameteraxis parameter from which to read its EEPROM value
Returns
value received EEPROM value

◆ getMotorFirmwareVersion()

float getMotorFirmwareVersion ( void  )

Read Firmware version value.

Returns
value received Firmware version value in binary form

◆ getMotorSpeed()

float getMotorSpeed ( void  )

request motor speed - internal value [-2048, 2048]

Returns
value motor speed measured in internal value [-2048, 2048]

◆ getPistonPosition()

float getPistonPosition ( void  )

request piston position

Returns
value Calculated piston position based on position counter value received from motor controller interface

◆ motorDown()

void motorDown ( )

Vehicle dive deeper away from the surface - Move piston up.

◆ motorEnableLimitSwitches()

void motorEnableLimitSwitches ( void  )

Enable limit switches.

Attention
important to enable limit switchesd before motor is operated to avoid damages
Warning
if motor is running without limit switches enabled it may hit the switch, break it, and even break the vehcile it self

◆ motorInit()

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.

◆ motorStop()

void motorStop ( )

stop motor

◆ MotorTest()

void MotorTest ( void  )

Test motor.

Enable limit switches, run motor (piston) down for 2 sec, stop, run motor (piston) up for 2 sec, stop.

◆ motorUp()

void motorUp ( )

Vehicle float up towards the surface - Move piston down.

◆ receiveReply() [1/2]

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.

Parameters
[in]motorReplydata array with received data from uart handler.

◆ receiveReply() [2/2]

void receiveReply ( uint8_t  motorReply[])

◆ sendCmd()

void sendCmd ( uint8_t  ,
uint8_t  ,
uint8_t  ,
uint8_t  ,
long   
)

Send command to motor controller interface.

Parameters
[in]addrModule address
[in]CmdCommand to be executed
[in]TypeCommand type number
[in]motorMotor or bank number
[in]valueValue to be written in case requested by command - MSB first

◆ setPistonPosition()

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

◆ setReferencePositionToZero()

void setReferencePositionToZero ( void  )

Set motor position counter to zero.

set position counter to 0, to define reference at surface.

◆ setSurfaceReferencePoint()

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

◆ stopMotorAtSurface()

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.

Variable Documentation

◆ mission

mission_t mission

Create mission struct instance.

◆ rxMotor

rxMotor_t rxMotor = {0}

Reply message instance.