Methods used to more easily interface with RMS Motor controllers over CAN bus.
More...
|
|
void | setup (void) |
| | Initialize MC heartbeat function and clear faults, if any.
|
| |
|
void | setupBuffers (void) |
| | Only initialize MC buffers, called by MC::setup.
|
| |
|
void | clearFaults (void) |
| | Clear MC faults by sending a clear fault command.
|
| |
| void | enableMotorBeating (bool enable) |
| | Start MC heartbeat function, establishing a connection with the MCs.
|
| |
| void | sendTorque (uint32_t MC_ADD, int torque, bool direction, bool enableBit) |
| | Send a raw torque command to a MC.
|
| |
| void | setDirection (bool runForward) |
| | Set the direction of the motors.
|
| |
| bool | isForward (void) |
| | Get whether the motors will spin forward.
|
| |
| int | getLastTorqueValue (bool mc0) |
| | Get the last torque percent value sent to a MC.
|
| |
| int | getLastPedalValue (void) |
| | Get the last pedal value that was internally used.
|
| |
| int | getLastBrakeValue () |
| | Get the last brake value that was internally used.
|
| |
| int | getLastSteerValue () |
| | Get the last steer value that was internally used.
|
| |
| int32_t | motorSpeed (int motor=-1) |
| | Get the avg motorspeed.
|
| |
| void | setTorque (int pedal, int brake, int steer) |
| | Calculate and set the torque of both MCs.
|
| |
Methods used to more easily interface with RMS Motor controllers over CAN bus.
◆ enableMotorBeating()
| void MC::enableMotorBeating |
( |
bool |
enable | ) |
|
Start MC heartbeat function, establishing a connection with the MCs.
- Parameters
-
◆ getLastBrakeValue()
| int MC::getLastBrakeValue |
( |
| ) |
|
Get the last brake value that was internally used.
- Returns
- int the last brake value that was internally used
◆ getLastPedalValue()
| int MC::getLastPedalValue |
( |
void |
| ) |
|
Get the last pedal value that was internally used.
- Returns
- int the last pedal value that was internally used
◆ getLastSteerValue()
| int MC::getLastSteerValue |
( |
| ) |
|
Get the last steer value that was internally used.
- Returns
- int the last steer value that was internally used
◆ getLastTorqueValue()
| int MC::getLastTorqueValue |
( |
bool |
mc0 | ) |
|
Get the last torque percent value sent to a MC.
- Parameters
-
| mc0 | return the value for MC0, otherwise MC1 |
- Returns
- int the last torque percent value that was sent
◆ isForward()
| bool MC::isForward |
( |
void |
| ) |
|
Get whether the motors will spin forward.
- Returns
- true The motors will spin forward
-
false The motors will spin in reverse
◆ motorSpeed()
| int32_t MC::motorSpeed |
( |
int |
motor = -1 | ) |
|
Get the avg motorspeed.
- Parameters
-
| motor | 0 or 1 for either motor or nothing for |
- Returns
- int32_t
◆ sendTorque()
| void MC::sendTorque |
( |
uint32_t |
MC_ADD, |
|
|
int |
torque, |
|
|
bool |
direction, |
|
|
bool |
enableBit |
|
) |
| |
Send a raw torque command to a MC.
- Note
enableMotorBeating must have been set to false before calling this function
- Parameters
-
| MC_ADD | The specific motor controller address |
| torque | The torque to set the motor at |
| direction | direction of the motor |
| enableBit | whether the motor should be enabled |
◆ setDirection()
| void MC::setDirection |
( |
bool |
runForward | ) |
|
Set the direction of the motors.
- Parameters
-
| runForward | whether the motors should spin forwards |
◆ setTorque()
| void MC::setTorque |
( |
int |
pedal, |
|
|
int |
brake, |
|
|
int |
steer |
|
) |
| |
Calculate and set the torque of both MCs.
- Note
enableMotorBeating must have been set to false before calling this function
- Parameters
-
| pedal | The raw value of the pedal |
| brake | The raw value of the brake |
| steer | The raw value of the steering wheel |