Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MR Changes

git-svn-id: https://orca-robotics.svn.sf.net/svnroot/orca-robotics/orca/trunk@5706 534d5172-be3c-0410-9a3e-ccaa6372a113
  • Loading branch information...
commit 984bc13cf6d726735cadf49827afd306629bbd68 1 parent 3e979ba
borax00 authored
Showing with 1,217 additions and 578 deletions.
  1. +16 −0 doc/todo.dox
  2. +1 −0  scripts/matlab/sloccount/slocs.m
  3. +10 −17 src/components/bicycle/netthread.cpp
  4. +15 −20 src/components/faithlocaliser3d/mainthread.cpp
  5. +1 −1  src/components/propertyserver/CMakeLists.txt
  6. +12 −12 src/components/propertyserver/mainthread.cpp
  7. +2 −2 src/components/propertyserver/mainthread.h
  8. +2 −2 src/components/segwayrmp/mainthread.cpp
  9. +2 −5 src/components/wifi/fakedriver.cpp
  10. +3 −2 src/components/wifi/mainthread.cpp
  11. +70 −113 src/hydrodrivers/hydrosegwayrmpacfr/canio/canpeakrmpio.cpp
  12. +5 −7 src/hydrodrivers/hydrosegwayrmpacfr/canio/canpeakrmpio.h
  13. +122 −0 src/hydrodrivers/hydrosegwayrmpacfr/canio/peakutil.cpp
  14. +21 −0 src/hydrodrivers/hydrosegwayrmpacfr/canio/peakutil.h
  15. +6 −5 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/CMakeLists.txt
  16. +37 −0 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/canpeakrmpiotest.cpp
  17. 0  src/hydrodrivers/hydrosegwayrmpacfr/canio/test/{main.cpp → rmptestcan.cpp}
  18. +72 −0 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/testreadfromcan.cpp
  19. +7 −2 src/hydrodrivers/hydrosegwayrmpacfr/canpacket.cpp
  20. +2 −2 src/hydrodrivers/hydrosegwayrmpacfr/canpacket.h
  21. +0 −1  src/hydrodrivers/hydrosegwayrmpacfr/driver.cpp
  22. +0 −8 src/hydrodrivers/hydrosegwayrmpacfr/rawrxdata.cpp
  23. +1 −1  src/hydrodrivers/hydrosegwayrmpacfr/util/CMakeLists.txt
  24. 0  src/hydrodrivers/hydrosegwayrmpacfr/util/{test.cpp → hydrosegwayrmpacfrcantest.cpp}
  25. +1 −0  src/hydrolibs/CMakeLists.txt
  26. +172 −31 src/hydrolibs/hydrocolourtext/test/colourtest.cpp
  27. +2 −2 src/hydrolibs/hydronavutil/cov2d.h
  28. +2 −2 src/hydrolibs/hydronavutil/cov3d.h
  29. +2 −2 src/hydrolibs/hydronavutil/offset.h
  30. +2 −2 src/hydrolibs/hydronavutil/pose.h
  31. +24 −0 src/hydrolibs/hydropropertydb/CMakeLists.txt
  32. +1 −1  src/{components/propertyserver → hydrolibs/hydropropertydb}/propertydb.cpp
  33. +4 −4 src/{components/propertyserver → hydrolibs/hydropropertydb}/propertydb.h
  34. +3 −0  src/hydrolibs/hydroqguipath/ipathinput.h
  35. +76 −37 src/hydrolibs/hydroqguipath/simplepathdesigntablewidget.cpp
  36. +8 −11 src/hydrolibs/hydroqguipath/simplepathdesigntablewidget.h
  37. +33 −23 src/hydrolibs/hydroutil/stringutils.cpp
  38. +10 −8 src/hydrolibs/hydroutil/stringutils.h
  39. +31 −2 src/hydrolibs/hydrowifi/wifiutil.h
  40. +36 −3 src/interfaces/slice/orca/test.ice
  41. +7 −6 src/libs/orcaice/component.cpp
  42. +12 −23 src/libs/orcaice/component.h
  43. +6 −3 src/libs/orcaice/context.cpp
  44. +13 −4 src/libs/orcaice/context.h
  45. +79 −12 src/libs/orcaice/detail/componentthread.cpp
  46. +13 −3 src/libs/orcaice/detail/componentthread.h
  47. +5 −5 src/libs/orcaice/multiiceutils.cpp
  48. +12 −12 src/libs/orcaice/multiiceutils.h
  49. +9 −9 src/libs/orcaice/test/connecttest.cpp
  50. +12 −8 src/libs/orcaice/test/icetest.cpp
  51. +38 −47 src/libs/orcaicegrid/icegridsession.cpp
  52. +13 −16 src/libs/orcaicegrid/icegridsession.h
  53. +10 −0 src/libs/orcaqgui2dfactory/pathfollowerinput.cpp
  54. +2 −0  src/libs/orcaqgui2dfactory/pathfollowerinput.h
  55. +22 −0 src/libs/orcaqgui2dfactory/pathfolloweruserinteraction.cpp
  56. +9 −1 src/libs/orcaqgui2dfactory/pathfolloweruserinteraction.h
  57. +1 −0  src/libs/orcaqgui2dfactory/pathplannerinput.h
  58. +14 −21 src/libs/orcateleop/networkthread.cpp
  59. +17 −22 src/utils/probe/component.cpp
  60. +69 −49 src/utils/slice2orca/gen.cpp
  61. +6 −2 src/utils/slice2orca/gen.h
  62. +34 −7 src/utils/slice2orca/test/stringtest.cpp
