amiro-os / include / amiro / ControllerAreaNetworkRx.h @ eef47799
History | View | Annotate | Download (1.625 KB)
1 |
#ifndef AMIRO_CONTROLLER_AREA_NETWORK_RX_H_
|
---|---|
2 |
#define AMIRO_CONTROLLER_AREA_NETWORK_RX_H_
|
3 |
|
4 |
#include <evtimer.h> |
5 |
#include <amiro/Color.h> |
6 |
#include <Types.h> // ::kinematic |
7 |
|
8 |
#include <amiro/Constants.h> // CAN::* macros |
9 |
|
10 |
namespace amiro { |
11 |
|
12 |
class ControllerAreaNetworkRx : public chibios_rt::BaseStaticThread<128> {
|
13 |
public:
|
14 |
ControllerAreaNetworkRx(CANDriver *can, const uint8_t boardId);
|
15 |
virtual ~ControllerAreaNetworkRx() = 0;
|
16 |
|
17 |
uint16_t getProximityRingValue(int index);
|
18 |
uint16_t getProximityFloorValue(int index);
|
19 |
void getActualSpeed(types::kinematic &targetSpeed);
|
20 |
types::position getOdometry(); |
21 |
types::power_status& getPowerStatus(); |
22 |
uint8_t getRobotID(); |
23 |
int32_t getMagnetometerValue(int axis);
|
24 |
int16_t getGyroscopeValue(int axis);
|
25 |
|
26 |
void calibrateProximityRingValues();
|
27 |
void calibrateProximityFloorValues();
|
28 |
|
29 |
int rxCmdShell(CANRxFrame *frame);
|
30 |
|
31 |
protected:
|
32 |
virtual msg_t main(); |
33 |
virtual msg_t receiveMessage(CANRxFrame *frame); |
34 |
|
35 |
int decodeBoardId(CANRxFrame *frame);
|
36 |
int decodeDeviceId(CANRxFrame *frame);
|
37 |
int decodeIndexId(CANRxFrame *frame);
|
38 |
|
39 |
int boardId;
|
40 |
uint16_t proximityRingValue[8];
|
41 |
int actualSpeed[2]; |
42 |
uint16_t proximityFloorValue[4];
|
43 |
int32_t magnetometerValue[3];
|
44 |
int16_t gyroscopeValue[3];
|
45 |
types::position robotPosition; |
46 |
types::power_status powerStatus; |
47 |
uint8_t robotId; |
48 |
chibios_rt::EvtListener rxFullCanEvtListener; |
49 |
chibios_rt::EvtSource *rxFullCanEvtSource; |
50 |
|
51 |
private:
|
52 |
msg_t receiveSensorVal(CANRxFrame *frame); |
53 |
|
54 |
CANDriver *canDriver; |
55 |
CANConfig canConfig; |
56 |
|
57 |
}; |
58 |
|
59 |
} |
60 |
|
61 |
#endif /* AMIRO_CONTROLLER_AREA_NETWORK_RX_H_ */ |
62 |
|