forked from compAIR/libcreate
Add API for getting left and right wheeldrop
Signed-off-by: Jacob Perron <jacobmperron@gmail.com>
This commit is contained in:
parent
df149bdc12
commit
4a0f8ad72b
2 changed files with 30 additions and 0 deletions
|
@ -336,6 +336,16 @@ namespace create {
|
||||||
*/
|
*/
|
||||||
bool isWheeldrop() const;
|
bool isWheeldrop() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if a left wheeldrop is detected, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isLeftWheeldrop() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if a right wheeldrop is detected, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isRightWheeldrop() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \return true if left bumper is pressed, false otherwise.
|
* \return true if left bumper is pressed, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -597,6 +597,26 @@ namespace create {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Create::isLeftWheeldrop() const {
|
||||||
|
if (data->isValidPacketID(ID_BUMP_WHEELDROP)) {
|
||||||
|
return (GET_DATA(ID_BUMP_WHEELDROP) & 0x08) != 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Wheeldrop sensor not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create::isRightWheeldrop() const {
|
||||||
|
if (data->isValidPacketID(ID_BUMP_WHEELDROP)) {
|
||||||
|
return (GET_DATA(ID_BUMP_WHEELDROP) & 0x04) != 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CERR("[create::Create] ", "Wheeldrop sensor not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Create::isLeftBumper() const {
|
bool Create::isLeftBumper() const {
|
||||||
if (data->isValidPacketID(ID_BUMP_WHEELDROP)) {
|
if (data->isValidPacketID(ID_BUMP_WHEELDROP)) {
|
||||||
return (GET_DATA(ID_BUMP_WHEELDROP) & 0x02) != 0;
|
return (GET_DATA(ID_BUMP_WHEELDROP) & 0x02) != 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue