Revision a8480867
ID | a84808670408804bf5ce08741a3b59130351928f |
Made a lot of changes to the general structure.
Applied object-orienting techniques to the code, cleaning it up considerably. Major design changes are as follows:
- All separate node code (ie motors) are meant to only interface with hardware - doing as little logic as possible.
- Instead, the logic is moved to a class (ie MotorControl) in libscout. PID and other tools should be located here. This significantly reduces dependencies.
- Files can be included cross-package by being placed in /include/packagename, but this should be avoided to reduce dependencies.
A few formatting changes:
- Comments should end with / always, not */
- Use @ instead of \
- No double newlines.
The motors node is revamped and pretty much correct at this point.
scout/motors/src/motors.h | ||
---|---|---|
32 | 32 |
* |
33 | 33 |
* @author Colony Project, CMU Robotics Club |
34 | 34 |
* @author Benjamin Wasserman |
35 |
* @author Alex Zirbel |
|
35 | 36 |
**/ |
36 | 37 |
|
37 | 38 |
#ifndef _MOTORS_H_ |
38 | 39 |
#define _MOTORS_H_ |
39 | 40 |
|
40 |
#include "motors/query_motors.h" |
|
41 |
#include "motors/set_motors.h" |
|
42 |
|
|
43 |
#define MAXSPEED 255 |
|
44 |
#define MOTOR_PERCENT 'p' |
|
45 |
#define MOTOR_MMS 'm' |
|
46 |
#define MOTOR_CMS 'c' |
|
47 |
#define MOTOR_ABSOLUTE 'a' |
|
48 |
|
|
49 |
/* The number of messages in the queue. If messages arrive faster than they are |
|
50 |
* handled, old ones are thrown out */ |
|
51 |
#define QUEUE_SIZE 4 |
|
41 |
#include <motors/set_motors.h> |
|
42 |
#include <motors/query_motors.h> |
|
52 | 43 |
|
44 |
#define QUEUE_SIZE 10 |
|
53 | 45 |
|
54 | 46 |
/** @brief Initialize the motors module and driver. **/ |
55 | 47 |
int main(int argc, char **argv); |
Also available in: Unified diff