Add API for getting left and right cliff detections
Signed-off-by: Jacob Perron <jacobmperron@gmail.com>
This commit is contained in:
parent
fd2f05047e
commit
cafe0c5e56
2 changed files with 60 additions and 0 deletions
|
@ -366,6 +366,26 @@ namespace create {
|
|||
*/
|
||||
bool isCliff() const;
|
||||
|
||||
/**
|
||||
* \return true if the left sensor detects a cliff, false otherwise.
|
||||
*/
|
||||
bool isCliffLeft() const;
|
||||
|
||||
/**
|
||||
* \return true if the front left sensor detects a cliff, false otherwise.
|
||||
*/
|
||||
bool isCliffFrontLeft() const;
|
||||
|
||||
/**
|
||||
* \return true if the right sensor detects a cliff, false otherwise.
|
||||
*/
|
||||
bool isCliffRight() const;
|
||||
|
||||
/**
|
||||
* \return true if the front right sensor detects a cliff, false otherwise.
|
||||
*/
|
||||
bool isCliffFrontRight() const;
|
||||
|
||||
/**
|
||||
* \return true if there is a virtual wall signal is being received.
|
||||
*/
|
||||
|
|
|
@ -663,6 +663,46 @@ namespace create {
|
|||
}
|
||||
}
|
||||
|
||||
bool Create::isCliffLeft() const {
|
||||
if (data->isValidPacketID(ID_CLIFF_LEFT)) {
|
||||
return GET_DATA(ID_CLIFF_LEFT) == 1;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Left cliff sensors not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isCliffFrontLeft() const {
|
||||
if (data->isValidPacketID(ID_CLIFF_FRONT_LEFT)) {
|
||||
return GET_DATA(ID_CLIFF_FRONT_LEFT) == 1;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Front left cliff sensors not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isCliffRight() const {
|
||||
if (data->isValidPacketID(ID_CLIFF_RIGHT)) {
|
||||
return GET_DATA(ID_CLIFF_RIGHT) == 1;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Rightt cliff sensors not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isCliffFrontRight() const {
|
||||
if (data->isValidPacketID(ID_CLIFF_FRONT_RIGHT)) {
|
||||
return GET_DATA(ID_CLIFF_FRONT_RIGHT) == 1;
|
||||
}
|
||||
else {
|
||||
CERR("[create::Create] ", "Front right cliff sensors not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::isVirtualWall() const {
|
||||
if (data->isValidPacketID(ID_VIRTUAL_WALL)) {
|
||||
return GET_DATA(ID_VIRTUAL_WALL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue