Revision: 7888
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7888&view=rev
Author:   gbiggs
Date:     2009-06-24 13:25:20 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Added drivers for GbxGarminAcfr and GbxSmartBatteryAcfr libs

Modified Paths:
--------------
    code/player/trunk/server/drivers/CMakeLists.txt
    code/player/trunk/server/drivers/gps/CMakeLists.txt
    code/player/trunk/server/drivers/ranger/gbxsickacfr.cc

Added Paths:
-----------
    code/player/trunk/server/drivers/gps/gbxgarminacfr.cc
    code/player/trunk/server/drivers/power/
    code/player/trunk/server/drivers/power/CMakeLists.txt
    code/player/trunk/server/drivers/power/oceanserver.cc

Modified: code/player/trunk/server/drivers/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/CMakeLists.txt     2009-06-24 13:21:49 UTC 
(rev 7887)
+++ code/player/trunk/server/drivers/CMakeLists.txt     2009-06-24 13:25:20 UTC 
(rev 7888)
@@ -23,6 +23,7 @@
 ADD_SUBDIRECTORY (planner)
 ADD_SUBDIRECTORY (pointcloud3d)
 ADD_SUBDIRECTORY (position)
+ADD_SUBDIRECTORY (power)
 ADD_SUBDIRECTORY (ptz)
 ADD_SUBDIRECTORY (ranger)
 ADD_SUBDIRECTORY (rfid)

Modified: code/player/trunk/server/drivers/gps/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/gps/CMakeLists.txt 2009-06-24 13:21:49 UTC 
(rev 7887)
+++ code/player/trunk/server/drivers/gps/CMakeLists.txt 2009-06-24 13:25:20 UTC 
(rev 7888)
@@ -1,3 +1,13 @@
 PLAYERDRIVER_OPTION (garminnmea build_garminnmea ON)
 PLAYERDRIVER_REJECT_OS (garminnmea build_garminnmea PLAYER_OS_WIN)
 PLAYERDRIVER_ADD_DRIVER (garminnmea build_garminnmea SOURCES garminnmea.cc)
+
+PLAYERDRIVER_OPTION (gbxgarminacfr build_gbxgarminacfr ON)
+PLAYERDRIVER_REQUIRE_PKG (gbxgarminacfr build_gbxgarminacfr GbxGarminAcfr
+    gbxgarminacfr_includeDirs gbxgarminacfr_libDirs gbxgarminacfr_linkLibs
+    gbxgarminacfr_linkFlags gbxgarminacfr_cFlags)
+PLAYERDRIVER_ADD_DRIVER (gbxgarminacfr build_gbxgarminacfr
+    INCLUDEDIRS "${gbxgarminacfr_includeDirs}" LIBDIRS 
"${gbxgarminacfr_libDirs}"
+    LINKLIBS "${gbxgarminacfr_linkLibs}" LINKFLAGS "${gbxgarminacfr_linkFlags}"
+    CFLAGS "${gbxgarminacfr_cFlags}" SOURCES gbxgarminacfr.cc)
+

Added: code/player/trunk/server/drivers/gps/gbxgarminacfr.cc
===================================================================
--- code/player/trunk/server/drivers/gps/gbxgarminacfr.cc                       
        (rev 0)
