Functions which handle the simplified driving. More...
Modules | |
| Advanced informations | |
Enumerations | |
| enum | eDriveStop |
| clusters the modes for stopping the robot More... | |
| enum | eDriveCommand |
| clusters the driving states More... | |
| enum | eDriveErrorMask |
| clusters bit masks for the error states for driving More... | |
| enum | eDriveSelectMask |
| clusters bit masks for the requests of the drive module More... | |
| enum | eDriveTransmitMask |
| clusters bit masks for the transmitted-flags of the drive module More... | |
| enum | eDriveGet |
| clusters select values for reading data from the drive module More... | |
Functions | |
| void | drive_distance (int16_t distance, int16_t speed) |
| Lets the robot drive for a distance. More... | |
| void | drive_angle (int16_t angle, int16_t speed) |
| Lets the robot turn for an angle. More... | |
| void | drive_adjust (int16_t speed_distance, int16_t speed_angle) |
| Adjusts the robots driving. More... | |
| void | drive_arc (int16_t radius, int16_t speed) |
| Lets the robot drive an arc. More... | |
| void | drive_stop (eDriveStop mode) |
| Lets the robot stop driving. More... | |
Request Funktions | |
| void | drive_request (eDriveSelectMask bitmask, eRequestType request) |
| Requests new data from the drive module. More... | |
| eDriveSelectMask | drive_received (eDriveSelectMask bitmask) |
| Indicates if new data for the selected data blocks were received. More... | |
| eDriveSelectMask | drive_changed (eDriveSelectMask bitmask) |
| Indicates if new data changed the selected data blocks. More... | |
| eDriveTransmitMask | drive_transmitted (eDriveTransmitMask bitmask) |
| Indicates if the selected data blocks were transmitted. More... | |
Access Funktions | |
| int16_t | drive_get (eDriveGet select) |
| Returns the last stored version of the selected value. More... | |
Functions which handle the simplified driving.
All functions and commands are only available if the programm is compiled with the pupils version of the TUC-Bot library! Additionally functions only have an effect if the mode of the TUC-Bot is set to kModePupil. Therefore use mode_set().
example 1
example 2
example 3
example 4
| enum eDriveCommand |
clusters the driving states
| Enumerator | |
|---|---|
| kDriveCommandDone | constant (0): no driving |
| kDriveCommandDistance | constant (1): robot is driving straight |
| kDriveCommandAdjust | constant (2): robot is in adjust-drive mode |
| kDriveCommandAngle | constant (3): robot is turning |
| kDriveCommandArc | constant (4): robot is driving along an arc |
| kDriveCommandStop | constant (5): robot is stopping |
| enum eDriveErrorMask |
clusters bit masks for the error states for driving
| enum eDriveGet |
clusters select values for reading data from the drive module
| Enumerator | |
|---|---|
| kDriveGetPositionDistance | constant ( 1): driven distance in mm |
| kDriveGetPositionAngle | constant ( 2): turned angle in degrees |
| kDriveGetSpeedDistance | constant ( 3): current speed in mm/s |
| kDriveGetSpeedAngle | constant ( 4): current angular speed in degrees/s |
| kDriveGetCommand | constant ( 5): current executed drive command (8-bit) |
| kDriveGetError | constant ( 6): last error while driving (8-bit) |
| kDriveGetDistanceTotal | constant ( 7): total distance in mm as set by drive_distance() |
| kDriveGetDistanceSpeed | constant ( 8): tangential speed in mm/s as set by drive_distance() |
| kDriveGetAngleTotal | constant ( 9): total angle in degrees as set by drive_angle() |
| kDriveGetAngleSpeed | constant (10): angular speed in degrees/s as set by drive_angle() |
| kDriveGetAdjustTangential | constant (11): tangential speed in mm/s as set by drive_adjust() |
| kDriveGetAdjustAngular | constant (12): angular speed in degrees/s as set by drive_adjust() |
| kDriveGetArcRadius | constant (13): radius in mm as set by drive_arc() |
| kDriveGetArcSpeed | constant (14): tangential speed in mm/s as set by drive_arc() |
| kDriveGetStop | constant (15): stop mode (8-bit) as set by drive_stop() |
| enum eDriveSelectMask |
clusters bit masks for the requests of the drive module
| Enumerator | |
|---|---|
| kDriveSelectNone | bit mask (0x00): select no data block |
| kDriveSelectState | bit mask (0x01): select data block for the driving state |
| kDriveSelectPosition | bit mask (0x02): select data block for the travelled distance |
| kDriveSelectSpeed | bit mask (0x04): select data block for the speed |
| kDriveSelectAll | bit mask (0x07): select all data blocks (except for the drive commands) |
| kDriveSelectDistance | bit mask (0x10): select data block for driving a distance |
| kDriveSelectAngle | bit mask (0x20): select data block for turning |
| kDriveSelectAdjust | bit mask (0x40): select data block for drive-adjust |
| kDriveSelectArc | bit mask (0x80): select data block for driving along an arc |
| kDriveSelectStop | bit mask (0x10): select data block for stopping |
| kDriveSelectAllWithCmd | bit mask (0xFF): select all data blocks (including the drive commands) |
| enum eDriveStop |
clusters the modes for stopping the robot
| Enumerator | |
|---|---|
| kDriveStopNormal | constant (0): continuously decreasing the speed |
| kDriveStopFast | constant (1): instantly stopping |
| enum eDriveTransmitMask |
clusters bit masks for the transmitted-flags of the drive module
| Enumerator | |
|---|---|
| kDriveTransmitNone | bit mask (0x00): select no data block |
| kDriveTransmitDistance | bit mask: select data block for driving a distance |
| kDriveTransmitAngle | bit mask: select data block for turning |
| kDriveTransmitAdjust | bit mask: select data block for drive-adjust |
| kDriveTransmitArc | bit mask: select data block for driving along an arc |
| kDriveTransmitStop | bit mask: select data block for stopping |
| kDriveTransmitAll | bit mask: select all data blocks |
| void drive_adjust | ( | int16_t | speed_distance, |
| int16_t | speed_angle | ||
| ) |
Adjusts the robots driving.
This command will modify and transmit the data block sMD_DriveAdjust.
If one of the bumpers in driving direction is pushed the robot will stop immediately.
| speed_distance | 16-bit integer The tangential speed is measured in millimeters per second. |
| speed_angle | 16-bit integer The angular speed is measured degrees per second. |
| void drive_angle | ( | int16_t | angle, |
| int16_t | speed | ||
| ) |
Lets the robot turn for an angle.
This command will modify and transmit the data block sMD_DriveAngle.
If one of the bumpers in driving direction is pushed the robot will stop immediately.
| angle | 16-bit integer The angle is measured in degrees. |
| speed | 16-bit integer The speed is measured in degrees per second. |
| void drive_arc | ( | int16_t | radius, |
| int16_t | speed | ||
| ) |
Lets the robot drive an arc.
This command will modify and transmit the data block sMD_DriveArc.
If one of the bumpers in driving direction is pushed the robot will stop immediately.
| radius | 16-bit integer The radius is measured in millimeters. |
| speed | 16-bit integer The speed is measured in millimeters per second. |
| eDriveSelectMask drive_changed | ( | eDriveSelectMask | bitmask | ) |
Indicates if new data changed the selected data blocks.
| bitmask | bit mask of the selected data blocks - see also eDriveSelectMask The parameter is used to only return the value of the masked changed-bits. All other values(bits) are set to 0. |
| void drive_distance | ( | int16_t | distance, |
| int16_t | speed | ||
| ) |
Lets the robot drive for a distance.
This command will modify and transmit the data block sMD_DriveDist.
If one of the bumpers in driving direction is pushed the robot will stop immediately.
| distance | 16-bit integer The distance is measured in millimeters. |
| speed | 16-bit integer The speed is measured in millimeters per second. |
| int16_t drive_get | ( | eDriveGet | select | ) |
Returns the last stored version of the selected value.
This function relies on the internal data blocks sMD_State, sMD_WayAngle, sMD_Speed, sMD_DriveDist, sMD_DriveAdjust, sMD_DriveAngle, sMD_DriveArc and sMD_DriveStop - for new data use drive_request().
| select | value of the selected data - see also eDriveGet |
| eDriveSelectMask drive_received | ( | eDriveSelectMask | bitmask | ) |
Indicates if new data for the selected data blocks were received.
| bitmask | bit mask of the selected data blocks - see also eDriveSelectMask The parameter is used to only return the value of the masked received-bits. All other values(bits) are set to 0. |
| void drive_request | ( | eDriveSelectMask | bitmask, |
| eRequestType | request | ||
| ) |
Requests new data from the drive module.
For details on the request schema see The general request.
Involved data blocks are :
sMD_State, sMD_WayAngle and sMD_Speed.
Additionally the following data blocks can also be requested. This is usually not necessary at all and those can not be requested continuously:
sMD_DriveDist, sMD_DriveAdjust, sMD_DriveAngle, sMD_DriveArc and sMD_DriveStop
| bitmask | bit mask of the selected data blocks - see also eDriveSelectMask |
| request | See also eRequestType |
| void drive_stop | ( | eDriveStop | mode | ) |
Lets the robot stop driving.
This command will modify and transmit the data block sMD_DriveStop.
| mode | value representing the mode of stopping - see also eDriveStop |
| eDriveTransmitMask drive_transmitted | ( | eDriveTransmitMask | bitmask | ) |
Indicates if the selected data blocks were transmitted.
| bitmask | bit mask of the selected data blocks - see also eDriveTransmitMask The parameter is used to only return the value of the masked transmitted-bits. All other values(bits) are set to 0. |
1.8.17