added cliff sensor signals
This commit is contained in:
parent
a8e274be15
commit
fd2638114a
3 changed files with 64 additions and 0 deletions
|
@ -406,6 +406,26 @@ namespace create {
|
||||||
*/
|
*/
|
||||||
bool isCliffFrontRight() const;
|
bool isCliffFrontRight() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if the left sensor detects a cliff, false otherwise.
|
||||||
|
*/
|
||||||
|
uint16_t getCliffSignalLeft() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if the front left sensor detects a cliff, false otherwise.
|
||||||
|
*/
|
||||||
|
uint16_t getCliffSignalFrontLeft() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if the right sensor detects a cliff, false otherwise.
|
||||||
|
*/
|
||||||
|
uint16_t getCliffSignalRight() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if the front right sensor detects a cliff, false otherwise.
|
||||||
|
*/
|
||||||
|
uint16_t getCliffSignalFrontRight() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \return true if there is a virtual wall signal is being received.
|
* \return true if there is a virtual wall signal is being received.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -738,6 +738,46 @@ namespace create {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t Create::getCliffSignalLeft() const {
|
||||||
|
if (data->isValidPacketID(ID_CLIFF_LEFT)) {
|
||||||
|
return GET_DATA(ID_CLIFF_LEFT_SIGNAL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Left cliff sensor signals not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t Create::getCliffSignalFrontLeft() const {
|
||||||
|
if (data->isValidPacketID(ID_CLIFF_FRONT_LEFT)) {
|
||||||
|
return GET_DATA(ID_CLIFF_FRONT_LEFT_SIGNAL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Front left cliff sensor signals not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t Create::getCliffSignalRight() const {
|
||||||
|
if (data->isValidPacketID(ID_CLIFF_RIGHT)) {
|
||||||
|
return GET_DATA(ID_CLIFF_RIGHT_SIGNAL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Rightt cliff sensor signals not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t Create::getCliffSignalFrontRight() const {
|
||||||
|
if (data->isValidPacketID(ID_CLIFF_FRONT_RIGHT)) {
|
||||||
|
return GET_DATA(ID_CLIFF_FRONT_RIGHT_SIGNAL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Front right cliff sensor signals not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Create::isVirtualWall() const {
|
bool Create::isVirtualWall() const {
|
||||||
if (data->isValidPacketID(ID_VIRTUAL_WALL)) {
|
if (data->isValidPacketID(ID_VIRTUAL_WALL)) {
|
||||||
return GET_DATA(ID_VIRTUAL_WALL);
|
return GET_DATA(ID_VIRTUAL_WALL);
|
||||||
|
|
|
@ -16,6 +16,10 @@ namespace create {
|
||||||
ADD_PACKET(ID_CLIFF_FRONT_LEFT, 1, "cliff_front_left", V_ALL);
|
ADD_PACKET(ID_CLIFF_FRONT_LEFT, 1, "cliff_front_left", V_ALL);
|
||||||
ADD_PACKET(ID_CLIFF_FRONT_RIGHT, 1, "cliff_front_right", V_ALL);
|
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_CLIFF_RIGHT, 1, "cliff_right", V_ALL);
|
||||||
|
ADD_PACKET(ID_CLIFF_LEFT_SIGNAL, 2, "cliff_left_signal", V_3);
|
||||||
|
ADD_PACKET(ID_CLIFF_FRONT_LEFT_SIGNAL, 2, "cliff_front_left_signal", V_3);
|
||||||
|
ADD_PACKET(ID_CLIFF_FRONT_RIGHT_SIGNAL, 2, "cliff_front_right_signal", V_3);
|
||||||
|
ADD_PACKET(ID_CLIFF_RIGHT_SIGNAL, 2, "cliff_right_signal", V_3);
|
||||||
ADD_PACKET(ID_VIRTUAL_WALL, 1, "virtual_wall", V_ALL);
|
ADD_PACKET(ID_VIRTUAL_WALL, 1, "virtual_wall", V_ALL);
|
||||||
ADD_PACKET(ID_OVERCURRENTS, 1, "overcurrents", V_ALL);
|
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_LEFT, 1, "dirt_detect_left", V_ALL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue