in cob_sick_s300, the baud rate parameter does not end up being used, it is forced to 500000. the patch below removes that, and also allows you to use any baud rate rather than just a few (baud rate is just passed through to SerialIO code as an integer). let me know if you prefer a pull request.
diff --git a/cob_sick_s300/common/include/cob_sick_s300/LaserScannerConfiguration.hpp b/cob_sick_s300/common/include/cob_sick_s300/LaserScannerConfiguration.hpp
index 5403817..3883dff 100644
--- a/cob_sick_s300/common/include/cob_sick_s300/LaserScannerConfiguration.hpp
+++ b/cob_sick_s300/common/include/cob_sick_s300/LaserScannerConfiguration.hpp
@@ -13,15 +13,6 @@
#include "cob_sick_s300/Units.hpp"
namespace brics_oodl {
-enum baud_rate {
- BAUD_9600,
- BAUD_19200,
- BAUD_38400,
- BAUD_115200,
- BAUD_500K,
- BAUD_UNKNOWN
-
-};
/**
* \brief
*
@@ -61,7 +52,7 @@ class LaserScannerConfiguration {
quantity<length> maxRangeDistance;
- baud_rate baud;
+ unsigned int baud;
std::string devicePath;
diff --git a/cob_sick_s300/common/src/ScannerSickS300.cpp b/cob_sick_s300/common/src/ScannerSickS300.cpp
index 35b579d..4356615 100644
--- a/cob_sick_s300/common/src/ScannerSickS300.cpp
+++ b/cob_sick_s300/common/src/ScannerSickS300.cpp
@@ -134,9 +134,6 @@ bool ScannerSickS300::open(const char* pcPort, int iBaudRate, int iScanId=7)
{
int bRetSerial;
- // for Care-O-bot3 S300 is set fixed to 500kBaud
- if (iBaudRate != 500000)
- return false;
// update scan id (id=8 for slave scanner, else 7)
m_iScanId = iScanId;
diff --git a/cob_sick_s300/common/src/SickS300.cpp b/cob_sick_s300/common/src/SickS300.cpp
index 870ff51..909aac4 100644
--- a/cob_sick_s300/common/src/SickS300.cpp
+++ b/cob_sick_s300/common/src/SickS300.cpp
@@ -62,33 +62,9 @@ bool SickS300::open(Errors& error) {
}
- unsigned int desired_baud = 500000;
-
- switch (this->config->baud) {
- case BAUD_9600:
- desired_baud = 9600;
- LOG(trace) << "using 9600 baut to comunicate to Sick S300";
- break;
- case BAUD_19200:
- desired_baud = 19200;
- LOG(trace) << "using 19200 baut to comunicate to Sick S300";
- break;
- case BAUD_38400:
- desired_baud = 38400;
- LOG(trace) << "using 38400 baut to comunicate to Sick S300";
- break;
- case BAUD_115200:
- desired_baud = 115200;
- LOG(trace) << "using 115200 baut to comunicate to Sick S300";
- break;
- case BAUD_500K:
- desired_baud = 500000;
- LOG(trace) << "using 500000 baut to comunicate to Sick S300";
- break;
- case BAUD_UNKNOWN:
- desired_baud = 0;
- break;
- }
+ unsigned int desired_baud = config->baud;
+ LOG(trace) << "using " << desired_baud << " to communicate with Sick S300";
+
//Initialize the Sick S300
try {
diff --git a/cob_sick_s300/ros/src/cob_sick_s300.cpp b/cob_sick_s300/ros/src/cob_sick_s300.cpp
index f37aa2d..9e9444b 100644
--- a/cob_sick_s300/ros/src/cob_sick_s300.cpp
+++ b/cob_sick_s300/ros/src/cob_sick_s300.cpp
@@ -276,24 +276,7 @@ int main(int argc, char** argv)
config.devicePath = nodeClass.port.c_str(); // Device path of the Sick S300
config.scannerID = nodeClass.scan_id;
- switch (nodeClass.baud) {
- case 9600:
- config.baud = brics_oodl::BAUD_9600;
- break;
- case 38400:
- config.baud = brics_oodl::BAUD_38400;
- break;
- case 115200:
- config.baud = brics_oodl::BAUD_115200;
- break;
- break;
- case 500000:
- config.baud = brics_oodl::BAUD_500K;
- break;
- default:
- config.baud = brics_oodl::BAUD_UNKNOWN;
- break;
- }
+ config.baud = nodeClass.baud;
if (!sickS300.setConfiguration(config, errors)) {