|
MRMS
|
#include <mrm-robot.h>
Public Member Functions | |
| Robot (char name[15]=(char *)"MRMS robot", char ssid[15]=(char *)"MRMS", char wiFiPassword[15]=(char *)"mrms") | |
| void | actionAdd (ActionBase *action) |
| void | actionEnd () |
| bool | actionPreprocessing (bool andFinish=true) |
| void | actionPreprocessingEnd () |
| void | add (Board *aBoard) |
| virtual void | bitmapsSet ()=0 |
| void | blink () |
| void | bluetoothTest () |
| void | end () |
| void | canBusSniffToggle () |
| void | canIdChange () |
| void | colorIlluminationOff () |
| void | colorIlluminationOn () |
| void | colorPatternErase () |
| void | colorPatternPrint () |
| void | colorPatternRecognize () |
| void | colorPatternRecord () |
| void | delayMs (uint16_t pauseMs) |
| void | delayMicros (uint16_t pauseMicros) |
| uint8_t | devicesScan (bool verbose) |
| void | devicesStart (uint8_t measuringMode=0) |
| void | devicesStop () |
| void | errors () |
| void | firmwarePrint () |
| float | fpsGet () |
| void | fpsPrint () |
| virtual void | goAhead ()=0 |
| void | i2cTest () |
| void | info () |
| void | irFinder3Test () |
| void | irFinder3TestCalculated () |
| void | lidar2mTest () |
| void | lidar4mTest () |
| void | lidarCalibrate () |
| virtual void | loop ()=0 |
| void | menu () |
| void | menuColor () |
| void | menuMainAndIdle () |
| void | menuReflectance () |
| void | menuSystem () |
| void | messagePrint (CANBusMessage *msg, bool outbound) |
| void | messagesReceive () |
| void | motorTest () |
| void | nodeTest () |
| void | noLoopWithoutThis () |
| void | oscillatorTest () |
| void | reflectanceArrayCalibrationPrint () |
| void | run () |
| uint16_t | serialReadNumber (uint16_t timeoutFirst=3000, uint16_t timeoutBetween=500, bool onlySingleDigitInput=false, uint16_t limit=0xFFFE, bool printWarnings=true) |
| void | servoInteractive () |
| bool | setup (bool andFinish=true) |
| bool | sniffing () |
| void | stopAll () |
| bool | stressTest () |
| void | thermoTest () |
| bool | userBreak () |
| void | verboseToggle () |
Public Attributes | |
| Mrm_can_bus * | mrm_can_bus |
| Mrm_8x8a * | mrm_8x8a |
| Mrm_bldc2x50 * | mrm_bldc2x50 |
| Mrm_bldc4x2_5 * | mrm_bldc4x2_5 |
| Mrm_col_b * | mrm_col_b |
| Mrm_col_can * | mrm_col_can |
| Mrm_fet_can * | mrm_fet_can |
| Mrm_imu * | mrm_imu |
| Mrm_ir_finder3 * | mrm_ir_finder3 |
| Mrm_lid_can_b * | mrm_lid_can_b |
| Mrm_lid_can_b2 * | mrm_lid_can_b2 |
| Mrm_mot2x50 * | mrm_mot2x50 |
| Mrm_mot4x3_6can * | mrm_mot4x3_6can |
| Mrm_mot4x10 * | mrm_mot4x10 |
| Mrm_node * | mrm_node |
| Mrm_ref_can * | mrm_ref_can |
| Mrm_servo * | mrm_servo |
| Mrm_switch * | mrm_switch |
| Mrm_therm_b_can * | mrm_therm_b_can |
| Mrm_us_b * | mrm_us_b |
| Mrm_us1 * | mrm_us1 |
Protected Member Functions | |
| void | actionProcess () |
| void | actionSet () |
| void | actionSet (ActionBase *newAction) |
| uint8_t | boardsDisplayAll () |
| bool | boardDisplayAndSelect (uint8_t *selectedBoardIndex, uint8_t *selectedDeviceIndex, uint8_t *maxInput, uint8_t *lastBoardAndIndex) |
| bool | boardSelect (uint8_t selectedNumber, uint8_t *selectedBoardIndex, uint8_t *selectedDeviceIndex, uint8_t *maxInput) |
| void | fpsPause () |
| void | fpsUpdate () |
| void | fpsReset () |
| void | verbosePrint () |
| void | vprint (const char *fmt, va_list argp) |
Protected Attributes | |
| ActionBase * | _action [ACTIONS_LIMIT] |
| uint8_t | _actionNextFree = 0 |
| ActionBase * | _actionCANBusStress |
| ActionBase * | _actionCurrent |
| ActionBase * | _actionDoNothing |
| ActionBase * | _actionLoop |
| ActionBase * | _actionMenuMain |
| ActionBase * | _actionPrevious |
| ActionBase * | _actionStop |
| Board * | board [BOARDS_LIMIT] |
| uint8_t | _boardNextFree = 0 |
| uint8_t | _devicesAtStartup = 0 |
| bool | _devicesScanBeforeMenu = true |
| uint32_t | fpsMs [2] = { 0, 0 } |
| uint8_t | fpsNextIndex = 0 |
| uint32_t | fpsTopGap = 0 |
| uint8_t | menuLevel = 1 |
| CANBusMessage * | _msg |
| char | _name [16] |
| bool | _sniff = false |
| char | _ssid [16] |
| bool | verbose = false |
| char | _wiFiPassword [16] |
Base class for all robots.
| void Robot::actionAdd | ( | ActionBase * | action | ) |
Add a new action to the collection of robot's possible actions.
| action | - the new action. |
|
inline |
End current action
| bool Robot::actionPreprocessing | ( | bool | andFinish = true | ) |
Is this current action's initialization
| andFinish | - finish initialization |
|
inline |
Finish action's intialization phase
|
protected |
Actually perform the action
|
protected |
User sets a new action, using keyboard or Bluetooth
|
protected |
New action is set in the program
| newAction | - the new action. |
| void Robot::add | ( | Board * | aBoard | ) |
Add a new board to the collection of possible boards for the robot
| aBoard | - the board. |
|
pure virtual |
Store bitmaps in mrm-led8x8a.
Implemented in RobotSoccer, RobotMin, RobotMaze, and RobotLine.
| void Robot::blink | ( | ) |
Blink LED
| void Robot::bluetoothTest | ( | ) |
Test Bluetooth
|
protected |
Finds board and device's index. Similar to next function, but display choices, too.
| selectedBoardIndex | - output |
| selectedDeviceIndex | - otuput |
| maxInput | - output |
| lastBoardAndIndex | - output |
|
protected |
Displays all boards
|
protected |
Finds board and device's index for a number received from boardsDisplayAll(). Similar to previous function, but no display.
| selectedNumber | - input |
| selectedBoardIndex | - output, NULL if none found |
| selectedDeviceIndex | - otuput |
| maxInput | - output |
Finds board and device's index for a number received from boardsDisplayAll()
| selectedNumber | - input |
| selectedBoardIndex | - output |
| selectedDeviceIndex | - otuput |
| maxInput | - output |
| void Robot::canBusSniffToggle | ( | ) |
Display all the incomming and outcomming CAN Bus messages
| void Robot::canIdChange | ( | ) |
Change device's id
| void Robot::colorIlluminationOff | ( | ) |
mrm-color-can illumination off
| void Robot::colorIlluminationOn | ( | ) |
mrm-color-can illumination on
| void Robot::colorPatternErase | ( | ) |
Erase HSV patterns
| void Robot::colorPatternPrint | ( | ) |
Print HSV patterns
| void Robot::colorPatternRecognize | ( | ) |
Recognize HSV color pattern
| void Robot::colorPatternRecord | ( | ) |
Record HSV color patterns
| void Robot::delayMicros | ( | uint16_t | pauseMicros | ) |
The right way to use Arduino function delayMicros
| pauseMicros | - pause in micros. One run even if pauseMicros == 0, so that delayMicross(0) receives all messages. |
| void Robot::delayMs | ( | uint16_t | pauseMs | ) |
The right way to use Arduino function delay
| pauseMs | - pause in ms. One run even if pauseMs == 0, so that delayMs(0) receives all messages. |
| uint8_t Robot::devicesScan | ( | bool | verbose | ) |
Contacts all the CAN Bus devices and checks which one is alive. @verbose - if true, print.
| void Robot::devicesStart | ( | uint8_t | measuringMode = 0 | ) |
Starts devices' CAN Bus messages broadcasting.
| void Robot::devicesStop | ( | ) |
Stops broadcasting of CAN Bus messages
|
inline |
End current action
| void Robot::errors | ( | ) |
Displays errors and stops motors, if any.
| void Robot::firmwarePrint | ( | ) |
Displays each CAN Bus device's firmware
| float Robot::fpsGet | ( | ) |
Returns FPS (frames per second).
|
protected |
Avoids FPS measuring in the next 2 cycles.
| void Robot::fpsPrint | ( | ) |
Prints FPS all CAN Bus devices and mrm-eps32 boards. Also prints CAN Bus frequency.
|
protected |
Resets FPS data
|
protected |
Updates data for FPS calculation
|
pure virtual |
Orders the robot to go ahead
Implemented in RobotSoccer, RobotMin, RobotMaze, and RobotLine.
| void Robot::i2cTest | ( | ) |
Lists I2C devices
| void Robot::info | ( | ) |
Request information
| void Robot::irFinder3Test | ( | ) |
Tests mrm-ir-finder3, raw data.
| void Robot::irFinder3TestCalculated | ( | ) |
Tests mrm-ir-finder3, calculated data.
| void Robot::lidar2mTest | ( | ) |
Tests mrm-lid-can-b
| void Robot::lidar4mTest | ( | ) |
Tests mrm-lid-can-b2
| void Robot::lidarCalibrate | ( | ) |
Calibrates lidars
|
pure virtual |
User test, defined in derived classes.
Implemented in RobotSoccer, RobotMin, RobotMaze, and RobotLine.
| void Robot::menu | ( | ) |
Displays menu
| void Robot::menuColor | ( | ) |
Color menu
| void Robot::menuMainAndIdle | ( | ) |
Displays menu and stops motors
| void Robot::menuReflectance | ( | ) |
Reflectance menu
| void Robot::menuSystem | ( | ) |
System menu
| void Robot::messagePrint | ( | CANBusMessage * | msg, |
| bool | outbound | ||
| ) |
Print CAN Bus message
| msg | - message |
| oubound | - if not, inbound |
| void Robot::messagesReceive | ( | ) |
Receives CAN Bus messages.
| void Robot::motorTest | ( | ) |
Tests motors
| void Robot::nodeTest | ( | ) |
Tests mrm-node
| void Robot::noLoopWithoutThis | ( | ) |
Any for or while loop must include call to this function.
| void Robot::oscillatorTest | ( | ) |
Production test
| void Robot::reflectanceArrayCalibrationPrint | ( | ) |
Prints mrm-ref-can* calibration data
| void Robot::run | ( | ) |
Starts robot's program
| uint16_t Robot::serialReadNumber | ( | uint16_t | timeoutFirst = 3000, |
| uint16_t | timeoutBetween = 500, |
||
| bool | onlySingleDigitInput = false, |
||
| uint16_t | limit = 0xFFFE, |
||
| bool | printWarnings = true |
||
| ) |
Reads serial ASCII input and converts it into an integer
| timeoutFirst | - timeout for first input |
| timeoutBetween | - timeout between inputs |
| onlySingleDigitInput | - completes input after first digit |
| limit | - returns 0xFFFF if overstepped |
| printWarnings | - prints out of range or timeout warnings |
| void Robot::servoInteractive | ( | ) |
Moves servo motor manually
|
inline |
Shorthand for actionPreprocessing(). Checks if this is first run.
| andFinish | - finish initialization |
|
inline |
Checks if sniffing is active
| void Robot::stopAll | ( | ) |
Stops all motors
| bool Robot::stressTest | ( | ) |
CAN Bus stress test
| void Robot::thermoTest | ( | ) |
Tests mrm-therm-b-can
| bool Robot::userBreak | ( | ) |
Checks if user tries to break the program
|
protected |
Prints additional data in every loop pass
| void Robot::verboseToggle | ( | ) |
Verbose output toggle
|
protected |
Print to all serial ports, pointer to list