direcs
2012-09-30
|
Gives access to the motors of the robot. More...
#include <motor.h>
Public Slots | |
void | setMaximumSpeed (int speed) |
bool | setMotorSpeed (int motor, int speed) |
void | setRobotState (bool state) |
Signals | |
void | message (QString text, bool CR=true, bool sayIt=false, bool addTimestamp=true) |
Public Member Functions | |
bool | flashlight (bool state) |
double | getDrivenDistance (unsigned char motor) |
int | getMotorSpeed (int motor) |
unsigned int | getRevolutions (unsigned char motor) |
Motor (InterfaceAvr *i, QMutex *m) | |
bool | motorControl (int motor, bool power, int direction) |
void | resetMovementCounter (short int motor) |
~Motor () |
Private Member Functions | |
void | calculateMovement () |
Private Attributes | |
QString | className |
double | drivenDistance1 |
double | drivenDistance2 |
double | drivenDistance3 |
double | drivenDistance4 |
InterfaceAvr * | interface1 |
int | motor1Speed |
int | motor2Speed |
int | motor3Speed |
int | motor4Speed |
int | motorSpeedAllMotors |
QMutex * | mutex |
this will contain the name of this class at runtime for debug messages | |
unsigned int | revolutions1 |
unsigned int | revolutions2 |
unsigned int | revolutions3 |
unsigned int | revolutions4 |
bool | robotState |
Static Private Attributes | |
static const int | ALLMOTORS = 250 |
Motor 4 back right. | |
static const int | BACKWARD = 20 |
Motor direction (formerly "clockwise") | |
static const unsigned char | BIT0 = 1 |
static const unsigned char | BIT1 = 2 |
static const unsigned char | BIT2 = 4 |
static const unsigned char | BIT3 = 8 |
static const unsigned char | BIT4 = 16 |
static const unsigned char | BIT5 = 32 |
static const unsigned char | BIT6 = 64 |
static const unsigned char | BIT7 = 128 |
static const unsigned char | BOTBACKWARD = 81 |
static const unsigned char | BOTFORWARD = 80 |
The serial driving commands for the robot. | |
static const unsigned char | BOTLEFT = 82 |
static const unsigned char | BOTRIGHT = 83 |
static const unsigned char | BOTSTART = 86 |
static const unsigned char | BOTSTOP = 87 |
static const unsigned char | BOTTURNLEFT = 84 |
static const unsigned char | BOTTURNRIGHT = 85 |
static const unsigned char | BOTWAIT = 88 |
static const char | CLOCK = 1 |
static const unsigned char | FLASHLIGHT_OFF = 40 |
static const unsigned char | FLASHLIGHT_ON = 41 |
static const int | FORWARD = 10 |
Some driving directions and motor directions for the robot. | |
static const unsigned char | HIGH = 1 |
static const int | LEFT = 30 |
Motor direction (formerly "counterclockwise". | |
static const unsigned char | LOW = 0 |
static const int | MOTOR1 = 210 |
Motor direction/power "same like before". | |
static const unsigned char | MOTOR1_CLOCKWISE = 21 |
static const unsigned char | MOTOR1_COUNTERCLOCKWISE = 22 |
static const unsigned char | MOTOR1_OFF = 20 |
the "serial" commands for the MC -> see "main.h" in the microcontroller source code (direcs-avr)! | |
static const unsigned char | MOTOR1_SPEED_SET = 26 |
static const unsigned char | MOTOR1A = BIT0 |
The bits for controling the USB-Circuit. | |
static const unsigned char | MOTOR1B = BIT1 |
static const int | MOTOR1BW = 310 |
static const int | MOTOR1FW = 300 |
used for letting the robot getting only one command for all motors (like 'forward all'). This is to reduce commands on the serial line. | |
static const int | MOTOR1OFF = 320 |
static const int | MOTOR2 = 220 |
Motor 1 front left. | |
static const unsigned char | MOTOR2_CLOCKWISE = 24 |
static const unsigned char | MOTOR2_COUNTERCLOCKWISE = 25 |
static const unsigned char | MOTOR2_OFF = 23 |
static const unsigned char | MOTOR2_SPEED_SET = 27 |
static const unsigned char | MOTOR2A = BIT2 |
static const unsigned char | MOTOR2B = BIT3 |
static const int | MOTOR2BW = 340 |
static const int | MOTOR2FW = 330 |
static const int | MOTOR2OFF = 350 |
static const int | MOTOR3 = 230 |
Motor 2 front right. | |
static const unsigned char | MOTOR3_CLOCKWISE = 51 |
static const unsigned char | MOTOR3_COUNTERCLOCKWISE = 52 |
static const unsigned char | MOTOR3_OFF = 50 |
static const unsigned char | MOTOR3_SPEED_SET = 56 |
static const int | MOTOR3BW = 370 |
static const int | MOTOR3FW = 360 |
static const int | MOTOR3OFF = 380 |
static const int | MOTOR4 = 240 |
Motor 3 back left. | |
static const unsigned char | MOTOR4_CLOCKWISE = 54 |
static const unsigned char | MOTOR4_COUNTERCLOCKWISE = 55 |
static const unsigned char | MOTOR4_OFF = 53 |
static const unsigned char | MOTOR4_SPEED_SET = 57 |
static const int | MOTOR4BW = 400 |
static const int | MOTOR4FW = 390 |
static const int | MOTOR4OFF = 410 |
static const unsigned char | MOTORCLOCK = BIT4 |
static const char | OFF = false |
static const char | ON = true |
static const int | READ_AXIS_X = 500 |
static const int | READ_AXIS_Y = 510 |
static const int | READ_AXIS_Z = 520 |
static const int | RIGHT = 40 |
static const int | SAME = 200 |
static const unsigned char | SPEED_SET_ALLMOTORS = 60 |
static const int | START = 70 |
static const int | STOP = 80 |
static const int | TURNLEFT = 50 |
static const int | TURNRIGHT = 60 |
static const int | WAIT = 90 |
Motor::Motor | ( | InterfaceAvr * | i, |
QMutex * | m | ||
) |
bool Motor::flashlight | ( | bool | state | ) |
double Motor::getDrivenDistance | ( | unsigned char | motor | ) |
int Motor::getMotorSpeed | ( | int | motor | ) |
unsigned int Motor::getRevolutions | ( | unsigned char | motor | ) |
|
signal |
Emits a string to the GUI log / console.
text | is the message to be emitted |
CR | is true when a CR/LF should be added at the end of the line (default) |
sayIt | is true when the text for the log also should be spoken (default=false) |
addTimestamp | If true, the a timestamp is added in front of the text. This parameter is optional. |
bool Motor::motorControl | ( | int | motor, |
bool | power, | ||
int | direction | ||
) |
Controls a motor (normal and stepper!).
motor | is the motor number. |
power | can be ON or OFF. |
direction | can be CLOCKWISE or COUNTERCLOCKWISE. |
Definition at line 126 of file motor.cpp.
void Motor::resetMovementCounter | ( | short int | motor | ) |
|
slot |
|
slot |
Sets the speed of a motor.
motor | is the motor number (MOTOR1, MOTOR2, MOTOR3, MOTOR4, ALLMOTORS). |
speed | is the speed (0 - 255). return true on success |
Definition at line 996 of file motor.cpp.
|
slot |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |
Some driving directions and motor directions for the robot.
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
mutableprivate |
|
staticprivate |