Implement methods for getting overcurrent status. (#57)
This commit is contained in:
parent
ccf6d0cdc0
commit
850b011a55
3 changed files with 43 additions and 13 deletions
|
@ -1036,6 +1036,36 @@ namespace create {
|
|||
}
|
||||
}
|
||||
|
||||
bool Create::isSideBrushOvercurrent() const {
|
||||
if (data->isValidPacketID(ID_OVERCURRENTS)) {
|
||||
return (GET_DATA(ID_OVERCURRENTS) & 0x01) != 0;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Overcurrent sensor not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isMainBrushOvercurrent() const {
|
||||
if (data->isValidPacketID(ID_OVERCURRENTS)) {
|
||||
return (GET_DATA(ID_OVERCURRENTS) & 0x04) != 0;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Overcurrent sensor not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isWheelOvercurrent() const {
|
||||
if (data->isValidPacketID(ID_OVERCURRENTS)) {
|
||||
return (GET_DATA(ID_OVERCURRENTS) & 0x18) != 0;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Overcurrent sensor not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
float Create::getLeftWheelDistance() const {
|
||||
return totalLeftDist;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace create {
|
|||
ADD_PACKET(ID_CLIFF_FRONT_RIGHT, 1, "cliff_front_right", V_ALL);
|
||||
ADD_PACKET(ID_CLIFF_RIGHT, 1, "cliff_right", V_ALL);
|
||||
ADD_PACKET(ID_VIRTUAL_WALL, 1, "virtual_wall", V_ALL);
|
||||
ADD_PACKET(ID_OVERCURRENTS, 1, "overcurrents", V_1);
|
||||
ADD_PACKET(ID_OVERCURRENTS, 1, "overcurrents", V_ALL);
|
||||
ADD_PACKET(ID_DIRT_DETECT_LEFT, 1, "dirt_detect_left", V_ALL);
|
||||
ADD_PACKET(ID_DIRT_DETECT_RIGHT, 1, "dirt_detect_right", V_1);
|
||||
ADD_PACKET(ID_IR_OMNI, 1, "ir_opcode", V_ALL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue