Revision: 9136 http://sourceforge.net/p/playerstage/svn/9136 Author: jpgr87 Date: 2013-11-12 00:11:47 +0000 (Tue, 12 Nov 2013) Log Message: ----------- Add support for hokuyoaist >= 3.0.0
The hokuyoaist driver was split out of the gearbox library after version 9.11 and is now hosted on github. The new hokuyoaist library, version 3.0, removed support for setting the baudrate of the sensor during runtime. The driver has been updated to reflect this change. There was also an error in detecting the version of the hokuyoaist library: the driver was looking for version 3.0.0 exactly. This has been fixed so it looks for versions >=3.0.0. Modified Paths: -------------- code/player/trunk/server/drivers/ranger/CMakeLists.txt code/player/trunk/server/drivers/ranger/hokuyo_aist.cc Modified: code/player/trunk/server/drivers/ranger/CMakeLists.txt =================================================================== --- code/player/trunk/server/drivers/ranger/CMakeLists.txt 2013-11-11 02:31:39 UTC (rev 9135) +++ code/player/trunk/server/drivers/ranger/CMakeLists.txt 2013-11-12 00:11:47 UTC (rev 9136) @@ -10,7 +10,7 @@ PLAYERDRIVER_OPTION (hokuyoaist build_hokuyoaist ON) PLAYERDRIVER_REQUIRE_PKG (hokuyoaist build_hokuyoaist hokuyoaist hokuyoaist_includeDirs hokuyoaist_libDirs hokuyoaist_linkLibs - hokuyoaist_linkFlags hokuyoaist_cFlags =3.0.0) + hokuyoaist_linkFlags hokuyoaist_cFlags >=3.0.0) PLAYERDRIVER_ADD_DRIVER (hokuyoaist build_hokuyoaist INCLUDEDIRS ${hokuyoaist_includeDirs} LIBDIRS ${hokuyoaist_libDirs} LINKLIBS ${hokuyoaist_linkLibs} LINKFLAGS ${hokuyoaist_linkFlags} Modified: code/player/trunk/server/drivers/ranger/hokuyo_aist.cc =================================================================== --- code/player/trunk/server/drivers/ranger/hokuyo_aist.cc 2013-11-11 02:31:39 UTC (rev 9135) +++ code/player/trunk/server/drivers/ranger/hokuyo_aist.cc 2013-11-12 00:11:47 UTC (rev 9136) @@ -93,11 +93,6 @@ @par Properties - - baud_rate (integer) - - Default: 19200bps - - Change the baud rate of the connection to the laser. See HokuyoAIST documentation for valid - values. This is separate from the scanner's power-on default baud rate, which should be - specified in portopts. - speed_level (integer, 0 to 10 or 99) - Default: 0 - The speed at which the laser operates, as a level down from maximum speed. See the HokuyoAIST @@ -135,7 +130,6 @@ #include <hokuyoaist/hokuyoaist.h> #include <libplayercore/playercore.h> -const int DEFAULT_BAUDRATE = 19200; const int DEFAULT_SPEED_LEVEL = 0; const int DEFAULT_SENSITIVITY = 0; const int DEFAULT_GET_INTENSITIES = 0; @@ -166,7 +160,7 @@ bool verbose_, invert_, powerOnStartup_, getIntensities_, ignoreUnknowns_; double minAngle_, maxAngle_; - IntProperty baudRate_, speedLevel_, highSensitivity_; + IntProperty speedLevel_, highSensitivity_; DoubleProperty minDist_; BoolProperty hwTimeStamps_; std::string portOpts_; @@ -190,7 +184,6 @@ HokuyoDriver::HokuyoDriver(ConfigFile* cf, int section) : ThreadedDriver(cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_RANGER_CODE), - baudRate_("baud_rate", DEFAULT_BAUDRATE, false), speedLevel_("speed_level", DEFAULT_SPEED_LEVEL, false), highSensitivity_("high_sensitivity", DEFAULT_SENSITIVITY, false), minDist_("min_dist", DEFAULT_MIN_DIST, false), @@ -198,7 +191,6 @@ _ranges(NULL), _intensities(NULL) { // Get the baudrate, speed and sensitivity - RegisterProperty("baud_rate", &baudRate_, cf, section); RegisterProperty("speed_level", &speedLevel_, cf, section); RegisterProperty("high_sensitivity", &highSensitivity_, cf, section); RegisterProperty("min_dist", &minDist_, cf, section); @@ -310,41 +302,10 @@ { player_intprop_req_t *req = reinterpret_cast<player_intprop_req_t*> (data); - // Change in the baud rate - if (strncmp(req->key, "baud_rate", 9) == 0) + if (strncmp(req->key, "speed_level", 11) == 0) { try { - // Change the baud rate - device_.set_baud(req->value); - } - catch(hokuyoaist::NotSerialError) - { - PLAYER_WARN( - "HokuyoAIST: Cannot change the baud rate of a non-serial connection."); - Publish(device_addr, resp_queue, PLAYER_MSGTYPE_RESP_NACK, - PLAYER_SET_INTPROP_REQ, NULL, 0, NULL); - return 0; - } - catch(hokuyoaist::BaseError &e) - { - PLAYER_ERROR1("HokuyoAIST: Error while changing baud rate: %s", - e.what()); - SetError(-1); - - Publish(device_addr, resp_queue, PLAYER_MSGTYPE_RESP_NACK, - PLAYER_SET_INTPROP_REQ, NULL, 0, NULL); - return 0; - } - baudRate_.SetValueFromMessage(data); - Publish(device_addr, resp_queue, PLAYER_MSGTYPE_RESP_ACK, - PLAYER_SET_INTPROP_REQ, NULL, 0, NULL); - return 0; - } - else if (strncmp(req->key, "speed_level", 11) == 0) - { - try - { device_.set_motor_speed(req->value); } catch(hokuyoaist::BaseError &e) @@ -694,7 +655,7 @@ { device_.ignore_unknowns(ignoreUnknowns_); // Open the laser - device_.open_with_probing(portOpts_); + device_.open(portOpts_); // Get the sensor information and check minAngle_ and maxAngle_ are OK hokuyoaist::SensorInfo info; device_.get_sensor_info(info); @@ -713,20 +674,6 @@ try { - device_.set_baud(baudRate_.GetValue()); - } - catch(hokuyoaist::NotSerialError) - { - PLAYER_WARN( - "HokuyoAIST: Cannot change the baud rate of a non-serial connection."); - } - catch(hokuyoaist::BaseError &e) - { - PLAYER_WARN1("HokuyoAIST: Error while changing baud rate: %s", - e.what()); - } - try - { // Catch any errors here as this is an optional setting not supported by all models device_.set_motor_speed(speedLevel_.GetValue()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit