Skip to content

Commit

Permalink
improve firmware string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Paulus committed Jan 30, 2013
1 parent a0bfd25 commit 5df5381
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions youbot/YouBotBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ YouBotBase::YouBotBase(const std::string name, const std::string configFilePath)

this->controllerType = 174;
this->alternativeControllerType = 1632;
this->supportedFirmwareVersions.push_back("1.48");
this->supportedFirmwareVersions.push_back("148");
this->supportedFirmwareVersions.push_back("200");
this->actualFirmwareVersionAllJoints = "";
Expand Down Expand Up @@ -95,7 +94,7 @@ YouBotBase::~YouBotBase() {
void YouBotBase::doJointCommutation() {
// Bouml preserved body begin 0008A9F1

if(this->actualFirmwareVersionAllJoints == "1.48" || this->actualFirmwareVersionAllJoints == "148"){
if(this->actualFirmwareVersionAllJoints == "148"){
this->commutationFirmware148();
}else if(this->actualFirmwareVersionAllJoints == "200" ){
this->commutationFirmware200();
Expand Down
8 changes: 7 additions & 1 deletion youbot/YouBotJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,13 @@ void YouBotJoint::getConfigurationParameter(FirmwareVersion& parameter) {
int controllerType = 0;
char firmwareVersion[9] = {0};
sscanf (versionString,"%dV%s",&controllerType, firmwareVersion);
parameter.setParameter(controllerType, firmwareVersion);
std::string version(firmwareVersion);
unsigned int founddot = version.find(".");
while(founddot != std::string::npos){
version.erase(founddot,1);
founddot = version.find(".");
}
parameter.setParameter(controllerType, version);
return;
// Bouml preserved body end 0009AA71
}
Expand Down
3 changes: 1 addition & 2 deletions youbot/YouBotManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ YouBotManipulator::YouBotManipulator(const std::string name, const std::string c

this->controllerType = 841;
this->alternativeControllerType = 1610;
this->supportedFirmwareVersions.push_back("1.48");
this->supportedFirmwareVersions.push_back("148");
this->supportedFirmwareVersions.push_back("200");
this->actualFirmwareVersionAllJoints = "";
Expand Down Expand Up @@ -95,7 +94,7 @@ YouBotManipulator::~YouBotManipulator() {
void YouBotManipulator::doJointCommutation() {
// Bouml preserved body begin 000A3371

if(this->actualFirmwareVersionAllJoints == "1.48" || this->actualFirmwareVersionAllJoints == "148"){
if(this->actualFirmwareVersionAllJoints == "148"){
this->commutationFirmware148();
}else if(this->actualFirmwareVersionAllJoints == "200" ){
this->commutationFirmware200();
Expand Down

0 comments on commit 5df5381

Please sign in to comment.