+++ code/player/trunk/server/drivers/gps/gbxgarminacfr.cc       2009-06-24 
13:25:20 UTC (rev 7888)
@@ -0,0 +1,288 @@
+/*
+ *  Player - One Hell of a Robot Server
+ *  Copyright (C) 2000-2003  Brian Gerkey [email protected]
+ *                           Andrew Howard [email protected]
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Desc: Driver wrapper around the Gearbox gbxgarminacfr library.
+// Author: Geoffrey Biggs
+// Date: 24/06/2009
+//
+// Provides - GPS device.
+//
+///////////////////////////////////////////////////////////////////////////
+
+/** @ingroup drivers */
+/** @{ */
+/** @defgroup driver_gbxgarminacfr gbxgarminacfr
+ * @brief Gearbox Garmin GPS driver
+
+This driver provides a @ref interface_gps interface to Garmin GPS devices,
+as well as any other GPS device supported by the GbxGarminAcfr library. This
+should include most GPS devices that use NMEA to communicate.
+
+...@par Compile-time dependencies
+
+- Gearbox library GbxGarminAcfr
+
+...@par Provides
+
+- @ref interface_gps: Output GPS interface
+
+...@par Supported configuration requests
+
+- None.
+
+...@par Configuration file options
+
+ - read_gga (boolean)
+   - Default: true
+   - Read and parse GGA messages.
+ - read_vtg (boolean)
+   - Default: true
+   - Read and parse VTG messages.
+ - read_rme (boolean)
+   - Default: true
+   - Read and parse RME messages.
+ - ignore_unknown (boolean)
+   - Default: false
+   - Silently ignore unknown messages.
+ - port (string)
+   - Default: /dev/ttyS0
+   - Serial port the laser is connected to.
+ - debug (int)
+   - Default: 0
+   - Debugging level of the underlying library to get verbose output.
+ - pose (float 6-tuple: (m, m, m, rad, rad, rad))
+   - Default: [0.0 0.0 0.0 0.0 0.0 0.0]
+   - Pose (x, y, z, roll, pitch, yaw) of the laser relative to its parent 
object (e.g. the robot).
+ - size (float 3-tuple: (m, m, m))
+   - Default: [0.0 0.0 0.0]
+   - Size of the laser in metres.
+
+...@par Example
+
+...@verbatim
+driver
+(
+  name "gbxgarminacfr"
+  provides ["gps:0"]
+  port "/dev/ttyS0"
+)
+...@endverbatim
+
+...@author Geoffrey Biggs
+
+*/
+/** @} */
+
+#include <gbxgarminacfr/driver.h>
+#include <gbxutilacfr/trivialtracer.h>
+#include <gbxutilacfr/trivialstatus.h>
+#include <gbxutilacfr/mathdefs.h>
+
+#include <libplayercore/playercore.h>
+
+class GbxGarminAcfr : public ThreadedDriver
+{
+    public:
+        GbxGarminAcfr (ConfigFile* cf, int section);
+        ~GbxGarminAcfr (void);
+
+        virtual int MainSetup (void);
+        virtual void MainQuit (void);
+        virtual int ProcessMessage (QueuePointer &resp_queue, player_msghdr 
*hdr, void *data);
+
+    private:
+        virtual void Main (void);
+        bool ReadSensor (void);
+
+        // Configuration parameters
+        gbxgarminacfr::Config _config;
+        unsigned int _debug;
+        // Geometry
+        player_ranger_geom_t _geom;
+        player_pose3d_t _sensorPose;
+        player_bbox3d_t _sensorSize;
+        // Data storage
+        player_gps_data_t _gpsData;
+        // The hardware device itself
+        std::auto_ptr<gbxgarminacfr::Driver> _device;
+        // Objects to handle messages from the driver
+        std::auto_ptr<gbxutilacfr::TrivialTracer> _tracer;
+        std::auto_ptr<gbxutilacfr::TrivialStatus> _status;
+};
+
+Driver*
+GbxGarminAcfr_Init (ConfigFile* cf, int section)
+{
+    return reinterpret_cast <Driver*> (new GbxGarminAcfr (cf, section));
+}
+
+void gbxgarminacfr_Register(DriverTable* table)
+{
+    table->AddDriver ("gbxgarminacfr", GbxGarminAcfr_Init);
+}
+
+GbxGarminAcfr::GbxGarminAcfr (ConfigFile* cf, int section)
+    : ThreadedDriver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, 
PLAYER_RANGER_CODE)
+{
+    // Setup config object
+    _config.readGga = cf->ReadFloat (section, "read_gga", true);
+    _config.readVtg = cf->ReadFloat (section, "read_vtg", true);
+    _config.readRme = cf->ReadFloat (section, "read_rme", true);
+    _config.ignoreUnknown = cf->ReadInt (section, "ignore_unknown", false);
+    _config.device = cf->ReadString (section, "port", "/dev/ttyS0");
+    _debug = cf->ReadBool (section, "debug", 0);
+    // Set up geometry information
+    _geom.pose.px = cf->ReadTupleLength (section, "pose", 0, 0.0f);
+    _geom.pose.py = cf->ReadTupleLength (section, "pose", 1, 0.0f);
+    _geom.pose.pz = cf->ReadTupleLength (section, "pose", 2, 0.0f);
+    _geom.pose.proll = cf->ReadTupleAngle (section, "pose", 3, 0.0f);
+    _geom.pose.ppitch = cf->ReadTupleAngle (section, "pose", 4, 0.0f);
+    _geom.pose.pyaw = cf->ReadTupleAngle (section, "pose", 5, 0.0f);
+    _geom.size.sw = cf->ReadTupleLength (section, "size", 0, 0.0f);
+    _geom.size.sl = cf->ReadTupleLength (section, "size", 1, 0.0f);
+    _geom.size.sh = cf->ReadTupleLength (section, "size", 2, 0.0f);
+    _geom.sensor_poses_count = 1;
+    _geom.sensor_poses = &_sensorPose;
+    memcpy (_geom.sensor_poses, &_geom.pose, sizeof (_geom.pose));
+    _geom.sensor_sizes_count = 1;
+    _geom.sensor_sizes = &_sensorSize;
+    memcpy (_geom.sensor_sizes, &_geom.size, sizeof (_geom.size));
+
+    memset (&_gpsData, 0, sizeof (_gpsData));
+}
+
+GbxGarminAcfr::~GbxGarminAcfr (void)
+{
+}
+
+int GbxGarminAcfr::MainSetup (void)
+{
+    // Validate the configuration
+    if (!_config.isValid ())
+    {
+        PLAYER_ERROR ("GbxGarminAcfr: Invalid sensor configuration.\n");
+        return -1;
+    }
+
+    // Create status trackers
+    _tracer.reset (new gbxutilacfr::TrivialTracer (_debug));
+    _status.reset (new gbxutilacfr::TrivialStatus (*_tracer));
+
+    // Create the driver object
+    try
+    {
+        _device.reset (new gbxgarminacfr::Driver (_config, *_tracer, 
*_status));
+    }
+    catch (const std::exception& e)
+    {
+        PLAYER_ERROR1 ("GbxGarminAcfr: Failed to initialise GPS device: %s\n", 
e.what ());
+        return -1;
+    }
+
+    return 0;
+}
+
+void GbxGarminAcfr::MainQuit (void)
+{
+    _device.reset (NULL);
+    _status.reset (NULL);
+    _tracer.reset (NULL);
+}
+
+int GbxGarminAcfr::ProcessMessage (QueuePointer &resp_queue, player_msghdr 
*hdr, void *data)
+{
+    // Check for capability requests
+    HANDLE_CAPABILITY_REQUEST (device_addr, resp_queue, hdr, data, 
PLAYER_MSGTYPE_REQ, PLAYER_CAPABILTIES_REQ);
+    return -1;
+}
+
+void GbxGarminAcfr::Main (void)
+{
+    while (true)
+    {
+        pthread_testcancel ();
+        ProcessMessages ();
+
+        if (!ReadSensor ())
+            break;
+    }
+}
+
+bool GbxGarminAcfr::ReadSensor (void)
+{
+    std::auto_ptr<gbxgarminacfr::GenericData> data;
+
+    try
+    {
+        data = _device->read ();
+
+        // find out which data type it is
+        switch (data->type ())
+        {
+            case gbxgarminacfr::GpGga:
+            {
+                gbxgarminacfr::GgaData *d = 
reinterpret_cast<gbxgarminacfr::GgaData*> (data.get ());
+                _gpsData.time_sec = d->timeStampSec;
+                _gpsData.time_usec = d->timeStampUsec;
+                _gpsData.latitude = static_cast<int32_t> (d->latitude / 1e7);
+                _gpsData.longitude = static_cast<int32_t> (d->longitude / 1e7);
+                _gpsData.altitude = static_cast<int32_t> (d->altitude * 1000);
+                _gpsData.num_sats = d->satellites;
+                _gpsData.hdop = static_cast<uint32_t> 
(d->horizontalDilutionOfPosition * 10);
+                if (d->fixType == gbxgarminacfr::Autonomous)
+                    _gpsData.quality = 1;
+                else if (d->fixType == gbxgarminacfr::Differential)
+                    _gpsData.quality = 2;
+                else
+                    _gpsData.quality = 0;
+                break;
+            }
+            case gbxgarminacfr::GpVtg:
+            {
+                gbxgarminacfr::VtgData *d = 
reinterpret_cast<gbxgarminacfr::VtgData*> (data.get ());
+                _gpsData.time_sec = d->timeStampSec;
+                _gpsData.time_usec = d->timeStampUsec;
+                break;
+            }
+            case gbxgarminacfr::PgRme:
+            {
+                gbxgarminacfr::RmeData *d = 
reinterpret_cast<gbxgarminacfr::RmeData*> (data.get ());
+                _gpsData.time_sec = d->timeStampSec;
+                _gpsData.time_usec = d->timeStampUsec;
+                _gpsData.err_horz = d->horizontalPositionError;
+                _gpsData.err_vert = d->verticalPositionError;
+                break;
+            }
+            default:
+                PLAYER_WARN ("GbxGarminAcfr: Unknown message type received 
from GPS sensor.");
+        }
+        Publish (device_addr, PLAYER_MSGTYPE_DATA, PLAYER_GPS_DATA_STATE, 
reinterpret_cast<void*> (&_gpsData), sizeof (_gpsData), NULL);
+    }
+    catch (const std::exception &e)
+    {
+        PLAYER_ERROR1 ("GbxGarminAcfr: Failed to read data: %s\n", e.what ());
+        return false;
+    }
+
+    return true;
+}

Added: code/player/trunk/server/drivers/power/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/power/CMakeLists.txt                       
        (rev 0)
+++ code/player/trunk/server/drivers/power/CMakeLists.txt       2009-06-24 
13:25:20 UTC (rev 7888)
@@ -0,0 +1,9 @@
+PLAYERDRIVER_OPTION (oceanserver build_oceanserver ON)
+PLAYERDRIVER_REQUIRE_PKG (oceanserver build_oceanserver GbxSmartBatteryAcfr
+    gbxsmartbatteryacfr_includeDirs gbxsmartbatteryacfr_libDirs 
gbxsmartbatteryacfr_linkLibs
+    gbxsmartbatteryacfr_linkFlags gbxsmartbatteryacfr_cFlags)
+PLAYERDRIVER_ADD_DRIVER (oceanserver build_oceanserver
+    INCLUDEDIRS "${gbxsmartbatteryacfr_includeDirs}" LIBDIRS 
"${gbxsmartbatteryacfr_libDirs}"
+    LINKLIBS "${gbxsmartbatteryacfr_linkLibs}" LINKFLAGS 
"${gbxsmartbatteryacfr_linkFlags}"
+    CFLAGS "${gbxsmartbatteryacfr_cFlags}" SOURCES oceanserver.cc)
+

Added: code/player/trunk/server/drivers/power/oceanserver.cc
===================================================================
--- code/player/trunk/server/drivers/power/oceanserver.cc                       
        (rev 0)
+++ code/player/trunk/server/drivers/power/oceanserver.cc       2009-06-24 
13:25:20 UTC (rev 7888)
@@ -0,0 +1,257 @@
+/*
+ *  Player - One Hell of a Robot Server
+ *  Copyright (C) 2000-2003  Brian Gerkey [email protected]
+ *                           Andrew Howard [email protected]
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Desc: Driver wrapper around the Gearbox gbxsmartbatteryacfr library.
+// Author: Geoffrey Biggs
+// Date: 24/06/2009
+//
+// Provides - Power device.
+//
+///////////////////////////////////////////////////////////////////////////
+
+/** @ingroup drivers */
+/** @{ */
+/** @defgroup driver_gbxsmartbatteryacfr gbxsmartbatteryacfr
+ * @brief Gearbox SmartBattery driver for OceanServer devices.
+
+This driver provides a @ref interface_power interface to the OceanServer
+Smart Battery systems supported by the GbxSmartBatteryAcfr library.
+
+...@par Compile-time dependencies
+
+- Gearbox library GbxSmartBatteryAcfr
+
+...@par Provides
+
+- @ref interface_power: Output power interface
+
+...@par Supported configuration requests
+
+- None.
+
+...@par Configuration file options
+
+ - port (string)
+   - Default: /dev/ttyS0
+   - Serial port the laser is connected to.
+ - debug (int)
+   - Default: 0
+   - Debugging level of the underlying library to get verbose output.
+ - pose (float 6-tuple: (m, m, m, rad, rad, rad))
+   - Default: [0.0 0.0 0.0 0.0 0.0 0.0]
+   - Pose (x, y, z, roll, pitch, yaw) of the laser relative to its parent 
object (e.g. the robot).
+ - size (float 3-tuple: (m, m, m))
+   - Default: [0.0 0.0 0.0]
+   - Size of the laser in metres.
+
+...@par Example
+
+...@verbatim
+driver
+(
+  name "gbxsmartbatteryacfr"
+  provides ["power:0"]
+  port "/dev/ttyS0"
+)
+...@endverbatim
+
+...@author Geoffrey Biggs
+
+*/
+/** @} */
+
+#include <string>
+#include <gbxutilacfr/trivialtracer.h>
+#include <gbxsmartbatteryacfr/gbxsmartbatteryacfr.h>
+
+#include <libplayercore/playercore.h>
+
+class OceanServer : public ThreadedDriver
+{
+    public:
+        OceanServer (ConfigFile* cf, int section);
+        ~OceanServer (void);
+
+        virtual int MainSetup (void);
+        virtual void MainQuit (void);
+        virtual int ProcessMessage (QueuePointer &resp_queue, player_msghdr 
*hdr, void *data);
+
+    private:
+        virtual void Main (void);
+        bool ReadSensor (void);
+
+        // Configuration parameters
+        std::string _port;
+        unsigned int _debug;
+        // Geometry
+        player_ranger_geom_t _geom;
+        player_pose3d_t _sensorPose;
+        player_bbox3d_t _sensorSize;
+        // The hardware device itself
+        std::auto_ptr<gbxsmartbatteryacfr::OceanServer> _device;
+        // Objects to handle messages from the driver
+        std::auto_ptr<gbxutilacfr::TrivialTracer> _tracer;
+};
+
+Driver*
+OceanServer_Init (ConfigFile* cf, int section)
+{
+    return reinterpret_cast <Driver*> (new OceanServer (cf, section));
+}
+
+void oceanserver_Register(DriverTable* table)
+{
+    table->AddDriver ("oceanserver", OceanServer_Init);
+}
+
+OceanServer::OceanServer (ConfigFile* cf, int section)
+    : ThreadedDriver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, 
PLAYER_RANGER_CODE)
+{
+    // Setup config object
+    _port = cf->ReadString (section, "port", "/dev/ttyS0");
+    _debug = cf->ReadBool (section, "debug", 0);
+    // Set up geometry information
+    _geom.pose.px = cf->ReadTupleLength (section, "pose", 0, 0.0f);
+    _geom.pose.py = cf->ReadTupleLength (section, "pose", 1, 0.0f);
+    _geom.pose.pz = cf->ReadTupleLength (section, "pose", 2, 0.0f);
+    _geom.pose.proll = cf->ReadTupleAngle (section, "pose", 3, 0.0f);
+    _geom.pose.ppitch = cf->ReadTupleAngle (section, "pose", 4, 0.0f);
+    _geom.pose.pyaw = cf->ReadTupleAngle (section, "pose", 5, 0.0f);
+    _geom.size.sw = cf->ReadTupleLength (section, "size", 0, 0.0f);
+    _geom.size.sl = cf->ReadTupleLength (section, "size", 1, 0.0f);
+    _geom.size.sh = cf->ReadTupleLength (section, "size", 2, 0.0f);
+    _geom.sensor_poses_count = 1;
+    _geom.sensor_poses = &_sensorPose;
+    memcpy (_geom.sensor_poses, &_geom.pose, sizeof (_geom.pose));
+    _geom.sensor_sizes_count = 1;
+    _geom.sensor_sizes = &_sensorSize;
+    memcpy (_geom.sensor_sizes, &_geom.size, sizeof (_geom.size));
+}
+
+OceanServer::~OceanServer (void)
+{
+}
+
+int OceanServer::MainSetup (void)
+{
+    // Create status tracker
+    _tracer.reset (new gbxutilacfr::TrivialTracer (_debug));
+
+    // Create the driver object
+    try
+    {
+        _device.reset (new gbxsmartbatteryacfr::OceanServer (_port, *_tracer));
+    }
+    catch (const std::exception& e)
+    {
+        PLAYER_ERROR1 ("OceanServer: Failed to initialise device: %s\n", 
e.what ());
+        return -1;
+    }
+
+    return 0;
+}
+
+void OceanServer::MainQuit (void)
+{
+    _device.reset (NULL);
+    _tracer.reset (NULL);
+}
+
+int OceanServer::ProcessMessage (QueuePointer &resp_queue, player_msghdr *hdr, 
void *data)
+{
+    // Check for capability requests
+    HANDLE_CAPABILITY_REQUEST (device_addr, resp_queue, hdr, data, 
PLAYER_MSGTYPE_REQ, PLAYER_CAPABILTIES_REQ);
+    return -1;
+}
+
+void OceanServer::Main (void)
+{
+    while (true)
+    {
+        pthread_testcancel ();
+        ProcessMessages ();
+
+        if (!ReadSensor ())
+            break;
+    }
+}
+
+bool OceanServer::ReadSensor (void)
+{
+    try
+    {
+        gbxsmartbatteryacfr::OceanServerSystem data = _device->getData ();
+        player_power_data_t powerData;
+        memset (&powerData, 0, sizeof (powerData));
+
+        powerData.percent = data.percentCharge;
+        powerData.valid |= PLAYER_POWER_MASK_PERCENT;
+
+        float lowVoltage = -1;
+        for (unsigned int ii = 0; ii < 8; ii++)
+        {
+            if (!data.availableBatteries[ii])
+                continue;
+            powerData.valid |= PLAYER_POWER_MASK_VOLTS;
+            if (data.battery (ii).has (gbxsmartbatteryacfr::Voltage))
+            {
+                if (lowVoltage == -1)
+                    lowVoltage = data.battery (ii).voltage ();
+                else if (data.battery (ii).voltage () < lowVoltage)
+                    lowVoltage = data.battery (ii).voltage ();
+            }
+        }
+        powerData.volts = lowVoltage;
+
+        // First check if any batteries are charging
+        for (unsigned int ii = 0; ii < 8; ii++)
+        {
+            if (!data.availableBatteries[ii])
+                continue;
+            powerData.valid |= PLAYER_POWER_MASK_CHARGING;
+            if (data.chargingStates[ii])
+                powerData.charging = 1;
+        }
+        // Next check if any are discharing - because we have to squeeze
+        // up to 8 batteries into one status, give discharging priority over
+        // charging.
+        for (unsigned int ii = 0; ii < 8; ii++)
+        {
+            if (!data.availableBatteries[ii])
+                continue;
+            powerData.valid |= PLAYER_POWER_MASK_CHARGING;
+            if (data.supplyingPowerStates[ii])
+                powerData.charging = -1;
+        }
+
+        Publish (device_addr, PLAYER_MSGTYPE_DATA, PLAYER_POWER_DATA_STATE, 
reinterpret_cast<void*> (&powerData), sizeof (powerData), NULL);
+    }
+    catch (const std::exception &e)
+    {
+        PLAYER_ERROR1 ("OceanServer: Failed to read data: %s\n", e.what ());
+        return false;
+    }
+
+    return true;
+}
+

Modified: code/player/trunk/server/drivers/ranger/gbxsickacfr.cc
===================================================================
--- code/player/trunk/server/drivers/ranger/gbxsickacfr.cc      2009-06-24 
13:21:49 UTC (rev 7887)
+++ code/player/trunk/server/drivers/ranger/gbxsickacfr.cc      2009-06-24 
13:25:20 UTC (rev 7888)
@@ -78,10 +78,10 @@
  - size (float 3-tuple: (m, m, m))
    - Default: [0.0 0.0 0.0]
    - Size of the laser in metres.
-- retry (integer)
+ - retry (integer)
    - Default: 0
    - If the initial connection to the laser fails, retry this many times 
before giving up.
-- delay (integer)
+ - delay (integer)
    - Default: 0
    - Delay (in seconds) before laser is initialized (set this to 32-35 if you 
have a newer
      generation Pioneer whose laser is switched on when the serial port is 
open).


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to