Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions commConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,22 @@ typedef union packetVSSTelemetry {
typedef struct {
uint8_t typeMsg : 4;
uint8_t id : 4;
int16_t x : 16; // -32.767 - 32.767 m
int16_t y : 16; // -32.767 - 32.767 m
int16_t w : 16; // 0 - 6.5535 rad
int16_t dribbler : 15; // -1638.3 - 1638.3 rad/s
uint8_t kickLoad : 8; // 0 - 2.55
int16_t x : 16; // -32.767 - 32.767 m
int16_t y : 16; // -32.767 - 32.767 m
int16_t w : 16; // 0 - 6.5535 rad
int16_t dribbler : 15; // -1638.3 - 1638.3 rad/s
uint8_t kickLoad : 8; // 0 - 2.55
bool ball : 1;
uint8_t battery : 8; // 0 - 25.5 V
int16_t m1 : 16; // -327.67 - 327.67 m/s
int16_t m2 : 16; // -327.67 - 327.67 m/s
int16_t m3 : 16; // -327.67 - 327.67 m/s
int16_t m4 : 16; // -327.67 - 327.67 m/s
uint8_t pcktCount : 8;
uint8_t battery : 8; // 0 - 25.5 V
int16_t m1 : 16; // -327.67 - 327.67 m/s
int16_t m2 : 16; // -327.67 - 327.67 m/s
int16_t m3 : 16; // -327.67 - 327.67 m/s
int16_t m4 : 16; // -327.67 - 327.67 m/s
uint8_t pcktCount : 8; // 0 - 2.55
uint8_t current_m1 : 8; // 0 - 2.55
uint8_t current_m2 : 8; // 0 - 2.55
uint8_t current_m3 : 8; // 0 - 2.55
uint8_t current_m4 : 8; // 0 - 2.55

} packetTypeOdometry;

Expand Down
6 changes: 5 additions & 1 deletion nRF24Communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ bool nRF24Communication::sendOdometryPacket(RobotInfo odometry) {
this->_mOdometry.decoded.m3 = static_cast<int16_t>(odometry.m.m3 * 100);
this->_mOdometry.decoded.m4 = static_cast<int16_t>(odometry.m.m4 * 100);
this->_mOdometry.decoded.pcktCount = static_cast<uint8_t>(odometry.count);
this->_mOdometry.decoded.current_m1 = static_cast<uint16_t>(odometry.current.m1 * 100);
this->_mOdometry.decoded.current_m2 = static_cast<uint16_t>(odometry.current.m2 * 100);
this->_mOdometry.decoded.current_m3 = static_cast<uint16_t>(odometry.current.m3 * 100);
this->_mOdometry.decoded.current_m4 = static_cast<uint16_t>(odometry.current.m4 * 100);
this->enable();
bool answer = this->_radio.write(this->_mOdometry.encoded, ODOMETRY_LENGTH);
this->disable();
Expand Down Expand Up @@ -401,4 +405,4 @@ bool nRF24Communication::robotMoveIsLocked() {

bool nRF24Communication::robotMoveCriticalTurbo() {
return _criticalMoveTurbo;
}
}