Revision 8c99e03a devices/DiWheelDrive/DiWheelDrive.cpp
| devices/DiWheelDrive/DiWheelDrive.cpp | ||
|---|---|---|
| 2 | 2 |
#include "hal.h" |
| 3 | 3 |
#include "qei.h" |
| 4 | 4 |
#include "DiWheelDrive.h" |
| 5 |
#include <chprintf.h> |
|
| 5 |
// #include <chprintf.h>
|
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 | 8 |
#include <global.hpp> |
| ... | ... | |
| 120 | 120 |
} |
| 121 | 121 |
break; |
| 122 | 122 |
case CAN::SET_LINE_FOLLOW_MSG: |
| 123 |
chprintf((BaseSequentialStream*) &SD1, "Received Strategy!\n"); |
|
| 123 |
// chprintf((BaseSequentialStream*) &SD1, "Received Strategy!\n");
|
|
| 124 | 124 |
if (frame->DLC == 1) {
|
| 125 | 125 |
global.lfStrategy = frame->data8[0]; |
| 126 | 126 |
global.msgReceived = true; |
| 127 |
return RDY_OK; |
|
| 127 |
// return RDY_OK;
|
|
| 128 | 128 |
} |
| 129 | 129 |
break; |
| 130 | 130 |
case CAN::SET_KINEMATIC_CONST_ID: |
| ... | ... | |
| 150 | 150 |
case CAN::POWER_STATUS_ID: |
| 151 | 151 |
if (frame->DLC == 6) {
|
| 152 | 152 |
// The power status is evaluated by inherited ControllerAreaNetworkRx object, but depending on the flags the power path controller needs to enabled or disabled. |
| 153 |
|
|
| 153 | 154 |
types::power_status::ChargingState charging_flags; |
| 154 | 155 |
charging_flags.value = frame->data8[0]; |
| 155 | 156 |
global.ltc4412.enable(charging_flags.content.diwheeldrive_enable_power_path); |
| 157 |
|
|
| 156 | 158 |
// Do not return with RDY_OK, or the inherited ControllerAreaNetworkRx object would not evaluate the rest of this message. |
| 157 | 159 |
} |
| 158 | 160 |
break; |
| ... | ... | |
| 190 | 192 |
return 0; |
| 191 | 193 |
} |
| 192 | 194 |
|
| 195 |
void DiWheelDrive::requestCharging(uint8_t power){
|
|
| 196 |
CANTxFrame frame; |
|
| 197 |
frame.SID = 0; |
|
| 198 |
this->encodeDeviceId(&frame, CAN::REQUEST_CHARGING_OVER_PIN); |
|
| 199 |
frame.data8[0] = power; |
|
| 200 |
frame.DLC = 1; |
|
| 201 |
this->transmitMessage(&frame); |
|
| 202 |
} |
|
| 203 |
|
|
| 193 | 204 |
void DiWheelDrive::periodicBroadcast() {
|
| 194 | 205 |
CANTxFrame frame; |
| 195 | 206 |
frame.SID = 0; |
| ... | ... | |
| 200 | 211 |
frame.data32[1] = this->actualSpeed[1]; |
| 201 | 212 |
frame.DLC = 8; |
| 202 | 213 |
this->transmitMessage(&frame); |
| 214 |
// Send Message for either activate or deactivate it |
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 203 | 219 |
|
| 204 | 220 |
// Send the valocites µm/s of the x axis and µrad/s around z axis: end |
| 205 | 221 |
// Send the odometry: start |
Also available in: Unified diff