Mode report workaround (#67)

* Add option for OI mode reporting bug workaround

https://github.com/AutonomyLab/create_robot/issues/64

* Update README.md

* Add note about 600 series OI mode reporting bug to Known Issues
  section and include details of API workaround option.
* Add myself to contributors list
This commit is contained in:
Josh Gadeken 2022-04-06 18:21:35 -06:00 committed by GitHub
parent db575de22a
commit e99939c785
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 2 deletions

View file

@ -42,6 +42,7 @@ namespace create {
requestedLeftVel = 0;
requestedRightVel = 0;
dtHistoryLength = 100;
modeReportWorkaround = false;
data = std::shared_ptr<Data>(new Data(model.getVersion()));
if (model.getVersion() == V_1) {
serial = std::make_shared<SerialQuery>(data, install_signal_handler);
@ -1117,10 +1118,23 @@ namespace create {
return requestedRightVel;
}
void Create::setModeReportWorkaround(const bool& enable) {
modeReportWorkaround = enable;
}
bool Create::getModeReportWorkaround() const {
return modeReportWorkaround;
}
create::CreateMode Create::getMode() {
if (data->isValidPacketID(ID_OI_MODE)) {
mode = (create::CreateMode) GET_DATA(ID_OI_MODE);
if (modeReportWorkaround) {
mode = (create::CreateMode) (GET_DATA(ID_OI_MODE) - 1);
} else {
mode = (create::CreateMode) GET_DATA(ID_OI_MODE);
}
}
return mode;
}