View
16 doc/todo.dox
@@ -104,6 +104,18 @@ Developers: as you make substantial changes in the code (add features, fix bugs,
- feature: add a mechanism to ping admin interfaces (alexm)
- do general cleanup
+@section orca_doc_history_new Post 9.11 changes, to be merged in after sync.
+
+- libHydroColourText
+ - added options to colourtest to render a subset of all color combinations.
+
+- slice2orca
+ - fixed bug related to nested namespace definitions
+ - exceptions are no longer thrown when a null pointer to a class object are encountered in the following cases:
+ - toString(): "null pointer" is returned.
+ - zeroAndClear(): a null pointer is ignored.
+ - toLogStream(): still throws.
+
@section orca_doc_history_head Changes in SVN since Last Release
@par Project wide
@@ -390,6 +402,10 @@ ORCA_WRAP_COMPONENT_INTO_SERVICE( ${srcs} )
- libOrcaCompModel
-Registry information is now sorted alphabetically.
+@par Removed
+
+- SystemTracerMon
+
@section orca_doc_history_2130 Changes in Release 2.13.0
@par Project wide
View
1  scripts/matlab/sloccount/slocs.m
@@ -33,6 +33,7 @@
% sloccount cpp/include/ cpp/src/
Sice330 = 159523;
Sice331 = 162357;
+Sice340 = 175887;
% indeces
iyy=1;
View
27 src/components/bicycle/netthread.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -22,7 +22,7 @@ namespace bicycle {
namespace {
-void
+void
convert( const hydrointerfaces::Bicycle::Data& internal,
double wheelbase,
double referenceSpeed,
@@ -36,16 +36,16 @@ convert( const hydrointerfaces::Bicycle::Data& internal,
odometry2dData.pose.p.x = internal.x;
odometry2dData.pose.p.y = internal.y;
odometry2dData.pose.o = internal.yaw;
-
+
odometry2dData.motion.v.x = internal.vlong * cos( internal.steerAngle );
odometry2dData.motion.v.y = 0;
-
+
odometry2dData.motion.w =
internal.vlong * sin( internal.steerAngle ) /
(2.0 * M_PI * wheelbase );
odometry2dData.odometryWasReset = false;
-
+
driveBicycleData.timeStamp.seconds = internal.seconds;
driveBicycleData.timeStamp.useconds = internal.useconds;
@@ -55,7 +55,7 @@ convert( const hydrointerfaces::Bicycle::Data& internal,
driveBicycleData.currentSpeed = internal.vlong;
}
-void
+void
convert( const orca::DriveBicycleCommand& network, hydrointerfaces::Bicycle::Command& internal )
{
internal.vlong = network.speed;
@@ -88,16 +88,9 @@ NetThread::NetThread( HwThread &HwThread,
new orca::VehicleControlVelocityBicycleDescription(*controlDescr);
}
-void
+void
NetThread::initialise()
{
- // multi-try function
- context_.tracer().debug( "NetThread: activating..." );
- orcaice::activate( context_, this );
- // check for stop signal after retuning from multi-try
- if ( isStopping() )
- return;
-
// Initialise external interfaces, multi-try init functions
odometry2dI_ = new orcaifaceimpl::Odometry2dImpl( descr_, "Odometry2d", context_ );
odometry2dI_->initInterface( this );
@@ -120,7 +113,7 @@ NetThread::work()
std::string prefix = context_.tag() + ".Config.";
gbxiceutilacfr::Timer publishTimer;
- double publishInterval = orcaice::getPropertyAsDoubleWithDefault(
+ double publishInterval = orcaice::getPropertyAsDoubleWithDefault(
context_.properties(), prefix+"Odometry2dPublishInterval", 0 );
const int odometryReadTimeout = 500; // [ms]
@@ -162,7 +155,7 @@ NetThread::work()
odometry2dI_->localSetAndSend( odometry2dData );
driveBicycleI_->localSetAndSend( driveBicycleData );
publishTimer.restart();
- }
+ }
else {
odometry2dI_->localSet( odometry2dData );
}
@@ -202,7 +195,7 @@ NetThread::limit( hydrointerfaces::Bicycle::Command &cmd )
// This is a direct callback from the DriveBicycleImpl object.
// It's executed in Ice thread.
// Here we convert to our internal format pass it to HwThread
-void
+void
NetThread::handleData(const orca::DriveBicycleCommand& command)
{
stringstream ss;
View
35 src/components/faithlocaliser3d/mainthread.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -55,35 +55,30 @@ namespace {
}
}
-MainThread::MainThread( const orcaice::Context &context ) :
+MainThread::MainThread( const orcaice::Context &context ) :
orcaice::SubsystemThread( context.tracer(), context.status(), "MainThread" ),
context_(context)
{
}
-void
+void
MainThread::initialise()
{
setMaxHeartbeatInterval( 10.0 );
- orcaice::activate( context_, this, subsysName() );
- // check for stop signal after retuning from multi-try
- if ( isStopping() )
- return;
-
Ice::PropertiesPtr prop = context_.properties();
std::string prefix = context_.tag()+".Config.";
stdDevPosition_ = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"StdDevPosition", 0.05 );
stdDevOrientation_ = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"StdDevOrientation", 1.0 );
- minInterPublishPeriodSec_ = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MinInterPublishPeriodSec", 1.0 );
-
+ minInterPublishPeriodSec_ = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MinInterPublishPeriodSec", 1.0 );
+
initNetworkInterface();
}
void
MainThread::work()
{
-
+
// temp variables
orca::Localise3dData localiseData;
orca::Odometry3dData odomData;
@@ -92,7 +87,7 @@ MainThread::work()
const int timeoutMs = 1000;
setMaxHeartbeatInterval( timeoutMs/1e3 );
-
+
//
// MAIN LOOP
//
@@ -106,22 +101,22 @@ MainThread::work()
try
{
health().heartbeat();
- if ( odometry3dConsumer_->store().getNext( odomData, timeoutMs ) != 0 )
+ if ( odometry3dConsumer_->store().getNext( odomData, timeoutMs ) != 0 )
{
context_.tracer().debug( "Timeout waiting for data" );
continue;
}
-
+
double timeSincePublish = orcaice::timeDiffAsDouble( orcaice::getNow(), tLastPublish );
if ( timeSincePublish < minInterPublishPeriodSec_ )
continue;
-
+
odometryToLocalise( odomData, localiseData, varPosition, varOrientation );
- context_.tracer().debug( orcaobj::toString(localiseData), 5 );
+ context_.tracer().debug( orcaobj::toString(localiseData), 5 );
localiseInterface_->localSetAndSend( localiseData );
tLastPublish = orcaice::getNow();
}
- catch ( ... )
+ catch ( ... )
{
orcaice::catchMainLoopExceptions( health() );
}
@@ -135,7 +130,7 @@ MainThread::initNetworkInterface()
{
//
// EXTERNAL REQUIRED INTERFACES
- //
+ //
odometry3dConsumer_ = new orcaifaceimpl::StoringOdometry3dConsumerImpl(context_);
// multi-try function
odometry3dConsumer_->subscribeWithTag( "Odometry3d", this, subsysName() );
@@ -146,8 +141,8 @@ MainThread::initNetworkInterface()
orca::VehicleDescription vehicleDescription;
orcaice::getDescriptionWithTag<orca::Odometry3dPrx,orca::VehicleDescription>
( context_, "Odometry3d", vehicleDescription, this, subsysName() );
-
- //
+
+ //
// EXTERNAL PROVIDED INTERFACE
//
localiseInterface_ = new orcaifaceimpl::Localise3dImpl( vehicleDescription.geometry, "Localise3d", context_);
View
2  src/components/propertyserver/CMakeLists.txt
@@ -4,7 +4,7 @@ set( COMP_NAMESPACE propserver )
set( build TRUE )
GBX_REQUIRE_OPTION( build EXE ${APP_NAME} ON )
-set( dep_libs OrcaIfaceImpl OrcaIfaceUtil )
+set( dep_libs OrcaIfaceImpl OrcaIfaceUtil HydroPropertyDb )
GBX_REQUIRE_LIBS( build EXE ${APP_NAME} ${dep_libs} )
if( build)
View
24 src/components/propertyserver/mainthread.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -24,7 +24,7 @@ MainThread::MainThread( const orcaice::Context &context ) :
{
}
-void
+void
MainThread::initialise()
{
setMaxHeartbeatInterval( 20.0 );
@@ -43,7 +43,7 @@ MainThread::work()
while ( !isStopping() )
{
- try
+ try
{
// this blocks until new data arrives
const int TIMEOUT_MS = 1000;
@@ -55,20 +55,20 @@ MainThread::work()
ss << "Received new properties: " << ifaceutil::toString( incomingProperties );
context_.tracer().info( ss.str() );
- // Set our local database.
+ // Merge incoming properties with the local database.
propertyDb_.addProperties( incomingProperties.properties );
// Then inform the world
- orca::PropertiesData propData;
- propData.properties = propertyDb_.properties();
- propertiesInterface_->localSetAndSend( propData );
+ orca::PropertiesData resultantProperties;
+ resultantProperties.properties = propertyDb_.properties();
+ propertiesInterface_->localSetAndSend( resultantProperties );
}
health().ok();
continue;
} // end of try
- catch ( ... )
+ catch ( ... )
{
orcaice::catchMainLoopExceptions( health() );
}
@@ -95,8 +95,8 @@ MainThread::initPropertiesDb()
if ( !persistanceFile_.empty() )
{
try {
- std::map<std::string,std::string> propsFromFile = readFromFile( persistanceFile_ );
- cout<<"Properties loaded from persistance file: " << toString(propsFromFile) << endl;
+ std::map<std::string,std::string> propsFromFile = hydropropertydb::readFromFile( persistanceFile_ );
+ cout<<"Properties loaded from persistance file: " << hydropropertydb::toString(propsFromFile) << endl;
propertyDb_.addProperties( propsFromFile );
}
catch ( std::exception &e )
@@ -114,11 +114,11 @@ MainThread::initPropertiesDb()
map<string,string> props = context_.properties()->getPropertiesForPrefix(prefix);
map<string,string> strippedProps;
- for ( map<string,string>::const_iterator it=props.begin(); it!=props.end(); ++it )
+ for ( map<string,string>::const_iterator it=props.begin(); it!=props.end(); ++it )
{
strippedProps.insert( make_pair(it->first.substr(prefix.size()),it->second) );
}
- cout << "Properties loaded from config file: " << toString(strippedProps) << endl;
+ cout << "Properties loaded from config file: " << hydropropertydb::toString(strippedProps) << endl;
propertyDb_.addProperties( strippedProps );
}
View
4 src/components/propertyserver/mainthread.h
@@ -14,7 +14,7 @@
#include <orcaice/subsystemthread.h>
#include <orcaice/context.h>
#include <orcaifaceimpl/properties.h>
-#include "propertydb.h"
+#include <hydropropertydb/propertydb.h>
namespace propserver {
@@ -41,7 +41,7 @@ class MainThread : public orcaice::SubsystemThread
orcaifaceimpl::PropertiesImplPtr propertiesInterface_;
// The database of properties
- PropertyDb propertyDb_;
+ hydropropertydb::PropertyDb propertyDb_;
// Where we load/save our properties
std::string persistanceFile_;
View
4 src/components/segwayrmp/mainthread.cpp
@@ -97,10 +97,10 @@ MainThread::initialise()
for ( size_t i=0; i < powerbaseNames.size(); i++ )
{
- std::string stripPrefix = "";
+ std::string stripPrefix = prefix;
if ( powerbaseNames.size() > 1 )
{
- stripPrefix = powerbaseNames[i]+".";
+ stripPrefix += powerbaseNames[i]+".";
}
std::auto_ptr<hydrointerfaces::SegwayRmp> hydroDriver(
driverFactory->createDriver( powerbaseNames[i], context_.toHydroContext(stripPrefix) ) );
View
7 src/components/wifi/fakedriver.cpp
@@ -10,7 +10,7 @@
#include <orcaice/orcaice.h>
-#include <orcaobj/wifi.h>
+#include <orcaifaceutil/wifi.h>
#include "fakedriver.h"
@@ -22,13 +22,10 @@ void FakeDriver::read( orca::WifiData &data )
data.timeStamp = orcaice::getNow();
orca::WifiInterface w;
- orcaobj::setInit(w);
+ ifaceutil::zeroAndClear(w);
// Set some sane values
w.interfaceName = "fake";
- w.linkQuality = 60;
- w.signalLevel = -75;
- w.noiseLevel = -125;
data.interfaces.push_back( w );
}
View
5 src/components/wifi/mainthread.cpp
@@ -12,7 +12,7 @@
#include <vector>
#include <hydrowifi/wifiutil.h>
#include <orcaice/orcaice.h>
-#include <orcaobj/wifi.h>
+#include <orcaifaceutil/wifi.h>
#include "mainthread.h"
#include "hardwaredriver.h"
#include "fakedriver.h"
@@ -69,10 +69,11 @@ MainThread::work()
try
{
orca::WifiData data;
+ ifaceutil::zeroAndClear(data);
driver_->read( data );
context_.tracer().debug("Got new wifi data from driver. Sending it out now.", 3);
- context_.tracer().debug(orcaobj::toString( data ), 5);
+ context_.tracer().debug(ifaceutil::toString( data ), 5);
wifiInterface_->localSetAndSend( data );
View
183 src/hydrodrivers/hydrosegwayrmpacfr/canio/canpeakrmpio.cpp
@@ -25,10 +25,50 @@
#include <hydrointerfaces/segwayrmp.h> // for Exception
#include <gbxutilacfr/exceptions.h>
#include "canpeakrmpio.h"
+#include "peakutil.h"
using namespace std;
using namespace segwayrmpacfr;
+namespace {
+
+//***********************************************************************
+void
+convertCanPacketToPeak(TPCANMsg *peakCanOut, const CanPacket *pktIn ){
+
+ peakCanOut->ID = pktIn->id();
+ peakCanOut->LEN = CanPacket::CAN_DATA_SIZE;
+ memcpy(peakCanOut->DATA, pktIn->msg(), CanPacket::CAN_DATA_SIZE * sizeof(BYTE));
+
+ // Use the peak driver definition for a standard (not extended type message)
+ // Note that this does not match that used in the FDTI library (see below)
+ peakCanOut->MSGTYPE = MSGTYPE_STANDARD;
+}
+
+//***********************************************************************
+void
+convertPeakToCanPacket(CanPacket *pktOut, const TPCANMsg *peakCanIn )
+{
+ pktOut->setId( peakCanIn->ID );
+ assert( peakCanIn->LEN == CanPacket::CAN_DATA_SIZE );
+ memcpy(pktOut->msg(), peakCanIn->DATA, CanPacket::CAN_DATA_SIZE * sizeof(BYTE));
+
+ // NOTE:- We do not change the value in the flags field. It seems the
+ // different drivers peak / FDTI etc have different definitions of how a standard
+ // (not extended) can message is denoted.
+
+ /* These two never need to change and are set in the default constructor for CanPacket
+ pktOut -> flags = pktOut -> flags;
+ pktOut -> dlc = CAN_DATA_SIZE;
+ */
+
+}
+
+//*****************************************************************************
+
+}
+
+//////////////////////////////////////////////////////////////////////
//**************************************************************
// Take the name of the port and attempt to open it, throws an
@@ -44,7 +84,7 @@ CanPeakRmpIo::CanPeakRmpIo(const string & portName):
{
stringstream ss;
ss << "CanPeakRmpIo::constructor(): Error: "<<
- "Unable to open the can port-> " << portName << endl;
+ "Unable to open the can port '" << portName << "': "<<strerror(nGetLastError()) << endl;
// AlexB: I don't understand why, but a
// hydrointerfaces::SegwayRmp::Exception appears to result in a
// seg-fault
@@ -73,8 +113,7 @@ CanPeakRmpIo::~CanPeakRmpIo()
retVal = CAN_Close(portHandle_); // close access to the CAN port
if(retVal != 0 ){
ss << "CanPeakRmpIo::destructor(): Error: "<<
- "Unable to close can port. " << peakStatusToString(retVal) << endl;
-// throw hydrointerfaces::SegwayRmp::Exception(ss.str());
+ "Unable to close can port: " << errorInfo(retVal);
throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
portHandle_ = NULL; // clear the port handle
@@ -84,7 +123,7 @@ CanPeakRmpIo::~CanPeakRmpIo()
catch ( std::exception &e )
{
// Don't throw exceptions from destructor
- cout << e.what();
+ cout << e.what() << endl;
}
}
@@ -103,26 +142,28 @@ CanPeakRmpIo::readPacket(CanPacket &pkt){
assert ( isEnabled_ );
- RmpIo::RmpIoStatus status = NO_DATA;
-
// Using data structs from pcan.h
TPCANRdMsg canDataReceived;
// Call the peak library code
DWORD retVal = LINUX_CAN_Read_Timeout(portHandle_, &canDataReceived, timeOutMicroSeconds );
- if ( retVal == 0 ){
+ if ( retVal == 0 )
+ {
+ if ( canDataReceived.Msg.MSGTYPE != MSGTYPE_STANDARD )
+ {
+ cout<<"TRACE(canpeakrmpio.cpp): Ignoring special message: " << toString(canDataReceived) << endl;
+ return NO_DATA;
+ }
convertPeakToCanPacket(&pkt, &canDataReceived.Msg);
- status = OK;
- }else{
- if( debugLevel_ > 0){
- cout << "peakcandriver::readPacket(): Data Rx timed out, call returned "
- << peakStatusToString(retVal) << endl;
- }
- status = NO_DATA;
+ return OK;
+ }
+ else
+ {
+// if( debugLevel_ > 0)
+ cout << __func__ << ": LINUX_CAN_Read_Timeout failed (t="<<timeOutMicroSeconds<<"us). "<<errorInfo(retVal)<<endl;
+ return NO_DATA;
}
-
- return status;
}
@@ -158,8 +199,7 @@ void CanPeakRmpIo::writePacket(const CanPacket &pktToSend){
if( retVal != 0){
// The send data failed!
stringstream ss;
- ss << endl << " --> Attempted write data to CAN card failed: Call Returned "<<
- peakStatusToString(retVal) << endl;
+ ss << "LINUX_CAN_Write_Timeout failed. " << errorInfo(retVal);
throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
@@ -177,15 +217,8 @@ CanPeakRmpIo::enable(int debugLevel){
std::cout << "TRACE(peakcandriver.cpp): enable()" << endl;
}
- // get version info from the driver
- char textString[VERSIONSTRING_LEN];
- if ( CAN_VersionInfo(portHandle_,textString) == 0 ){
- if(debugLevel_ > 0)
- {std::cout << "Using Peak can driver:- version = " << textString << endl ;}
- }else{
- std::cout << "Peak can driver: failed to get version info\n";
- }
-
+ // Get the version
+ cout << __func__ << ": version: " << versionString(portHandle_) << endl;
// Force the default initialisation state of the CAN card. This should happen anyway
// But let's be explicit about it. We are set to 500K baud and extended can message type...
@@ -195,8 +228,7 @@ CanPeakRmpIo::enable(int debugLevel){
if( retVal != 0 ){
stringstream ss;
- ss << endl << " --> Attempted initialisation of the CAN card failed: Error Returned " <<
- peakStatusToString(retVal )<< endl;
+ ss << endl << " --> Attempted initialisation of the CAN card failed: " << errorInfo(retVal) << endl;
throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
@@ -204,7 +236,6 @@ CanPeakRmpIo::enable(int debugLevel){
// Potentially we could call the CAN_MsgFilter() from libpcan here to filter out some
// of the un-needed packets (ie heartbeat messages) at a low level. However I haven't
// been able to get this to work!
-
isEnabled_ = true;
}
@@ -214,89 +245,15 @@ CanPeakRmpIo::enable(int debugLevel){
//************************************************************************
// This function is just a place holder, and does very little
void
-CanPeakRmpIo::disable(void){
- DWORD retVal=0;
-
- if(debugLevel_ > 0)
- {
- retVal = CAN_Status(portHandle_);
- cout << "TRACE(peakcandriver.cpp): disable() CAN Status:- " <<
- peakStatusToString(retVal) << endl;
- }
+CanPeakRmpIo::disable(void)
+{
+// DWORD retVal=0;
+// if(debugLevel_ > 0)
+// {
+// retVal = CAN_Status(portHandle_);
+// cout << "TRACE(peakcandriver.cpp): disable() CAN Status:- " <<
+// peakStatusToString(retVal) << endl;
+// }
isEnabled_ = false;
}
-
-
-
-//***********************************************************************
-void
-CanPeakRmpIo::convertCanPacketToPeak(TPCANMsg *peakCanOut, const CanPacket *pktIn ){
-
- peakCanOut->ID = pktIn->id();
- peakCanOut->LEN = CanPacket::CAN_DATA_SIZE;
- memcpy(peakCanOut->DATA, pktIn->msg(), CanPacket::CAN_DATA_SIZE * sizeof(BYTE));
-
- // Use the peak driver definition for a standard (not extended type message)
- // Note that this does not match that used in the FDTI library (see below)
- peakCanOut->MSGTYPE = MSGTYPE_STANDARD;
-}
-
-//***********************************************************************
-void
-CanPeakRmpIo::convertPeakToCanPacket(CanPacket *pktOut, const TPCANMsg *peakCanIn ){
-
- pktOut->setId( peakCanIn->ID );
- memcpy(pktOut->msg(), peakCanIn->DATA, CanPacket::CAN_DATA_SIZE * sizeof(BYTE));
-
- // NOTE:- We do not change the value in the flags field. It seems the
- // different drivers peak / FDTI etc have different definitions of how a standard
- // (not extended) can message is denoted.
-
- /* These two never need to change and are set in the default constructor for CanPacket
- pktOut -> flags = pktOut -> flags;
- pktOut -> dlc = CAN_DATA_SIZE;
- */
-
-}
-
-//*****************************************************************************
-
-std::string
-CanPeakRmpIo::peakStatusToString (DWORD status){
- switch (status){
- case CAN_ERR_OK:
- return "CAN_ERR_OK"; // no error
- case CAN_ERR_XMTFULL:
- return "CAN_ERR_XMTFULL"; // transmit buffer full
- case CAN_ERR_OVERRUN:
- return "CAN_ERR_OVERRUN"; // overrun in receive buffer
- case CAN_ERR_BUSLIGHT:
- return "CAN_ERR_BUSLIGHT"; // bus error, errorcounter limit reached
- case CAN_ERR_BUSHEAVY:
- return "CAN_ERR_BUSHEAVY"; // bus error, errorcounter limit reached
- case CAN_ERR_BUSOFF:
- return "CAN_ERR_BUSOFF"; // bus error, 'bus off' state entered
- case CAN_ERR_QRCVEMPTY:
- return "CAN_ERR_QRCVEMPTY"; // receive queue is empty
- case CAN_ERR_QOVERRUN:
- return " CAN_ERR_QOVERRUN:"; // receive queue overrun
- case CAN_ERR_QXMTFULL:
- return "CAN_ERR_QXMTFULL"; // transmit queue full
- case CAN_ERR_REGTEST:
- return "CAN_ERR_REGTEST"; // test of controller registers failed
- case CAN_ERR_NOVXD:
- return "CAN_ERR_NOVXD"; // Win95/98/ME only
- case CAN_ERR_RESOURCE:
- return "CAN_ERR_RESOURCE"; // can't create resource
- case CAN_ERR_ILLPARAMTYPE:
- return "CAN_ERR_ILLPARAMTYPE"; // illegal parameter
- case CAN_ERR_ILLPARAMVAL:
- return "CAN_ERR_ILLPARAMVAL"; // value out of range
- case CAN_ERRMASK_ILLHANDLE:
- return "CAN_ERRMASK_ILLHANDLE"; // wrong handle, handle error
- default:
- return "CAN status unknown!";
- }
-
-}
View
12 src/hydrodrivers/hydrosegwayrmpacfr/canio/canpeakrmpio.h
@@ -35,7 +35,7 @@ class CanPeakRmpIo : public RmpIo, public hydroutil::Uncopyable
public:
// There should only be one instance of this class
- CanPeakRmpIo( const std::string & portName );
+ CanPeakRmpIo( const std::string &portName );
~CanPeakRmpIo();
// from RmpIo
@@ -49,13 +49,11 @@ class CanPeakRmpIo : public RmpIo, public hydroutil::Uncopyable
bool isEnabled_;
int debugLevel_;
- // Private methods to swap between the data representation for the PCMCIA card and
- // that used by the rest of the segwayrmp driver code....
- void convertCanPacketToPeak(TPCANMsg *peakCanOut, const CanPacket *pktIn);
- void convertPeakToCanPacket(CanPacket *pktOut, const TPCANMsg *peakCanIn);
+// // Private methods to swap between the data representation for the PCMCIA card and
+// // that used by the rest of the segwayrmp driver code....
+// void convertCanPacketToPeak(TPCANMsg *peakCanOut, const CanPacket *pktIn);
+// void convertPeakToCanPacket(CanPacket *pktOut, const TPCANMsg *peakCanIn);
- // String representation of the peak can card error
- std::string peakStatusToString(DWORD status);
gbxiceutilacfr::Timer writeTimer_;
}; // end of class declaration
View
122 src/hydrodrivers/hydrosegwayrmpacfr/canio/peakutil.cpp
@@ -0,0 +1,122 @@
+#include "peakutil.h"
+#include <iostream>
+#include <string.h>
+#include <sstream>
+#include <gbxutilacfr/exceptions.h>
+#include <iomanip>
+
+using namespace std;
+
+namespace segwayrmpacfr {
+
+ std::string versionString( HANDLE &portHandle )
+ {
+ char textBuf[VERSIONSTRING_LEN];
+ DWORD ret = CAN_VersionInfo( portHandle, textBuf );
+ if ( ret == 0 )
+ {
+ return textBuf;
+ }
+ else
+ {
+ stringstream ss;
+ ss << "CAN_VersionInfo failed (ret="<<ret<<"): "<<strerror(nGetLastError());
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+ }
+
+ std::string errorInfo( DWORD retVal )
+ {
+ stringstream ss;
+ ss << "(ret="<<retVal<<"="<<peakStatusToString(retVal)<<")";
+ return ss.str();
+ }
+
+ std::string errorInfoWithErrno( DWORD retVal )
+ {
+ stringstream ss;
+ ss << "(ret="<<retVal<<"="<<peakStatusToString(retVal)<<"): "<<strerror(nGetLastError());
+ return ss.str();
+ }
+
+std::string
+peakStatusToString (DWORD status){
+ switch (status){
+ case CAN_ERR_OK:
+ return "CAN_ERR_OK"; // no error
+ case CAN_ERR_XMTFULL:
+ return "CAN_ERR_XMTFULL"; // transmit buffer full
+ case CAN_ERR_OVERRUN:
+ return "CAN_ERR_OVERRUN"; // overrun in receive buffer
+ case CAN_ERR_BUSLIGHT:
+ return "CAN_ERR_BUSLIGHT"; // bus error, errorcounter limit reached
+ case CAN_ERR_BUSHEAVY:
+ return "CAN_ERR_BUSHEAVY"; // bus error, errorcounter limit reached
+ case CAN_ERR_BUSOFF:
+ return "CAN_ERR_BUSOFF"; // bus error, 'bus off' state entered
+ case CAN_ERR_QRCVEMPTY:
+ return "CAN_ERR_QRCVEMPTY"; // receive queue is empty
+ case CAN_ERR_QOVERRUN:
+ return " CAN_ERR_QOVERRUN:"; // receive queue overrun
+ case CAN_ERR_QXMTFULL:
+ return "CAN_ERR_QXMTFULL"; // transmit queue full
+ case CAN_ERR_REGTEST:
+ return "CAN_ERR_REGTEST"; // test of controller registers failed
+ case CAN_ERR_NOVXD:
+ return "CAN_ERR_NOVXD"; // Win95/98/ME only
+ case CAN_ERR_RESOURCE:
+ return "CAN_ERR_RESOURCE"; // can't create resource
+ case CAN_ERR_ILLPARAMTYPE:
+ return "CAN_ERR_ILLPARAMTYPE"; // illegal parameter
+ case CAN_ERR_ILLPARAMVAL:
+ return "CAN_ERR_ILLPARAMVAL"; // value out of range
+ case CAN_ERRMASK_ILLHANDLE:
+ return "CAN_ERRMASK_ILLHANDLE"; // wrong handle, handle error
+ default:
+ return "CAN status unknown.";
+ }
+}
+
+std::string messageTypeToString( BYTE messageType )
+{
+ switch ( messageType )
+ {
+ case 0x80:
+ return "STATUS";
+ case 0x02:
+ return "EXTENDED";
+ case 0x01:
+ return "RTR";
+ case 0x00:
+ return "STANDARD";
+ default:
+ return "Unknown";
+ }
+}
+
+namespace {
+ std::string toHexString( const BYTE *buf, int bufLen )
+ {
+ stringstream ss;
+ ss << "[ ";
+ for ( int i=0; i < bufLen; i++ )
+ {
+ ss <<hex<<std::setfill('0')<<std::setw(2)<<(int)(buf[i])<<" ";
+ }
+ ss << "]";
+ return ss.str();
+ }
+}
+
+std::string toString( const TPCANMsg &msg )
+{
+ stringstream ss;
+
+ ss << std::hex << "ID=0x" << (unsigned int)(msg.ID) << ", MSGTYPE=0x"<<(unsigned int)(msg.MSGTYPE)<<"("<<messageTypeToString(msg.MSGTYPE)<<"), LEN="<<(unsigned int)(msg.LEN)<<", DATA=";
+ ss << toHexString(msg.DATA,msg.LEN);
+
+ return ss.str();
+}
+
+}
+
View
21 src/hydrodrivers/hydrosegwayrmpacfr/canio/peakutil.h
@@ -0,0 +1,21 @@
+#ifndef SEGWAYRMPACFR_PEAKUTIL_H
+#define SEGWAYRMPACFR_PEAKUTIL_H
+
+#include <libpcan.h>
+#include <string>
+
+namespace segwayrmpacfr {
+
+ std::string versionString( HANDLE &portHandle );
+ std::string errorInfo( DWORD retVal );
+ // Call this only after an error occurs (checks errno)
+ std::string errorInfoWithErrno( DWORD retVal );
+ std::string peakStatusToString( DWORD status );
+
+ std::string messageTypeToString( BYTE messageType );
+ std::string toString( const TPCANMsg &msg );
+ inline std::string toString( const TPCANRdMsg &msg ) { return toString(msg.Msg); }
+
+}
+
+#endif
View
11 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/CMakeLists.txt
@@ -1,10 +1,11 @@
include( ${ORCA_CMAKE_DIR}/UseBasicRules.cmake )
-# to include driver files
include_directories( ${PROJECT_SOURCE_DIR}/src/hydrodrivers/hydrosegwayrmpacfr)
+GBX_ADD_EXECUTABLE( rmptestcan rmptestcan.cpp )
+target_link_libraries( rmptestcan HydroSegwayRmpAcfrCan HydroIceUtil GbxIceUtilAcfr HydroTime )
-#Tell the system to build a standalone app for us to use for testing
-GBX_ADD_EXECUTABLE( rmptestcan main.cpp )
+GBX_ADD_EXECUTABLE( testreadfromcan testreadfromcan.cpp )
+target_link_libraries( testreadfromcan pcan GbxUtilAcfr HydroSegwayRmpAcfrCan )
-#The target needs to be linked with these libraries
-target_link_libraries( rmptestcan HydroSegwayRmpAcfrCan HydroIceUtil GbxIceUtilAcfr HydroTime )
+GBX_ADD_EXECUTABLE( canpeakrmpiotest canpeakrmpiotest.cpp )
+target_link_libraries( canpeakrmpiotest pcan GbxUtilAcfr HydroSegwayRmpAcfrCan )
View
37 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/canpeakrmpiotest.cpp
@@ -0,0 +1,37 @@
+#include <iostream>
+#include "../canpeakrmpio.h"
+#include <gbxutilacfr/exceptions.h>
+
+using namespace std;
+using namespace segwayrmpacfr;
+
+//
+// Creates canpeakrmpio and reads packets
+//
+int main()
+{
+ CanPeakRmpIo rmp( "/dev/pcan40" );
+ const int debugLevel = 0;
+
+ while ( true )
+ {
+ try {
+ rmp.enable( debugLevel );
+ CanPacket pkt;
+ while ( true )
+ {
+ RmpIo::RmpIoStatus status = rmp.readPacket( pkt );
+ if ( status != RmpIo::OK )
+ {
+ throw gbxutilacfr::Exception( ERROR_INFO, "Bad read status" );
+ }
+ }
+ }
+ catch ( std::exception &e )
+ {
+ cout<<"TRACE(rmpsimpletest.cpp): " << e.what() << endl;
+ }
+ }
+
+ return 0;
+}
View
0  ...drodrivers/hydrosegwayrmpacfr/canio/test/main.cpp → ...vers/hydrosegwayrmpacfr/canio/test/rmptestcan.cpp
File renamed without changes
View
72 src/hydrodrivers/hydrosegwayrmpacfr/canio/test/testreadfromcan.cpp
@@ -0,0 +1,72 @@
+#include <iostream>
+#include <libpcan.h>
+#include <pcan.h>
+#include <fcntl.h> // for O_RDWR
+#include <sstream>
+#include <string.h>
+#include <gbxutilacfr/exceptions.h>
+#include "../peakutil.h"
+#include <iomanip>
+
+using namespace std;
+
+int main()
+{
+ const std::string portName = "/dev/pcan40";
+ HANDLE portHandle = LINUX_CAN_Open(portName.c_str(), O_RDWR);
+ if ( portHandle == NULL )
+ {
+ stringstream ss;
+ ss << "CanPeakRmpIo::constructor(): Error: "<<
+ "Unable to open the can port '" << portName << "': "<<strerror(nGetLastError());
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+
+ cout<<"TRACE(testcan.cpp): version: " << segwayrmpacfr::versionString(portHandle) << endl;
+
+ DWORD retVal = CAN_Init(portHandle, CAN_BAUD_500K, CAN_INIT_TYPE_EX );
+
+ if( retVal != 0 ){
+ stringstream ss;
+ ss << endl << " --> Attempted initialisation of the CAN card failed: " << segwayrmpacfr::errorInfo(retVal) << endl;
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+
+ while ( true )
+ {
+ try {
+ int numOK = 0;
+// for ( size_t i=0; i < 1000; i++ )
+ while ( true )
+ {
+ int nMicroSeconds = 12*1000;
+ TPCANRdMsg msg;
+ DWORD ret = LINUX_CAN_Read_Timeout( portHandle, &msg, nMicroSeconds );
+ if ( ret == 0 )
+ {
+// cout<<"TRACE(testcan.cpp): read message: " << segwayrmpacfr::toString(msg.Msg) << endl;
+ numOK++;
+ if ( numOK==1 )
+ cout<<"TRACE(testcan.cpp): read message: " << segwayrmpacfr::toString(msg.Msg) << endl;
+ if ( msg.Msg.ID==0 )
+ {
+ cout<<"TRACE(testcan.cpp): read message with ID 0x00: " << segwayrmpacfr::toString(msg.Msg) << endl;
+ return 1;
+ }
+ }
+ else
+ {
+ stringstream ss;
+ ss << "LINUX_CAN_Read_Timeout failed. "<<segwayrmpacfr::errorInfo(ret);
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+ }
+ }
+ catch ( std::exception &e )
+ {
+ cout<<"TRACE(testcan.cpp): " << e.what() << endl;
+ }
+ }
+
+ return 0;
+}
View
9 src/hydrodrivers/hydrosegwayrmpacfr/canpacket.cpp
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <sstream>
#include <gbxutilacfr/exceptions.h>
+#include <assert.h>
using namespace std;
@@ -40,7 +41,11 @@ CanPacket::CanPacket( uint32_t id )
// flags = canMSG_STD;
// dlc = 8; //Data Length Code
}
-
+void
+CanPacket::setId( uint32_t id )
+{
+ id_ = id;
+}
uint16_t CanPacket::getSlot(int s) const
{
return (uint16_t) ((msg_[s*2] << 8) | (msg_[s*2+1]));
@@ -55,7 +60,7 @@ void CanPacket::putSlot(const int slot, const uint16_t val)
char* CanPacket::toString() const
{
static char buf[256];
- sprintf(buf, "id_:%04lX %02X %02X %02X %02X %02X %02X %02X %02X",
+ sprintf(buf, "id:%04lX msg:%02X %02X %02X %02X %02X %02X %02X %02X",
id_, msg_[0], msg_[1], msg_[2], msg_[3], msg_[4], msg_[5],
msg_[6], msg_[7]);
View
4 src/hydrodrivers/hydrosegwayrmpacfr/canpacket.h
@@ -38,10 +38,10 @@ class CanPacket
// Always use all 8 bytes
static const int CAN_DATA_SIZE = 8;
- CanPacket( uint32_t id=0 );
+ CanPacket( uint32_t id=-1 );
// Sets the ID (what the RMP docs call the header)
- void setId( uint32_t id ) { id_ = id; }
+ void setId( uint32_t id );
// RMP has fixed-size messages
const uint16_t dataLengthCode() { return 0x0008; }
View
1  src/hydrodrivers/hydrosegwayrmpacfr/driver.cpp
@@ -394,7 +394,6 @@ Driver::readData()
while( canPacketsProcessed < maxCanPacketsProcessed && timeoutCount < maxTimeoutCount )
{
status = rmpIo_->readPacket( pkt );
-
if ( status == RmpIo::NO_DATA )
{
// too many of these and we'll exit the loop with an error.
View
8 src/hydrodrivers/hydrosegwayrmpacfr/rawrxdata.cpp
@@ -157,14 +157,6 @@ RawRxData::addPacket( const CanPacket &pkt )
cout<<"TRACE(rawrxdata.cpp): Ignoring Msg 0x414" << endl;
break;
}
- case 0x00:
- {
- // This seems to happen if the RMP is powered off.
- stringstream ss;
- ss << "RawRxData::"<<__func__<<"(): Received CAN packet with id 0x"<<std::hex<<pkt.id()<<". Looks like the RMP is powered off.";
- throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
- break;
- }
case 0x413:
{
stringstream ss;
View
2  src/hydrodrivers/hydrosegwayrmpacfr/util/CMakeLists.txt
@@ -2,6 +2,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )
if( buildCAN )
add_definitions( -DCAN_IO_DRIVER )
- GBX_ADD_EXECUTABLE( hydrosegwayrmpacfrcan test.cpp )
+ GBX_ADD_EXECUTABLE( hydrosegwayrmpacfrcan hydrosegwayrmpacfrcantest.cpp )
target_link_libraries( hydrosegwayrmpacfrcan HydroSegwayRmpAcfrCan )
endif( buildCAN )
View
0  src/hydrodrivers/hydrosegwayrmpacfr/util/test.cpp → ...osegwayrmpacfr/util/hydrosegwayrmpacfrcantest.cpp
File renamed without changes
View
1  src/hydrolibs/CMakeLists.txt
@@ -23,6 +23,7 @@ add_subdirectory( hydromapload ) # requires hydroogmap
add_subdirectory( hydronavutil )
add_subdirectory( hydrorobotdriverutil )
add_subdirectory( hydropathplan )
+add_subdirectory( hydropropertydb )
add_subdirectory( hydropublish )
add_subdirectory( hydrotime )
add_subdirectory( hydroscanutil ) # requires hydronavutil
View
203 src/hydrolibs/hydrocolourtext/test/colourtest.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2007-current Alex Brooks, Alex Makarenko
*
@@ -12,32 +12,74 @@
#include <iostream>
#include <vector>
#include <sstream>
+#include <unistd.h>
+#include <assert.h>
using namespace std;
using namespace hydroctext;
-int main()
+Attribute stringToAttribute( const std::string& s )
{
- std::vector<Attribute> attrs;
- std::vector<string> attrNames;
+ Attribute attr;
+ if ( s=="Bold" )
+ attr = Bold;
+ else if ( s=="Dim" )
+ attr = Dim;
+ else if ( s=="Underline" )
+ attr = Underline;
+ else if ( s=="Blink" )
+ attr = Blink;
+ else if ( s=="Reverse" )
+ attr = Reverse;
+ else if ( s=="NormalAttributes" )
+ attr = NormalAttributes;
+ else {
+ cout << "Could not parse attribute name: "<<s<<endl;
+ assert( false );
+ }
+ return attr;
+};
+Colour stringToColour( const std::string& s )
+{
+ Colour col;
+ if ( s=="Black" )
+ col = Black;
+ else if ( s=="Red" )
+ col = Red;
+ else if ( s=="Green" )
+ col = Green;
+ else if ( s=="Yellow" )
+ col = Yellow;
+ else if ( s=="Blue" )
+ col = Blue;
+ else if ( s=="Magenta" )
+ col = Magenta;
+ else if ( s=="Cyan" )
+ col = Cyan;
+ else if ( s=="White" )
+ col = White;
+ else if ( s=="DefaultColour" )
+ col = DefaultColour;
+ else {
+ cout << "Could not parse colour name: "<<s<<endl;
+ assert( false );
+ }
+ return col;
+};
+
+void setAllOptions( vector<Attribute>& attrs )
+{
attrs.push_back( Bold );
attrs.push_back( Dim );
attrs.push_back( Underline );
attrs.push_back( Blink );
attrs.push_back( Reverse );
attrs.push_back( NormalAttributes );
+}
- attrNames.push_back( "Bold ");
- attrNames.push_back( "Dim ");
- attrNames.push_back( "Underline ");
- attrNames.push_back( "Blink ");
- attrNames.push_back( "Reverse ");
- attrNames.push_back( "NormalAttributes");
-
- std::vector<Colour> colours;
- std::vector<string> colourNames;
-
+void setAllOptions( vector<Colour>& colours )
+{
colours.push_back( Black );
colours.push_back( Red );
colours.push_back( Green );
@@ -47,32 +89,131 @@ int main()
colours.push_back( Cyan );
colours.push_back( White );
colours.push_back( DefaultColour );
+}
+
+string toString( Attribute attr )
+{
+ string name;
+ switch ( attr )
+ {
+ case Bold :
+ name = "Bold ";
+ break;
+ case Dim :
+ name = "Dim ";
+ break;
+ case Underline :
+ name = "Underline ";
+ break;
+ case Blink :
+ name = "Blink ";
+ break;
+ case Reverse :
+ name = "Reverse ";
+ break;
+ case NormalAttributes :
+ name = "NormalAttributes";
+ break;
+ }
+ return name;
+}
+
+string toString( Colour colour )
+{
+ string name;
+ switch ( colour )
+ {
+ case Black :
+ name = "Black ";
+ break;
+ case Red :
+ name = "Red ";
+ break;
+ case Green :
+ name = "Green ";
+ break;
+ case Blue :
+ name = "Blue ";
+ break;
+ case Yellow :
+ name = "Yellow ";
+ break;
+ case Magenta :
+ name = "Magenta ";
+ break;
+ case Cyan :
+ name = "Cyan ";
+ break;
+ case White :
+ name = "White ";
+ break;
+ case DefaultColour :
+ name = "DefaultColour";
+ break;
+ }
+ return name;
+}
+
+int main( int argc, char **argv )
+{
+ std::vector<Attribute> attrs;
+ std::vector<Colour> fgColours;
+ std::vector<Colour> bgColours;
+
+ int opt;
+
+ // Get some options from the command line
+ while ((opt = getopt(argc, argv, "a:f:b:")) != -1)
+ {
+ switch ( opt )
+ {
+ case 'a':
+ attrs.push_back( stringToAttribute( string(optarg) ) );
+ break;
+ case 'f':
+ fgColours.push_back( stringToColour( string(optarg) ) );
+ break;
+ case 'b':
+ bgColours.push_back( stringToColour( string(optarg) ) );
+ break;
+ default:
+ cout << "Usage: " << argv[0] << " [-a attribute] [-f foreground] [-b background]" << endl << endl
+ << "-a attribute One of {Bold,Dim,Underline,Blink,Reverse,NormalAttributes}" << endl
+ << "-f foreground One of {Black,Red,Green,Yellow,Blue,Magenta,Cyan,White,DefaultColour}" << endl
+ << "-b background One of the colours above" << endl << endl
+ << "The unspecified options default to a vector of all possible values, resulting in a" << endl
+ << "{Nattr x Ncol x Ncol} combinations" << endl;
+ return 1;
+ }
+ }
+
+ if ( attrs.empty() )
+ setAllOptions( attrs );
- colourNames.push_back( "Black " );
- colourNames.push_back( "Red " );
- colourNames.push_back( "Green " );
- colourNames.push_back( "Yellow " );
- colourNames.push_back( "Blue " );
- colourNames.push_back( "Magenta " );
- colourNames.push_back( "Cyan " );
- colourNames.push_back( "White " );
- colourNames.push_back( "DefaultColour" );
+ if ( fgColours.empty() )
+ setAllOptions( fgColours );
+
+ if ( bgColours.empty() )
+ setAllOptions( bgColours );
+
+ cout<<"rendering "<<attrs.size()*fgColours.size()*bgColours.size()<<" combinations: "
+ "[A x F x B]=["<<attrs.size()<<"x"<<fgColours.size()<<"x"<<bgColours.size()<<"]"<<endl;
stringstream ss;
for ( size_t i=0; i <attrs.size(); i++ ) {
- for ( size_t j=0; j < colours.size(); j++ ) {
- for ( size_t k=0; k < colours.size(); k++ ) {
- ss << set( attrs[i], colours[j], colours[k] )
- << " attr: " << attrNames[i]
- << " fg: " << colourNames[j]
- << " bg: " << colourNames[k]
+ for ( size_t j=0; j < fgColours.size(); j++ ) {
+ for ( size_t k=0; k < bgColours.size(); k++ ) {
+ ss << set( attrs[i], fgColours[j], bgColours[k] )
+ << " attr: " << toString(attrs[i])
+ << " fg: " << toString(fgColours[j])
+ << " bg: " << toString(bgColours[k])
<< reset() << endl;
}
}
}
- ss << set( NormalAttributes, White ) << "asdfasdf" << reset() << " fdjksfds" << endl;
+// ss << set( NormalAttributes, White ) << "asdfasdf" << reset() << " fdjksfds" << endl;
// ss << set( NormalAttributes, Green );
// ss <<"TRACE(colourtest.cpp): blah" << endl;
@@ -95,7 +236,7 @@ int main()
// ss <<"TRACE(colourtest.cpp): before reset" << endl;
// ss << reset();
// ss <<"TRACE(colourtest.cpp): after reset" << endl;
-
+
cout << ss.str();
return 0;
View
4 src/hydrolibs/hydronavutil/cov2d.h
@@ -1,5 +1,5 @@
-#ifndef ORCANAVUTIL_COV2D_H
-#define ORCANAVUTIL_COV2D_H
+#ifndef HYDRONAVUTIL_COV2D_H
+#define HYDRONAVUTIL_COV2D_H
#include <iostream>
#include <assert.h>
View
4 src/hydrolibs/hydronavutil/cov3d.h
@@ -1,5 +1,5 @@
-#ifndef ORCANAVUTIL_COV3D_H
-#define ORCANAVUTIL_COV3D_H
+#ifndef HYDRONAVUTIL_COV3D_H
+#define HYDRONAVUTIL_COV3D_H
#include <cstdlib>
#include <iostream>
View
4 src/hydrolibs/hydronavutil/offset.h
@@ -7,8 +7,8 @@
* the LICENSE file included in this distribution.
*
*/
-#ifndef ORCA_NAV_UTIL_OFFSET__H
-#define ORCA_NAV_UTIL_OFFSET__H
+#ifndef HYDRONAVUTIL_OFFSET__H
+#define HYDRONAVUTIL_OFFSET__H
#include <iostream>
#include <gbxutilacfr/mathdefs.h>
View
4 src/hydrolibs/hydronavutil/pose.h
@@ -1,5 +1,5 @@
-#ifndef ORCANAVUTIL_POSE_H
-#define ORCANAVUTIL_POSE_H
+#ifndef HYDRONAVUTIL_POSE_H
+#define HYDRONAVUTIL_POSE_H
#include <cmath>
#include <iostream>
View
24 src/hydrolibs/hydropropertydb/CMakeLists.txt
@@ -0,0 +1,24 @@
+ORCA_SET_LIBRARY_NAME( HydroPropertyDb )
+GBX_ADD_LICENSE( LGPL )
+
+set( build TRUE )
+GBX_REQUIRE_OPTION( build LIB ${LIB_NAME} ON )
+GBX_REQUIRE_VAR( build LIB ${LIB_NAME} GBX_OS_LINUX "only Linux OS is supported" )
+
+#set( dep_libs GbxUtilAcfr HydroOgMap HydroUtil )
+#GBX_REQUIRE_LIBS( build LIB ${LIB_NAME} ${dep_libs} )
+
+if( build )
+
+ include( ${ORCA_CMAKE_DIR}/UseBasicRules.cmake )
+ include( ${GEARBOX_USE_FILE} )
+
+ file( GLOB hdrs *.h )
+ file( GLOB srcs *.cpp )
+
+ GBX_ADD_LIBRARY( ${LIB_NAME} DEFAULT ${LIB_VERSION} ${srcs} )
+ target_link_libraries( ${LIB_NAME} ${dep_libs} )
+
+ GBX_ADD_HEADERS( ${LIB_INSTALL} ${hdrs} )
+
+endif( build )
View
2  src/components/propertyserver/propertydb.cpp → src/hydrolibs/hydropropertydb/propertydb.cpp
@@ -9,7 +9,7 @@
using namespace std;
-namespace propserver {
+namespace hydropropertydb {
PropertyDb::PropertyDb()
{
View
8 src/components/propertyserver/propertydb.h → src/hydrolibs/hydropropertydb/propertydb.h
@@ -1,13 +1,13 @@
-#ifndef PROPSERVER_PROPERTYDB_H
-#define PROPSERVER_PROPERTYDB_H
+#ifndef HYDROPROPERTYDB_PROPERTYDB_H
+#define HYDROPROPERTYDB_PROPERTYDB_H
#include <string>
#include <map>
-namespace propserver {
+namespace hydropropertydb {
//
-// @brief Property Database
+// @brief A simplistic database of properties: key-value pairs.
//
// @author Alex Brooks
//
View
3  src/hydrolibs/hydroqguipath/ipathinput.h
@@ -66,6 +66,9 @@ class IPathInput
// get the gui path
virtual void getPath( hydroqguipath::GuiPath &guiPath, int &numLoops, float &timeOffset ) const = 0;
+ // table view
+ virtual void switchTableView( bool onOff ) = 0;
+
};
class IPathUserInteraction
View
113 src/hydrolibs/hydroqguipath/simplepathdesigntablewidget.cpp
@@ -1,17 +1,13 @@
#include <iostream>
-#include <QPainter>
-#include <QDialog>
-#include <QFile>
-#include <QFileDialog>
#include <QTextStream>
-#include <QComboBox>
-#include <QShortcut>
#include <QSpinBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QSettings>
+#include <QHeaderView>
+#include <QCloseEvent>
#include <sstream>
#include <hydroqgui/guiicons.h>
#include <hydroqguipath/ipathinput.h>
@@ -37,24 +33,39 @@ SimplePathDesignTableWidget::SimplePathDesignTableWidget( IPathInput *pathInput,
: pathInput_(pathInput),
designScreen_(designScreen)
{
+ const int buttonSizeX = 100;
+ const int buttonSizeY = 30;
+ const int buttonSpacing = 10;
+
// icons
QPixmap openIcon(fileopen_xpm);
QPixmap savePathIcon(filesave_path_xpm);
+ QPixmap sendIcon(send_xpm);
+ QPixmap cancelIcon(cancel_xpm);
setWindowTitle("Path Design");
wpTable_ = new SimplePathDesignTable( this, pathInput, guiPath, humanManager );
- QPushButton *savePath = new QPushButton(savePathIcon, tr("Save Path"), this);
- QPushButton *loadPath = new QPushButton(openIcon, tr("Load Path"), this);
- QPushButton *loadPreviousPath = new QPushButton(openIcon, tr("Load Previous Path"), this);
+ QPushButton *savePath = new QPushButton(savePathIcon, tr("Save As..."), this);
+ savePath->setFixedSize(buttonSizeX, buttonSizeY );
+ QPushButton *loadPath = new QPushButton(openIcon, tr("Load..."), this);
+ loadPath->setFixedSize(buttonSizeX, buttonSizeY );
+ QPushButton *loadPreviousPath = new QPushButton(openIcon, tr("Previous"), this);
+ loadPreviousPath->setFixedSize(buttonSizeX, buttonSizeY );
+ QPushButton *sendPath = new QPushButton(sendIcon, tr("Send"), this);
+ sendPath->setFixedSize(1.5*buttonSizeX,buttonSizeY);
+ QPushButton *cancelPath = new QPushButton(cancelIcon, tr("Discard"), this);
+ cancelPath->setFixedSize(1.5*buttonSizeX, buttonSizeY );
QObject::connect(savePath,SIGNAL(clicked()),this,SLOT(savePath()));
QObject::connect(loadPath,SIGNAL(clicked()),this,SLOT(loadPath()));
QObject::connect(loadPreviousPath,SIGNAL(clicked()),this,SLOT(loadPreviousPath()));
-
+ QObject::connect(sendPath,SIGNAL(clicked()),this,SLOT(sendPath()));
+ QObject::connect(cancelPath,SIGNAL(clicked()),this,SLOT(cancelPath()));
+
QVBoxLayout *globalLayout = new QVBoxLayout;
globalLayout->addWidget(wpTable_);
- QLabel *speedLabel = new QLabel("Approach speed default [m/s]:", this);
+ QLabel *speedLabel = new QLabel("Approach speed [m/s]:", this);
QDoubleSpinBox *maxApproachSpeedSpin = new QDoubleSpinBox(this);
maxApproachSpeedSpin->setFixedSize ( 70, 22 );
maxApproachSpeedSpin->setMinimum(0.0);
@@ -63,7 +74,7 @@ SimplePathDesignTableWidget::SimplePathDesignTableWidget( IPathInput *pathInput,
maxApproachSpeedSpin->setSingleStep(0.1);
QObject::connect(maxApproachSpeedSpin,SIGNAL(valueChanged(double)),this,SLOT(updateMaxApproachSpeedSetting(double)));
- QLabel *tolLabel = new QLabel("Distance tolerance default [m]:", this);
+ QLabel *tolLabel = new QLabel("Distance tolerance [m]:", this);
QDoubleSpinBox *maxDistToleranceSpin = new QDoubleSpinBox(this);
maxDistToleranceSpin->setFixedSize ( 70, 22 );
maxDistToleranceSpin->setMinimum(0.0);
@@ -77,45 +88,67 @@ SimplePathDesignTableWidget::SimplePathDesignTableWidget( IPathInput *pathInput,
grid->addWidget( maxApproachSpeedSpin, 0, 1, Qt::AlignLeft);
grid->addWidget( tolLabel, 1, 0, Qt::AlignLeft );
grid->addWidget( maxDistToleranceSpin, 1, 1, Qt::AlignLeft);
- grid->addWidget( loadPath, 2, 0);
- grid->addWidget( loadPreviousPath, 3, 0);
- grid->addWidget( savePath, 4, 0);
-
- globalLayout->addLayout(grid);
-
+ globalLayout->addLayout( grid );
// the second column can be stretched much more than the first (which stays fixed)
grid->setColumnStretch(1,1000);
+
+ QHBoxLayout *hBox1 = new QHBoxLayout;
+ hBox1->setSpacing( 2*buttonSpacing );
+ hBox1->addWidget( sendPath );
+ hBox1->addWidget( cancelPath );
+ hBox1->addStretch();
+ globalLayout->addLayout( hBox1 );
+
+ QHBoxLayout *hBox2 = new QHBoxLayout;
+ hBox2->setSpacing( buttonSpacing );
+ hBox2->addWidget( loadPath );
+ hBox2->addWidget( loadPreviousPath );
+ hBox2->addWidget( savePath );
+ hBox2->addStretch();
+ globalLayout->addLayout( hBox2 );
+
setLayout( globalLayout );
readSettings();
+
this->show();
}
SimplePathDesignTableWidget::~SimplePathDesignTableWidget()
{
+// cout << "SimplePathDesignTableWidget: destructor" << endl;
writeSettings();
}
+void
+SimplePathDesignTableWidget::closeEvent( QCloseEvent * event )
+{
+// cout << "SimplePathDesignTableWidget: closeEvent" << endl;
+ pathInput_->cancelPath();
+ event->accept();
+}
+
void SimplePathDesignTableWidget::readSettings()
{
- QSettings settings("Marathon Robotics", "RoverControl");
- QPoint pos = settings.value("simplepathdesigntable/pos", QPoint(200, 200)).toPoint();
- QSize size = settings.value("simplepathdesigntable/size", QSize(400, 400)).toSize();
- resize(size);
- move(pos);
+ QSettings settings;
+ settings.beginGroup("SimplePathDesignTableWidget");
+ resize(settings.value("size", QSize(400, 400)).toSize());
+ move(settings.value("pos", QPoint(200, 200)).toPoint());
+ settings.endGroup();
}
void SimplePathDesignTableWidget::writeSettings()
{
- QSettings settings("Marathon Robotics", "RoverControl");
- settings.setValue("simplepathdesigntable/pos", pos());
- settings.setValue("simplepathdesigntable/size", size());
+ QSettings settings;
+ settings.beginGroup("SimplePathDesignTableWidget");
+ settings.setValue("size", size());
+ settings.setValue("pos", pos());
+ settings.endGroup();
}
void
SimplePathDesignTableWidget::refreshTable()
{
-// wpTable_->computeVelocities();
wpTable_->refreshTable();
}
@@ -137,17 +170,17 @@ SimplePathDesignTableWidget::loadPreviousPath()
pathInput_->loadPreviousPath();
}
-// void
-// SimplePathDesignTableWidget::sendPath()
-// {
-// pathInput_->sendPath();
-// }
+void
+SimplePathDesignTableWidget::sendPath()
+{
+ pathInput_->sendPath();
+}
-// void
-// SimplePathDesignTableWidget::cancelPath()
-// {
-// pathInput_->cancelPath();
-// }
+void
+SimplePathDesignTableWidget::cancelPath()
+{
+ pathInput_->cancelPath();
+}
void
@@ -205,6 +238,7 @@ SimplePathDesignTable::SimplePathDesignTable( QWidget *parent,
setHorizontalHeaderLabels( columnHeaders );
resizeColumnsToContents();
+ this->horizontalHeader()->setStretchLastSection( true );
QObject::connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(updateDataStorage(int,int)));
QObject::connect(this,SIGNAL(cellClicked(int,int)),this,SLOT(setWaypointFocus(int,int)));
@@ -215,6 +249,11 @@ SimplePathDesignTable::SimplePathDesignTable( QWidget *parent,
}
+SimplePathDesignTable::~SimplePathDesignTable()
+{
+// cout << "SimplePathDesignTable: destructor" << endl;
+}
+
void SimplePathDesignTable::refreshTable()
{
isLocked_ = true;
View
19 src/hydrolibs/hydroqguipath/simplepathdesigntablewidget.h
@@ -11,14 +11,9 @@
#ifndef SIMPLEPATHDESIGN_TABLE_H
#define SIMPLEPATHDESIGN_TABLE_H
-#include <vector>
-#include <QWidget>
#include <QTableWidget>
-
#include <hydroqguipath/pathutils.h>
-class QSpinBox;
-
namespace hydroqguielementutil {
class IHumanManager;
}
@@ -30,7 +25,7 @@ class IPathInput;
class PathDesignScreen;
//!
-//! A class used to design paths by manipulating values in a table
+//! A widget for designing paths by manipulating values in a table
//!
//! @author Tobias Kaupp
//!
@@ -61,10 +56,13 @@ class SimplePathDesignTableWidget : public QWidget
void savePath();
void loadPath();
void loadPreviousPath();
-// void sendPath();
-// void cancelPath();
+ void sendPath();
+ void cancelPath();
void updateMaxApproachSpeedSetting(double);
void updateDistToleranceSetting(double);
+
+ protected:
+ virtual void closeEvent ( QCloseEvent * event );
};
@@ -77,6 +75,8 @@ class SimplePathDesignTable : public QTableWidget
IPathInput *pathInput,
GuiPath &guiPath,
hydroqguielementutil::IHumanManager &humanManager );
+ ~SimplePathDesignTable();
+
void refreshTable();
private:
@@ -85,9 +85,6 @@ class SimplePathDesignTable : public QTableWidget
GuiPath &guiPath_;
hydroqguielementutil::IHumanManager &humanManager_;
- // not part of the path representation
- std::vector<float> velocities_;
-
// lock up the cellUpdate signal: it should only be emitted if the user changes cell entries
// not if we programmatically change them (as in refreshTable)
bool isLocked_;
View
56 src/hydrolibs/hydroutil/stringutils.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -13,6 +13,7 @@
#include <sstream>
#include <iostream>
#include <iomanip> // for setw()
+#include <algorithm>
using namespace std;
@@ -74,6 +75,15 @@ toString( const std::vector<std::string>& seq, const char delim )
}
std::string
+toSortedString( const std::vector<std::string>& seq, const char delim )
+{
+ std::vector<std::string> sortedSeq = seq;
+ std::sort( sortedSeq.begin(), sortedSeq.end() );
+
+ return toString( sortedSeq, delim );
+}
+
+std::string
toLowerCase( const std::string & s )
{
std::string s2 = s;
@@ -96,18 +106,18 @@ toUpperCase( const std::string & s )
int toIntVector( const std::string& s, std::vector<int>& obj )
{
std::istringstream ss( s );
-
+
//check that there's something in the input stream
if ( !ss )
{
return -1;
}
-
+
int tmp;
while ( true )
{
ss >> tmp;
-
+
// if we're not at the end of the line but something went wrong, return error
if ( !ss && !ss.eof() )
{
@@ -115,14 +125,14 @@ int toIntVector( const std::string& s, std::vector<int>& obj )
}
obj.push_back( tmp );
-
+
// check if we're at the end of the line
if ( ss.eof() )
{
break;
}
}
-
+
// success
return 0;
}
@@ -130,39 +140,39 @@ int toIntVector( const std::string& s, std::vector<int>& obj )
int toDoubleVector( const std::string& s, std::vector<double>& obj )
{
std::istringstream ss( s );
-
+
//check that there's something in the input stream
if ( !ss )
{
return -1;
}
-
+
double tmp;
while ( true )
{
ss >> tmp;
-
+
// if we're not at the end of the line but something went wrong, return error
if ( !ss && !ss.eof() )
{
return -1;
}
-
+
obj.push_back( tmp );
-
+
// check if we're at the end of the line
if ( ss.eof() )
{
break;
}
}
-
+
// success
return 0;
}
-void
-substitute( string& v, const vector<string>& parameters,
+void
+substitute( string& v, const vector<string>& parameters,
const map<string,string>& values, const map<string,string>& defaults )
{
string::size_type beg = 0;
@@ -219,7 +229,7 @@ substitute( string& v, const vector<string>& parameters,
}
};
-std::string
+std::string
toFixedWidth( const std::string& s, int width, char filler, bool adjustLeft )
{
if ( width<0 )
@@ -228,35 +238,35 @@ toFixedWidth( const std::string& s, int width, char filler, bool adjustLeft )
if ( s.size()<(unsigned int)width ) {
// need padding
stringstream ss;
- if ( adjustLeft )
+ if ( adjustLeft )
ss<<std::left;
ss<<std::setfill(filler)<<std::setw(width)<<s;
return ss.str();
- }
+ }
else if ( s.size()>(unsigned int)width ) {
// need trunkating
return s.substr(0,width);
- }
+ }
else {
// needs no change
return s;
}
}
-std::string
+std::string
orcaVersion()
{
return std::string(PROJECT_VERSION);
}
-std::string
+std::string
basename( const std::string & path, bool removeExtension )
{
string filename;
// path delimeters are OS-dependent.
-#ifndef WIN32
+#ifndef WIN32
char delim = '/';
#else
char delim = '\\';
@@ -270,13 +280,13 @@ basename( const std::string & path, bool removeExtension )
return filename;
}
-std::string
+std::string
dirname( const std::string & path )
{
std::string dir;
// path delimeters are OS-dependent.
-#ifndef WIN32
+#ifndef WIN32
char delim = '/';
#else
char delim = '\\';
View
18 src/hydrolibs/hydroutil/stringutils.h
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -27,6 +27,8 @@ namespace hydroutil
std::vector<std::string> toStringSeq( const std::string& s, const char delim=':' );
//! Combines the sequence of strings into a single string using a given separator.
std::string toString( const std::vector<std::string>& seq, const char delim=':' );
+//! Same as above but the vector of strings is sorted first.
+std::string toSortedString( const std::vector<std::string>& seq, const char delim=':' );
//! Converts the whole string to lower case.
std::string toLowerCase( const std::string& s );
@@ -42,7 +44,7 @@ int toIntVector( const std::string &, std::vector<int>& );
//! Returns: 0 = parsing successful, non-zero = parsing failed.
int toDoubleVector( const std::string &, std::vector<double>& );
-/*!
+/*!
Performs parameter substitution in string the string provided.
Parameter syntax: ${parameter_name}. Valid parameters are given in @c parameters.
Substitution values are first looked up in @c values and then in @c defaults.
@@ -50,8 +52,8 @@ Throws gbxutilacfr::Exception if the string conatains an unknown parameter
or if the parameter has no value (provided or default).
Substitution can be recursive, provided that enough information is provided and the
-dependencies are not circular. For example @c var1.value="a", @c var2.default=$var1".
-Be careful, circular dependencies are not detected. For example, this will lead to an infinite loop:
+dependencies are not circular. For example @c var1.value="a", @c var2.default=$var1".
+Be careful, circular dependencies are not detected. For example, this will lead to an infinite loop:
@c var1.value="$var2", @c var2.value=$var1".
The input string can contain '${' without a matching '}'. These are ignored.
@@ -74,15 +76,15 @@ substitute( s, parameters, values, defaults );
cout<<s<endl; // output: "The best framework is Orca"
@endverbatim
*/
-void substitute( std::string& s, const std::vector<std::string>& parameters,
- const std::map<std::string,std::string>& values,
+void substitute( std::string& s, const std::vector<std::string>& parameters,
+ const std::map<std::string,std::string>& values,
const std::map<std::string,std::string>& defaults );
//! Unlike std::setw() function, this functions pads and truncates.
//! When width=0, an empty string is returned.
//! When width<0, the string is quietly returned unmodified.
//! Default fill character is a space.
-std::string toFixedWidth( const std::string& s, int width, char filler=' ',
+std::string toFixedWidth( const std::string& s, int width, char filler=' ',
bool adjustLeft=false );
//! Returns version of libOrcaIce, e.g. "3.2.1"
@@ -91,7 +93,7 @@ std::string orcaVersion();
//! Similar to UNIX basename command. Removes the path, i.e. all leading
//! characters up to the path delimeter ('/' in Linux, '\' in Windows).
//! E.g. basename("/path/filename.ext") returns "filename.txt".
-//! Unlike the Unix equivalent, this function returns an empty string
+//! Unlike the Unix equivalent, this function returns an empty string
//! when the intput string is a directory name.
//! E.g. basename("/path/" ) returns "".
//! If the optional flag removeExtension is set to TRUE, then all trailing
View
33 src/hydrolibs/hydrowifi/wifiutil.h
@@ -61,8 +61,20 @@ namespace wifiutil {
};
//! Wireless data structure for data obtainable from /etc/proc
- struct ProcData
- {
+ struct ProcData {
+ ProcData()
+ : interfaceName(""),
+ status(-1),
+ linkQuality(-1),
+ signalLevel(-1),
+ noiseLevel(-1),
+ numInvalidNwid(-1),
+ numInvalidCrypt(-1),
+ numInvalidFrag(-1),
+ numRetries(-1),
+ numInvalidMisc(-1),
+ numMissedBeacons(-1)
+ {}
std::string interfaceName;
int status;
int linkQuality;
@@ -98,6 +110,12 @@ namespace wifiutil {
//! Wireless config data structure
struct WirelessConfig
{
+ WirelessConfig()
+ : interfaceName(""),
+ mode(OperationModeUnknown),
+ bitrate(-1),
+ accessPoint("")
+ {}
std::string interfaceName;
OperationMode mode;
int bitrate;
@@ -118,6 +136,17 @@ namespace wifiutil {
//! Wireless data structure for ioctl-obtainable data
struct IoctlData
{
+ IoctlData()
+ : interfaceName(""),
+ throughPut(-1),
+ linkType(LinkQualityTypeUnknown),
+ linkQuality(-1),
+ signalLevel(-1),
+ noiseLevel(-1),
+ maxLinkQuality(-1),
+ maxSignalLevel(-1),
+ maxNoiseLevel(-1)
+ {}
std::string interfaceName;
int throughPut;
LinkQualityType linkType;
View
39 src/interfaces/slice/orca/test.ice
@@ -1,5 +1,5 @@
/*
- * Orca Project: Components for robotics
+ * Orca Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -18,7 +18,7 @@
// the base, and rangescanner2d does not.
#include <orca/polarfeature2d.ice>
#include <orca/rangescanner2d.ice>
-// should it be this?
+// should it be this?
// #include <orcaiface/polarfeature2d.ice>
// example of including an Ice Slice file
@@ -28,6 +28,21 @@
module test
{
+module sub
+{
+
+struct MyStruct2
+{
+ int mInt;
+};
+
+class MyClass10
+{
+ double mDouble;
+};
+
+};
+
enum MyEnum
{
Low,
@@ -64,6 +79,12 @@ class MyClass0
bool mBool;
};
+// special struct to test processing of null classes
+struct MyStruct2
+{
+ MyClass0 mClass;
+};
+
class MyClass1 extends MyClass0
{
int mInt;
@@ -75,7 +96,7 @@ class MyClass2 extends MyClass0
};
struct MyStruct1
-{
+{
MyStruct0 mStruct;
orca::FloatSeq mOrcaSeq;
MyStruct0Seq mSeq;
@@ -111,6 +132,18 @@ interface MyInterface1 extends MyInterface0
// idempotent IceStorm::Topic* topic();
};
+module subtest
+{
+ struct MyStruct0
+ {
+ int mInt;
+ };
+ struct MyStruct3
+ {
+ int mInt;
+ };
+};
+
}; // module
#endif
View
13 src/libs/orcaice/component.cpp
@@ -1,5 +1,5 @@
/*
- * Orca-Robotics Project: Components for robotics
+ * Orca-Robotics Project: Components for robotics
* http://orca-robotics.sf.net/
* Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
@@ -7,7 +7,7 @@
* the LICENSE file included in this distribution.
*
*/
-
+
#include <string>
#include <orca/common.h>
#include <orcaice/orcaice.h>
@@ -28,8 +28,9 @@ using namespace std;
namespace orcaice {
-Component::Component( const std::string& tag, ComponentInterfaceFlag interfaceFlag,
- ComponentAdapterActivationPolicy adapterPolicy ) :
+Component::Component( const std::string& tag,
+ ComponentInterfaceFlag interfaceFlag,
+ ComponentAdapterActivationPolicy adapterPolicy ) :
interfaceFlag_(interfaceFlag),
adapterPolicy_(adapterPolicy)
{
@@ -40,7 +41,7 @@ Component::Component( const std::string& tag, ComponentInterfaceFlag interfaceFl
// IMPORTANT! This destructor must be here (in the .cpp file)
// Otherwise, the destructors of the forward-declared types will not be called.
//
-Component::~Component()
+Component::~Component()
{
}
@@ -114,7 +115,7 @@ Component::init( const orca::FQComponentName& name,
status_->initInterface();
initTracerInfo( context_.tag() + ": Status interface initialized." );
}
-
+
if ( props->getPropertyAsInt( "Orca.Component.EnableHome" ) ) {
home_->initInterface();
initTracerInfo( context_.tag() + ": Home interface initialized." );