You can subscribe to this list here.
| 2008 |
Jan
|
Feb
(58) |
Mar
(15) |
Apr
(23) |
May
(8) |
Jun
(92) |
Jul
(66) |
Aug
(6) |
Sep
(9) |
Oct
(44) |
Nov
(8) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(10) |
Feb
(8) |
Mar
(2) |
Apr
(8) |
May
(19) |
Jun
(11) |
Jul
(8) |
Aug
(6) |
Sep
(5) |
Oct
(4) |
Nov
(26) |
Dec
(4) |
| 2010 |
Jan
(5) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
(16) |
Sep
(7) |
Oct
(3) |
Nov
(7) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rum...@us...> - 2008-07-11 06:43:23
|
Revision: 282
http://gearbox.svn.sourceforge.net/gearbox/?rev=282&view=rev
Author: rumataxyz
Date: 2008-07-10 23:43:33 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
corrected copy/paste error
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-11 06:42:59 UTC (rev 281)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-11 06:43:33 UTC (rev 282)
@@ -364,7 +364,7 @@
int gpsWeekNr; //!< number of full weeks since midnight 05/Jan/1980 (UTC)
unsigned int msIntoWeek; //!< yields GPS-time (together with @ref gpsWeekNr); continous (contrary to UTC which uses leapseconds)
GpsSolutionStatusType solutionStatus; //
- GpsPosVelType positionType; //
+ GpsPosVelType velocityType; //
float latency; //!< [s] gps speed can be calculated from instantanious or integrated doppler. The latter refers to the average speed over the last interval -> is delayed by half an interval
float diffAge; //!< [s]
double horizontalSpeed; //!< [m/s]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-11 06:42:50
|
Revision: 281
http://gearbox.svn.sourceforge.net/gearbox/?rev=281&view=rev
Author: rumataxyz
Date: 2008-07-10 23:42:59 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
clarified comment
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-10 09:50:14 UTC (rev 280)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-11 06:42:59 UTC (rev 281)
@@ -24,7 +24,7 @@
typedef struct Oem4BinaryHeader{ //offs, size, comment
uint8_t sb1; //0 1 0xaa
uint8_t sb2; //1 1 0x44
- uint8_t sb3; //2 1 0x12
+ uint8_t sb3; //2 1 0x12/0x13 , depending on long/short format
uint8_t headerLength; //3 1
uint16_t msgId; //4 2 which log we have
uint8_t msgType; //6 1 binary, ascii ...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-10 09:50:13
|
Revision: 280
http://gearbox.svn.sourceforge.net/gearbox/?rev=280&view=rev
Author: rumataxyz
Date: 2008-07-10 02:50:14 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
added include for limits.h, to get CHAR_BIT
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-10 09:42:52 UTC (rev 279)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-10 09:50:14 UTC (rev 280)
@@ -22,12 +22,14 @@
#include <iostream>
#include <iomanip>
#include <sstream>
+#include <vector>
+
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <errno.h>
-#include <vector>
+#include <limits.h>
#include <sys/time.h>
#include <time.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-10 09:43:09
|
Revision: 279
http://gearbox.svn.sourceforge.net/gearbox/?rev=279&view=rev
Author: rumataxyz
Date: 2008-07-10 02:42:52 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
overhaul of readNovatelMessage(); should be more clear, and does sane error reporting (throws)
added checks for endianness/size of various things/other parser assumptions
more detailed error-checking/reporting during initialisation
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-10 09:38:19 UTC (rev 278)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-10 09:42:52 UTC (rev 279)
@@ -56,20 +56,22 @@
// these guys are used to directly decode messages;
// obviously fails on endian mismatch, any sort of size mismatch and is rather nasty in general;
// feel free to implement something better
- // TODO: at least add runtime checking
gnua::BestGpsPosLogB bestGpsPos;
gnua::BestGpsVelLogB bestGpsVel;
gnua::InsPvaLogSB insPva;
gnua::RawImuLogSB rawImu;
};
#pragma pack(pop)
+ // this guy checks if the assumptions for the gear above are correct (abort()s through assert() otherwise)
+ void checkParserAssumptions();
+
int readNovatelMessage(union novatelMessage &msg, struct timeval &timeStamp, gbxserialacfr::Serial *serial);
std::auto_ptr<gna::GenericData> createExternalMsg(gnua::InsPvaLogSB &insPva, struct timeval &timeStamp);
std::auto_ptr<gna::GenericData> createExternalMsg(gnua::BestGpsPosLogB &bestGpsPos, struct timeval &timeStamp);
std::auto_ptr<gna::GenericData> createExternalMsg(gnua::BestGpsVelLogB &bestGpsVel, struct timeval &timeStamp);
std::auto_ptr<gna::GenericData> createExternalMsg(gnua::RawImuLogSB &rawImu, struct timeval &timeStamp, gnua::ImuDecoder *imuDecoder);
- //helper functions for the toString() gear
+ // helper functions for the toString() gear
std::string statusToString(gna::StatusMessageType statusMessageType, std::string statusMessage);
std::string doubleVectorToString(vector<double > &vec, std::string seperator = std::string(" "));
}
@@ -103,6 +105,8 @@
throw (gua::Exception(ERROR_INFO, "Invalid Configuration!"));
}
+ checkParserAssumptions();
+
// configure serial port
baud_ = config_.baudRate_;
std::string serialDevice = config_.serialDevice_;
@@ -167,9 +171,7 @@
i++;
}
if(false == correctBaudrate){
- std::stringstream ss;
- ss << "!Failed to establish a connection to the receiver! Check physical connections; Check manually (minicom) for Baudrates < 9600kb/s.";
- throw ( gua::Exception(ERROR_INFO, ss.str()) );
+ throw ( gua::Exception(ERROR_INFO, "!Failed to establish a connection to the receiver! Check physical connections; Check manually (minicom) for Baudrates < 9600kb/s."));
}
// ok, we've got a working link
std::stringstream ss;
@@ -182,9 +184,7 @@
sprintf( str,"com com1 %d n 8 1 n off on\r\n", baud_ );
serial_->writeString( str );
if(false == gnua::testConnectivity( challenge, ack, *(serial_.get()), timeOutMsec, maxTry, successThresh, baud_)){
- std::stringstream ss;
- ss << "!Failed to reset connection to configured baudrate!";
- throw ( gua::Exception(ERROR_INFO, ss.str()) );
+ throw ( gua::Exception(ERROR_INFO, "!Failed to reset connection to configured baudrate!"));
}
return;
}
@@ -203,7 +203,9 @@
// tell the novatel what serial port the imu is attached to (com3 == aux)
challenge = ( "interfacemode com3 imu imu on\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
// the type of imu being used
ss << "setimutype "
@@ -211,11 +213,15 @@
<< "\r\n";
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
challenge = "inscommand enable\r\n";
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
//force the IMU to re-align at every startup
//put = serial_->writeString( "inscommand reset\r\n" );
@@ -225,7 +231,9 @@
tracer_->info("No IMU, switching INS OFF!");
challenge = "inscommand disable\r\n";
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
return;
@@ -246,7 +254,9 @@
ss << "setimuorientation " << config_.setImuOrientation_ << "\r\n";
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
@@ -269,7 +279,9 @@
ss << "\r\n";
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
@@ -290,7 +302,9 @@
ss << "\r\n";
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ ss.str("");
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
return;
@@ -309,17 +323,23 @@
// make sure that fixposition has not been set
challenge = ( "fix none\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
// select the geodetic datum for operation of the receiver (wgs84 = default)
challenge = ( "datum wgs84\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
//Let the receiver figure out which range corrections are best
challenge = ( "PSRDIFFSOURCE AUTO\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
// CDGPS
@@ -327,7 +347,9 @@
tracer_->info("Turning on CDGPS!");
challenge = ( "ASSIGNLBAND CDGPS 1547547 4800\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
@@ -336,19 +358,25 @@
tracer_->info("Turning on SBAS!");
challenge = ( "SBASCONTROL ENABLE Auto 0 ZEROTOTWO\r\n");
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
//we try to use WAAS satellites even below the horizon
challenge = ( "WAASECUTOFF -5.0\r\n");
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
else{
tracer_->info("Turning off SBAS!");
challenge = ( "SBASCONTROL DISABLE Auto 0 NONE\r\n");
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
@@ -357,11 +385,15 @@
tracer_->info("Turning on RTK!");
challenge = ( "com com2,9600,n,8,1,n,off,on\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
challenge = ( "interfacemode com2 rtca none\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
@@ -369,13 +401,17 @@
//Let the receiver figure out which rtk corrections are best
challenge = ( "RTKSOURCE AUTO\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}else{
//We only use our own rtk corrections; _not_ OmniSTAR HP/XP
challenge = ( "RTKSOURCE RTCA ANY\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
- throw ( gua::Exception(ERROR_INFO, errorResponse));
+ std::stringstream ss;
+ ss << " Failure!\n Tried to send: " << challenge << " Receiver responded: " << errorResponse;
+ throw ( gua::Exception(ERROR_INFO, ss.str()));
}
}
return;
@@ -402,6 +438,7 @@
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
//throw ( gua::Exception(ERROR_INFO, errorResponse));
+ // unfortunately this simple approach doesn't work here. The 'ack' is usually lost in the binary data we've just requested
}
}
@@ -415,6 +452,7 @@
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
//throw ( gua::Exception(ERROR_INFO, errorResponse));
+ // unfortunately this simple approach doesn't work here. The 'ack' is usually lost in the binary data we've just requested
}
}
@@ -431,6 +469,7 @@
challenge = ss.str();
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
//throw ( gua::Exception(ERROR_INFO, errorResponse));
+ // unfortunately this simple approach doesn't work here. The 'ack' is usually lost in the binary data we've just requested
}
}
@@ -439,11 +478,12 @@
// raw accelerometer and gyro data
if(config_.enableRawImu_){
+ tracer_->info("Turning on raw imu data!");
challenge = ( "log rawimusb onnew\r\n" );
if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
//throw ( gua::Exception(ERROR_INFO, errorResponse));
+ // unfortunately this simple approach doesn't work here. The 'ack' is usually lost in the binary data we've just requested
}
- tracer_->info("Turning on raw imu data!");
}
return;
@@ -461,7 +501,7 @@
// Timeouts are not adjusted once a serial call returns;
// So we could be stuck here for longer than the set timeout.
int ret = serial_->bytesAvailableWait();
- if ( ret >= 0 ) {
+ if ( ret > 0 ) {
switch(readNovatelMessage(msg, timeStamp, serial_.get())){
case gnua::InsPvaSBLogType:
data = createExternalMsg(msg.insPva, timeStamp);
@@ -478,8 +518,7 @@
default:
{
std::stringstream ss;
- ss << "Warning("<<__FILE__<<":"<< __LINE__
- <<" : got unexpected message from receiver; id: " << msg.header.msgId << std::endl;
+ ss <<"Got unexpected message type from receiver; id: " << msg.header.msgId << std::endl;
if(config_.ignoreUnknownMessages_){
tracer_->warning(ss.str());
}else{
@@ -490,12 +529,9 @@
}
}
else {
- std::stringstream ss;
- ss << "Warning("<<__FILE__<<":"<< __LINE__
- << "Timed out while waiting for data";
- throw ( gua::Exception(ERROR_INFO, ss.str()) );
+ throw ( gua::Exception(ERROR_INFO, "Timed out while waiting for data"));
}
- }while(NULL == data.get()); // repeat till we get valid data
+ }while(NULL == data.get()); // repeat till we get a known message
return data;
}
@@ -845,61 +881,63 @@
} //namespace
namespace{
+ void
+ checkParserAssumptions(){
+ assert((8 == CHAR_BIT) && "Sorry our parser won't work on this platform");
+ assert((8 == sizeof(double)) && "Sorry our parser won't work on this platform");
+ assert((4 == sizeof(float)) && "Sorry our parser won't work on this platform");
+
+ union EndianCheck{
+ uint32_t full;
+ uint8_t bytes[4];
+ };
+ EndianCheck endianCheck;
+ endianCheck.bytes[0] = 0x21;
+ endianCheck.bytes[1] = 0x43;
+ endianCheck.bytes[2] = 0x65;
+ endianCheck.bytes[3] = 0x87;
+ assert(0x87654321 == endianCheck.full && "Sorry our parser won't work on this platform");
+ return;
+ }
+
int
readNovatelMessage(union novatelMessage &msg, struct timeval &timeStamp, gbxserialacfr::Serial *serial) {
// read the three sync bytes which are always at the start of the message header
- unsigned short id;
+ unsigned short id = -1;
unsigned long crc;
unsigned long in_crc;
msg.header.sb1 = 0;
- int skip = -1;
- int got;
- // read the first sync byte
+ // skip everything until we get the first sync byte
do{
- got = serial->readFull( &msg.header.sb1, 1 );
- if ( got <= 0 ) {
- return got;
+ if( 1 != serial->readFull( &msg.header.sb1, 1 )){
+ throw ( gua::Exception(ERROR_INFO, "Failure while reading trying to read sync byte 1 (possibly timeout) " ) );
}
- if( got>0 ) {
- skip++;
- }
}while( msg.header.sb1 != 0xaa );
// get timestamp after the first byte for accuracy
gettimeofday(&timeStamp, NULL);
- // read the second sync byte
- do {
- got = serial->readFull( &msg.header.sb2, 1 );
- if ( got <= 0 ) {
- return got;
- }
- }while( got!=1 );
-
- if( msg.header.sb2 != 0x44 ) {
- return -1;
+ // read the second and third sync byte
+ if( 1 != serial->readFull( &msg.header.sb2, 1 )
+ || msg.header.sb2 != 0x44 ) {
+ throw ( gua::Exception(ERROR_INFO, "Failure while reading trying to read sync byte 2 (possibly timeout) " ) );
}
+ if( 1 != serial->readFull( &msg.header.sb3, 1 )){
+ throw ( gua::Exception(ERROR_INFO, "Failure while reading trying to read sync byte 3 (possibly timeout) " ) );
+ }
- // read the third sync byte
- do {
- got = serial->readFull( &msg.header.sb3, 1 );
- if ( got <= 0 ) {
- return got;
- }
- }while( got != 1 );
-
switch( msg.header.sb3 ) {
case 0x12: //long packet
if( // how long is the header ?
- -1 == serial->readFull( &msg.header.headerLength, 1 )
+ 1 != serial->readFull( &msg.header.headerLength, 1 )
// read all of the header...
- || -1 == serial->readFull( &msg.header.msgId, msg.header.headerLength-4 )
+ || msg.header.headerLength-4 != serial->readFull( &msg.header.msgId, msg.header.headerLength-4 )
// read the message data
- || -1 == serial->readFull( &msg.data, msg.header.msgLength )
- || -1 == serial->readFull( &in_crc, 4 )
+ || msg.header.msgLength != serial->readFull( &msg.data, msg.header.msgLength )
+ || 4 != serial->readFull( &in_crc, 4 )
){
- return -1;
+ throw ( gua::Exception(ERROR_INFO, "Failure while reading trying to read long packet (possibly timeout) " ) );
}
id = msg.header.msgId;
@@ -910,11 +948,11 @@
case 0x13: //short packet
if( // read rest of the header 12 bytes - 3 bytes already read, then the actual data, then the CRC
- -1 == serial->readFull( &msg.shortHeader.msgLength, 9 )
- || -1 == serial->readFull( &msg.shortData, msg.shortHeader.msgLength )
- || -1 == serial->readFull( &in_crc, 4 )
+ 9 != serial->readFull( &msg.shortHeader.msgLength, 9 )
+ || msg.shortHeader.msgLength != serial->readFull( &msg.shortData, msg.shortHeader.msgLength )
+ || 4 != serial->readFull( &in_crc, 4 )
){
- return -1;
+ throw ( gua::Exception(ERROR_INFO, "Failure while reading trying to read short packet (possibly timeout) " ) );
}
id = msg.shortHeader.msgId;
@@ -923,11 +961,10 @@
break;
default: //bollocks
- return -1;
+ throw ( gua::Exception(ERROR_INFO, "Unknown binary packet type" ) );
}
if(in_crc != crc) {
- fprintf( stderr,"CRC Error: 0x%lx, 0x%lx\n",in_crc,crc );
throw ( gua::Exception(ERROR_INFO, "CRC Error" ) );
return -1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-10 09:38:16
|
Revision: 278
http://gearbox.svn.sourceforge.net/gearbox/?rev=278&view=rev
Author: rumataxyz
Date: 2008-07-10 02:38:19 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
fiddled with docu
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-10 07:43:48 UTC (rev 277)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-10 09:38:19 UTC (rev 278)
@@ -35,8 +35,8 @@
//! Minimum information to configure the receiver in INS mode
class SimpleConfig{
public:
- //! @param imuType see Config::imuType_ for details
- //! @param imuToGpsOffset see Config::imuToGpsOffset_ for details
+ //! @param imuType see @ref Config::imuType_ for details
+ //! @param imuToGpsOffset see @ref Config::imuToGpsOffset_ for details
SimpleConfig(std::string serialDevice, int baudRate, std::string imuType, std::vector<double > &imuToGpsOffset):
serialDevice_(serialDevice),
baudRate_(baudRate),
@@ -153,7 +153,7 @@
//
//!@{
std::vector<double > imuToGpsOffset_; //!< vector (xyz [m]) from IMU center to Antenna Phase Center, in IMU coordinates, vital for INS performance, make sure you get this right!
- std::vector<double > imuToGpsOffsetUncertainty_; //!< optional (size 3 or 0)
+ std::vector<double > imuToGpsOffsetUncertainty_; //!< optional (size 3 or 0) xyz; !it is unclear to me whether these are factors, or absolute values (in [m])!
bool enableInsOffset_;
std::vector<double > insOffset_; //!< report INS position/velocity offset (xyz [m] in IMU coordinates) from the IMU center; useful e.g. to get data w.r. to robot's center of rotation
bool enableInsPhaseUpdate_; //!< tightly coupled (phase based vs position based) filter; Chance of better performance in adverse conditions
@@ -219,6 +219,7 @@
ImuUnplugged, //!< No IMU detected
Pending, //!< When a FIX POSITION command is entered, the receiver computes its own position and determines if the fixed position is valid
InvalidFix, //!< The fixed position, entered using the FIX POSITION command, is not valid
+ ReservedGpsSolutionStatusType,
UnknownGpsSolutionStatusType
};
@@ -253,6 +254,7 @@
OmniStarHp, //!< OmniSTAR high precision a
OmniStarXp, //!< OmniSTAR extra precision a
CdGps, //!< Position solution using CDGPS corrections
+ ReservedGpsPosVelType,
UnknownGpsPosVelType
};
@@ -291,7 +293,7 @@
double longitude; //!< [deg] east positive WGS84
double height; //!< [m] above ellipsoid WGS84 (heigth_ellipsoid - undulation == height_geoid (aka AMSL)
- //!@name Orientation
+ //!@name Velocity vector
//!Relativ to true North/East and geoid vertical (I think)
//
//@{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-10 07:43:40
|
Revision: 277
http://gearbox.svn.sourceforge.net/gearbox/?rev=277&view=rev
Author: gbiggs
Date: 2008-07-10 00:43:48 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
Added OpenRTM to the list of users
Modified Paths:
--------------
gearbox/trunk/doc/users.dox
Modified: gearbox/trunk/doc/users.dox
===================================================================
--- gearbox/trunk/doc/users.dox 2008-07-10 07:35:38 UTC (rev 276)
+++ gearbox/trunk/doc/users.dox 2008-07-10 07:43:48 UTC (rev 277)
@@ -18,6 +18,7 @@
- <a href="http://orca-robotics.sf.net">Orca</a>
- <a href="http://playerstage.sf.net">Player</a>
+- <a href="http://www.is.aist.go.jp/rt/OpenRTM-aist/">OpenRTM-aist</a>
@par Projects
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-10 07:35:28
|
Revision: 276
http://gearbox.svn.sourceforge.net/gearbox/?rev=276&view=rev
Author: gbiggs
Date: 2008-07-10 00:35:38 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
Updated gentoo installation instructions
Modified Paths:
--------------
gearbox/trunk/doc/install_gentoo.dox
Added Paths:
-----------
gearbox/trunk/dist/gearbox.ebuild
Removed Paths:
-------------
gearbox/trunk/dist/gearbox-1.1.ebuild
Deleted: gearbox/trunk/dist/gearbox-1.1.ebuild
===================================================================
--- gearbox/trunk/dist/gearbox-1.1.ebuild 2008-07-10 06:00:03 UTC (rev 275)
+++ gearbox/trunk/dist/gearbox-1.1.ebuild 2008-07-10 07:35:38 UTC (rev 276)
@@ -1,43 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit cmake-utils
-
-SLOT="0"
-LICENSE="GPL-2"
-KEYWORDS="~x86 ~amd64"
-DESCRIPTION="A collection of libraries for robotics, including hardware drivers and algorithms."
-SRC_URI="/${P}.tar.bz2"
-HOMEPAGE="http://gearbox.sourceforge.net"
-IUSE="doc basic gbxadvanced gbxgarminacfr gbxserialacfr gbxsickacfr gbxsmartbatteryacfr gbxutilacfr hokuyo_aist"
-DEPEND=">=dev-util/cmake-2.4
- doc? (app-doc/doxygen)"
-RDEPEND=${DEPEND}
-
-S=${WORKDIR}/${PN}
-
-src_compile()
-{
- local mycmakeargs="`cmake-utils_use_enable basic LIB_BASIC`\
- `cmake-utils_use_enable gbxadvanced LIB_GBXADVANCED`\
- `cmake-utils_use_enable gbxgarminacfr LIB_GBXGARMINACFR`\
- `cmake-utils_use_enable gbxserialacfr LIB_GBXSERIALACFR`\
- `cmake-utils_use_enable gbxsickacfr LIB_GBXSICKACFR`\
- `cmake-utils_use_enable gbxsmartbatteryacfr LIB_GBXSMARTBATTERYACFR`\
- `cmake-utils_use_enable gbxutilacfr LIB_GBXUTILACFR`\
- `cmake-utils_use_enable hokuyo_aist LIB_HOKUYO_AIST`"
- cmake-utils_src_compile
- if use doc;
- then
- cd doc
- doxygen doxyfile || die "Error building documentation"
- fi
-}
-
-src_install ()
-{
- cmake-utils_src_install
- dodoc LICENSE
- use doc && dohtml -r doc/html/*
-}
\ No newline at end of file
Copied: gearbox/trunk/dist/gearbox.ebuild (from rev 273, gearbox/trunk/dist/gearbox-1.1.ebuild)
===================================================================
--- gearbox/trunk/dist/gearbox.ebuild (rev 0)
+++ gearbox/trunk/dist/gearbox.ebuild 2008-07-10 07:35:38 UTC (rev 276)
@@ -0,0 +1,43 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit cmake-utils
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~amd64"
+DESCRIPTION="A collection of libraries for robotics, including hardware drivers and algorithms."
+SRC_URI="/${P}.tar.bz2"
+HOMEPAGE="http://gearbox.sourceforge.net"
+IUSE="doc basic gbxadvanced gbxgarminacfr gbxserialacfr gbxsickacfr gbxsmartbatteryacfr gbxutilacfr hokuyo_aist"
+DEPEND=">=dev-util/cmake-2.4
+ doc? (app-doc/doxygen)"
+RDEPEND=${DEPEND}
+
+S=${WORKDIR}/${PN}
+
+src_compile()
+{
+ local mycmakeargs="`cmake-utils_use_enable basic LIB_BASIC`\
+ `cmake-utils_use_enable gbxadvanced LIB_GBXADVANCED`\
+ `cmake-utils_use_enable gbxgarminacfr LIB_GBXGARMINACFR`\
+ `cmake-utils_use_enable gbxserialacfr LIB_GBXSERIALACFR`\
+ `cmake-utils_use_enable gbxsickacfr LIB_GBXSICKACFR`\
+ `cmake-utils_use_enable gbxsmartbatteryacfr LIB_GBXSMARTBATTERYACFR`\
+ `cmake-utils_use_enable gbxutilacfr LIB_GBXUTILACFR`\
+ `cmake-utils_use_enable hokuyo_aist LIB_HOKUYO_AIST`"
+ cmake-utils_src_compile
+ if use doc;
+ then
+ cd doc
+ doxygen doxyfile || die "Error building documentation"
+ fi
+}
+
+src_install ()
+{
+ cmake-utils_src_install
+ dodoc LICENSE
+ use doc && dohtml -r doc/html/*
+}
\ No newline at end of file
Modified: gearbox/trunk/doc/install_gentoo.dox
===================================================================
--- gearbox/trunk/doc/install_gentoo.dox 2008-07-10 06:00:03 UTC (rev 275)
+++ gearbox/trunk/doc/install_gentoo.dox 2008-07-10 07:35:38 UTC (rev 276)
@@ -12,7 +12,7 @@
@page gbx_doc_installgentoo Installing GearBox on Gentoo Linux
-@note Reviewed for release 0.0.1
+@note Reviewed for release 1.1
These are detailed instructions for installing GearBox on Gentoo Linux. See @ref gbx_doc_getting for general guidelines.
@@ -27,7 +27,7 @@
@section gbx_doc_installgentoo_copyebuild Download and copy ebuild
-Download the Gearbox ebuild from the GearBox download page. This ebuild must be copied into the local overlay so that portage can
+Download the Gearbox ebuild from the Gearbox download page. This ebuild must be copied into the local overlay so that portage can
find it. Extract the downloaded files into your local overlay directory. This should create a subdirectory called \b dev-libs with
a subdirectory called \b gearbox inside it.
@@ -48,18 +48,26 @@
specifying them on the command line, for example:
@verbatim
-USE="urg_nz" emerge gearbox -av
+USE="hokuyo_aist" emerge gearbox -av
@endverbatim
Alternatively, they can be set more permanantly be specifying them in /etc/portage/package.use:
@verbatim
-dev-libs/gearbox urg_nz
+dev-libs/gearbox hokuyo_aist
@endverbatim
A full list of available USE flags is given below. For a list of those provided by your current ebuild for Gearbox,
run \b equery \b uses \b gearbox.
-<table><tr><td>urg_nz</td><td>Enables the "urgnz" Hokuyo URG laser driver library</td></tr>
+<table><tr><td>doc</td><td>Installs the documentation</td></tr>
+<tr><td>basic</td><td>Enable the basic example library.</td></tr>
+<tr><td>gbxadvanced</td><td>Enable the advanced example library.</td></tr>
+<tr><td>gbxgarminacfr</td><td>Enabled the GbxGarminAcfr GPS driver.</td></tr>
+<tr><td>gbxserialacfr</td><td>Enable the GbxSerialAcfr serial communications library.</td></tr>
+<tr><td>gbxsickacfr</td><td>Enable the GbxSickAcfr SICK laser scanner driver.</td></tr>
+<tr><td>gbxsmartbatteryacfr</td><td>Enable the GbxSmartBatteryAcfr SmartBattery driver.</td></tr>
+<tr><td>gbxutilacfr</td><td>Enable the GbxUtilAcfr utilities library.</td></tr>
+<tr><td>hokuyo_aist</td><td>Enable the hokuyo_aist Hokuyo laser scanner library.</td></tr>
</table>
@section gbx_doc_installgentoo_install Install
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <to...@us...> - 2008-07-10 06:00:00
|
Revision: 275
http://gearbox.svn.sourceforge.net/gearbox/?rev=275&view=rev
Author: tobasco
Date: 2008-07-09 23:00:03 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.cpp
Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.cpp
===================================================================
--- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.cpp 2008-07-10 01:30:59 UTC (rev 274)
+++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.cpp 2008-07-10 06:00:03 UTC (rev 275)
@@ -198,7 +198,7 @@
stringstream ss;
ss << "OceanServerReader: Caught ParsingException: " << e.what() << ". ";
ss << "It's not critical, we will try to find the beginning of a new record.";
- tracer_.warning( ss.str() );
+ tracer_.info( ss.str() );
firstTime_ = true;
// we have to rethrow, so that the caller knows that it may receive a corrupt record
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-10 01:31:05
|
Revision: 274
http://gearbox.svn.sourceforge.net/gearbox/?rev=274&view=rev
Author: gbiggs
Date: 2008-07-09 18:30:59 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Removed unnecessary allocation
Modified Paths:
--------------
gearbox/trunk/src/flexiport/utils/porttoport.cpp
Modified: gearbox/trunk/src/flexiport/utils/porttoport.cpp
===================================================================
--- gearbox/trunk/src/flexiport/utils/porttoport.cpp 2008-07-10 00:56:13 UTC (rev 273)
+++ gearbox/trunk/src/flexiport/utils/porttoport.cpp 2008-07-10 01:30:59 UTC (rev 274)
@@ -138,14 +138,7 @@
}
}
else
- {
- // Allocate 1 byte each for now so we can realloc() later without a check
- if ((buffer = reinterpret_cast<uint8_t*> (malloc (1))) == NULL)
- {
- cerr << "Failed to allocate memory for buffer." << endl;
- exit (1);
- }
- }
+ buffer = NULL;
// Begin an infinite loop, checking each port for data and then sleeping a little while
while (true)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-10 00:56:12
|
Revision: 273
http://gearbox.svn.sourceforge.net/gearbox/?rev=273&view=rev
Author: gbiggs
Date: 2008-07-09 17:56:13 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Updated ebuild
Added Paths:
-----------
gearbox/trunk/dist/gearbox-1.1.ebuild
Removed Paths:
-------------
gearbox/trunk/dist/gearbox-0.0.1.ebuild
Deleted: gearbox/trunk/dist/gearbox-0.0.1.ebuild
===================================================================
--- gearbox/trunk/dist/gearbox-0.0.1.ebuild 2008-07-10 00:15:51 UTC (rev 272)
+++ gearbox/trunk/dist/gearbox-0.0.1.ebuild 2008-07-10 00:56:13 UTC (rev 273)
@@ -1,40 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit cmake-utils
-
-SLOT="0"
-LICENSE="GPL-2"
-KEYWORDS="~x86 ~amd64"
-DESCRIPTION="A collection of libraries for robotics, including hardware drivers and algorithms."
-SRC_URI="/${P}.tar.bz2"
-HOMEPAGE="http://gearbox.sourceforge.net"
-IUSE="doc basic gbxadvanced urg_nz gbxserialacfr gbxsickacfr"
-DEPEND=">=dev-util/cmake-2.4
- doc? (app-doc/doxygen)"
-RDEPEND=${DEPEND}
-
-S=${WORKDIR}/${PN}
-
-src_compile()
-{
- local mycmakeargs="`cmake-utils_use_enable basic LIB_BASIC`\
- `cmake-utils_use_enable gbxadvanced LIB_GBXADVANCED`\
- `cmake-utils_use_enable urg_nz LIB_URG_NZ`\
- `cmake-utils_use_enable gbxserialacfr LIB_GBXSERIALACFR`\
- `cmake-utils_use_enable gbxsickacfr LIB_GBXSICKACFR`"
- cmake-utils_src_compile
- if use doc;
- then
- cd doc
- doxygen doxyfile || die "Error building documentation"
- fi
-}
-
-src_install ()
-{
- cmake-utils_src_install
- dodoc LICENSE
- use doc && dohtml -r doc/html/*
-}
\ No newline at end of file
Copied: gearbox/trunk/dist/gearbox-1.1.ebuild (from rev 271, gearbox/trunk/dist/gearbox-0.0.1.ebuild)
===================================================================
--- gearbox/trunk/dist/gearbox-1.1.ebuild (rev 0)
+++ gearbox/trunk/dist/gearbox-1.1.ebuild 2008-07-10 00:56:13 UTC (rev 273)
@@ -0,0 +1,43 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit cmake-utils
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~amd64"
+DESCRIPTION="A collection of libraries for robotics, including hardware drivers and algorithms."
+SRC_URI="/${P}.tar.bz2"
+HOMEPAGE="http://gearbox.sourceforge.net"
+IUSE="doc basic gbxadvanced gbxgarminacfr gbxserialacfr gbxsickacfr gbxsmartbatteryacfr gbxutilacfr hokuyo_aist"
+DEPEND=">=dev-util/cmake-2.4
+ doc? (app-doc/doxygen)"
+RDEPEND=${DEPEND}
+
+S=${WORKDIR}/${PN}
+
+src_compile()
+{
+ local mycmakeargs="`cmake-utils_use_enable basic LIB_BASIC`\
+ `cmake-utils_use_enable gbxadvanced LIB_GBXADVANCED`\
+ `cmake-utils_use_enable gbxgarminacfr LIB_GBXGARMINACFR`\
+ `cmake-utils_use_enable gbxserialacfr LIB_GBXSERIALACFR`\
+ `cmake-utils_use_enable gbxsickacfr LIB_GBXSICKACFR`\
+ `cmake-utils_use_enable gbxsmartbatteryacfr LIB_GBXSMARTBATTERYACFR`\
+ `cmake-utils_use_enable gbxutilacfr LIB_GBXUTILACFR`\
+ `cmake-utils_use_enable hokuyo_aist LIB_HOKUYO_AIST`"
+ cmake-utils_src_compile
+ if use doc;
+ then
+ cd doc
+ doxygen doxyfile || die "Error building documentation"
+ fi
+}
+
+src_install ()
+{
+ cmake-utils_src_install
+ dodoc LICENSE
+ use doc && dohtml -r doc/html/*
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-10 00:15:53
|
Revision: 272
http://gearbox.svn.sourceforge.net/gearbox/?rev=272&view=rev
Author: gbiggs
Date: 2008-07-09 17:15:51 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Accepted flexiport and hokuyo_aist. Retired urg_nz.
Modified Paths:
--------------
gearbox/trunk/cmake/internal/Setup.cmake
gearbox/trunk/src/CMakeLists.txt
gearbox/trunk/submitted/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/retired/CMakeLists.txt
gearbox/trunk/retired/urg_nz/
gearbox/trunk/retired/urg_nz/CMakeLists.txt
gearbox/trunk/retired/urg_nz/doc.dox
gearbox/trunk/retired/urg_nz/example.cmake.in
gearbox/trunk/retired/urg_nz/example.cpp
gearbox/trunk/retired/urg_nz/example.readme
gearbox/trunk/retired/urg_nz/urg_nz.cpp
gearbox/trunk/retired/urg_nz/urg_nz.h
gearbox/trunk/src/flexiport/
gearbox/trunk/src/flexiport/CMakeLists.txt
gearbox/trunk/src/flexiport/doc.dox
gearbox/trunk/src/flexiport/flexiport.cpp
gearbox/trunk/src/flexiport/flexiport.h
gearbox/trunk/src/flexiport/flexiport_config.h.in
gearbox/trunk/src/flexiport/flexiport_types.h
gearbox/trunk/src/flexiport/logfile.cpp
gearbox/trunk/src/flexiport/logfile.h
gearbox/trunk/src/flexiport/logreaderport.cpp
gearbox/trunk/src/flexiport/logreaderport.h
gearbox/trunk/src/flexiport/logwriterport.cpp
gearbox/trunk/src/flexiport/logwriterport.h
gearbox/trunk/src/flexiport/port.cpp
gearbox/trunk/src/flexiport/port.h
gearbox/trunk/src/flexiport/serialport.cpp
gearbox/trunk/src/flexiport/serialport.h
gearbox/trunk/src/flexiport/tcpport.cpp
gearbox/trunk/src/flexiport/tcpport.h
gearbox/trunk/src/flexiport/test/
gearbox/trunk/src/flexiport/timeout.cpp
gearbox/trunk/src/flexiport/timeout.h
gearbox/trunk/src/flexiport/utils/
gearbox/trunk/src/hokuyo_aist/
gearbox/trunk/src/hokuyo_aist/CMakeLists.txt
gearbox/trunk/src/hokuyo_aist/doc.dox
gearbox/trunk/src/hokuyo_aist/hokuyo_aist.cpp
gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h
gearbox/trunk/src/hokuyo_aist/test/
Removed Paths:
-------------
gearbox/trunk/retired/urg_nz/CMakeLists.txt
gearbox/trunk/retired/urg_nz/doc.dox
gearbox/trunk/retired/urg_nz/example.cmake.in
gearbox/trunk/retired/urg_nz/example.cpp
gearbox/trunk/retired/urg_nz/example.readme
gearbox/trunk/retired/urg_nz/urg_nz.cpp
gearbox/trunk/retired/urg_nz/urg_nz.h
gearbox/trunk/src/flexiport/CMakeLists.txt
gearbox/trunk/src/flexiport/doc.dox
gearbox/trunk/src/flexiport/flexiport.cpp
gearbox/trunk/src/flexiport/flexiport.h
gearbox/trunk/src/flexiport/flexiport_config.h.in
gearbox/trunk/src/flexiport/flexiport_types.h
gearbox/trunk/src/flexiport/logfile.cpp
gearbox/trunk/src/flexiport/logfile.h
gearbox/trunk/src/flexiport/logreaderport.cpp
gearbox/trunk/src/flexiport/logreaderport.h
gearbox/trunk/src/flexiport/logwriterport.cpp
gearbox/trunk/src/flexiport/logwriterport.h
gearbox/trunk/src/flexiport/port.cpp
gearbox/trunk/src/flexiport/port.h
gearbox/trunk/src/flexiport/serialport.cpp
gearbox/trunk/src/flexiport/serialport.h
gearbox/trunk/src/flexiport/tcpport.cpp
gearbox/trunk/src/flexiport/tcpport.h
gearbox/trunk/src/flexiport/test/
gearbox/trunk/src/flexiport/timeout.cpp
gearbox/trunk/src/flexiport/timeout.h
gearbox/trunk/src/flexiport/utils/
gearbox/trunk/src/hokuyo_aist/CMakeLists.txt
gearbox/trunk/src/hokuyo_aist/doc.dox
gearbox/trunk/src/hokuyo_aist/hokuyo_aist.cpp
gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h
gearbox/trunk/src/hokuyo_aist/test/
gearbox/trunk/src/urg_nz/
gearbox/trunk/submitted/flexiport/
gearbox/trunk/submitted/hokuyo_aist/
Modified: gearbox/trunk/cmake/internal/Setup.cmake
===================================================================
--- gearbox/trunk/cmake/internal/Setup.cmake 2008-07-09 23:57:17 UTC (rev 271)
+++ gearbox/trunk/cmake/internal/Setup.cmake 2008-07-10 00:15:51 UTC (rev 272)
@@ -84,7 +84,7 @@
#
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( submitted )
-# ADD_SUBDIRECTORY( retired )
+ADD_SUBDIRECTORY( retired )
# Some cmake and shell scripts need to be installed
ADD_SUBDIRECTORY( cmake )
Added: gearbox/trunk/retired/CMakeLists.txt
===================================================================
--- gearbox/trunk/retired/CMakeLists.txt (rev 0)
+++ gearbox/trunk/retired/CMakeLists.txt 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,15 @@
+# A place for libraries that have been retired from the source tree.
+
+OPTION ( GBX_BUILD_RETIRED "Build retired libraries" OFF )
+MARK_AS_ADVANCED ( FORCE GBX_BUILD_RETIRED )
+
+IF( GBX_BUILD_RETIRED )
+
+ MESSAGE( STATUS "== RETIRED ==" )
+
+ # When adding new directories, please maintain order of inter-dependencies.
+ # Otherwise, maintain alphabetical order.
+
+ ADD_SUBDIRECTORY( urg_nz )
+
+ENDIF( GBX_BUILD_RETIRED )
Copied: gearbox/trunk/retired/urg_nz (from rev 258, gearbox/trunk/src/urg_nz)
Deleted: gearbox/trunk/retired/urg_nz/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/CMakeLists.txt 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,23 +0,0 @@
-SET( lib_name urg_nz )
-set ( lib_desc "Hokuyo URG laser scanner driver" )
-GBX_ADD_LICENSE( GPL )
-
-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" )
-
-IF( build )
-
- INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
-
- SET( hdrs urg_nz.h )
- SET( srcs urg_nz.cpp )
-
- GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
- GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} "" "" "" "" )
-
- GBX_ADD_HEADERS( ${lib_name} ${hdrs} )
-
- GBX_ADD_EXAMPLE( ${lib_name} example.cmake.in example.cmake example.cpp example.readme )
-
-ENDIF( build )
Copied: gearbox/trunk/retired/urg_nz/CMakeLists.txt (from rev 271, gearbox/trunk/src/urg_nz/CMakeLists.txt)
===================================================================
--- gearbox/trunk/retired/urg_nz/CMakeLists.txt (rev 0)
+++ gearbox/trunk/retired/urg_nz/CMakeLists.txt 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,23 @@
+SET( lib_name urg_nz )
+set ( lib_desc "Hokuyo URG laser scanner driver" )
+GBX_ADD_LICENSE( GPL )
+
+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" )
+
+IF( build )
+
+ INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+ SET( hdrs urg_nz.h )
+ SET( srcs urg_nz.cpp )
+
+ GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
+ GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} "" "" "" "" )
+
+ GBX_ADD_HEADERS( ${lib_name} ${hdrs} )
+
+ GBX_ADD_EXAMPLE( ${lib_name} example.cmake.in example.cmake example.cpp example.readme )
+
+ENDIF( build )
Deleted: gearbox/trunk/retired/urg_nz/doc.dox
===================================================================
--- gearbox/trunk/src/urg_nz/doc.dox 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/doc.dox 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,50 +0,0 @@
-/*!
-
-@ingroup gbx_libs
-@ingroup gbx_hardware
-@ingroup gbx_c
-@ingroup gbx_linux
-@defgroup gbx_library_urg_nz liburg_nz
-@brief Hokuyo URG laser scanner driver.
-
-For a full list of functions and classes see @ref urg_nz.
-
-Header file:
-@verbatim
-#include <urglaser/urg_laser.h>
-@endverbatim
-
-@par Responsible Developer
- Geoffrey Biggs
-
-@par Copyright
- Toby Collett, Nico Blodow, Geoffrey Biggs
-
-@par License
- GPL
-
-@par Style guidelines
-
-- Naming conventions:
- - Class methods start with a capital letter.
- - Underscores in member, variable and type names.
- - \#define'd values in all capitals.
-- Formatting:
- - 4 space indentation.
- - Function declarations on one line.
- - Space between function name and arguments.
-- C++ API.
- - Functionality provided through classes with utility structures.
-- Units:
- - All internal units are in millimetres and radians.
-
-*/
-
-/*!
-@namespace urg_nz
-@brief URG laser scanner driver name space.
-
-This namespace is part of a library which provides a driver for the URG laser scanner driver.
-
-@see @ref gbx_library_urg_nz
-*/
Copied: gearbox/trunk/retired/urg_nz/doc.dox (from rev 271, gearbox/trunk/src/urg_nz/doc.dox)
===================================================================
--- gearbox/trunk/retired/urg_nz/doc.dox (rev 0)
+++ gearbox/trunk/retired/urg_nz/doc.dox 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,52 @@
+/*!
+
+@ingroup gbx_libs
+@ingroup gbx_hardware
+@ingroup gbx_c
+@ingroup gbx_linux
+@defgroup gbx_library_urg_nz liburg_nz
+@brief Hokuyo URG laser scanner driver.
+
+For a full list of functions and classes see @ref urg_nz.
+
+<b>This library has been retired.</b>
+
+Header file:
+@verbatim
+#include <urglaser/urg_laser.h>
+@endverbatim
+
+@par Responsible Developer
+ Geoffrey Biggs
+
+@par Copyright
+ Toby Collett, Nico Blodow, Geoffrey Biggs
+
+@par License
+ GPL
+
+@par Style guidelines
+
+- Naming conventions:
+ - Class methods start with a capital letter.
+ - Underscores in member, variable and type names.
+ - \#define'd values in all capitals.
+- Formatting:
+ - 4 space indentation.
+ - Function declarations on one line.
+ - Space between function name and arguments.
+- C++ API.
+ - Functionality provided through classes with utility structures.
+- Units:
+ - All internal units are in millimetres and radians.
+
+*/
+
+/*!
+@namespace urg_nz
+@brief URG laser scanner driver name space.
+
+This namespace is part of a library which provides a driver for the URG laser scanner driver.
+
+@see @ref gbx_library_urg_nz
+*/
Deleted: gearbox/trunk/retired/urg_nz/example.cmake.in
===================================================================
--- gearbox/trunk/src/urg_nz/example.cmake.in 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/example.cmake.in 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,10 +0,0 @@
-PROJECT( urg_nz_example )
-
-INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
-
-ADD_EXECUTABLE( urg_nz_example example.cpp )
-TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
-SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
- LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- BUILD_WITH_INSTALL_RPATH TRUE )
Copied: gearbox/trunk/retired/urg_nz/example.cmake.in (from rev 271, gearbox/trunk/src/urg_nz/example.cmake.in)
===================================================================
--- gearbox/trunk/retired/urg_nz/example.cmake.in (rev 0)
+++ gearbox/trunk/retired/urg_nz/example.cmake.in 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,10 @@
+PROJECT( urg_nz_example )
+
+INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
+
+ADD_EXECUTABLE( urg_nz_example example.cpp )
+TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
+SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
Deleted: gearbox/trunk/retired/urg_nz/example.cpp
===================================================================
--- gearbox/trunk/src/urg_nz/example.cpp 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/example.cpp 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,111 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <gearbox/urg_nz/urg_nz.h>
-
-int main (int argc, char **argv)
-{
- int opt, baud = 115200;
- bool useSerial = false;
- char port[256];
-
- // Get some options from the command line
- while ((opt = getopt (argc, argv, "p:b:s")) != -1)
- {
- switch (opt)
- {
- case 'p':
- strncpy (port, optarg, 256);
- break;
- case 'b':
- baud = atoi (optarg);
- if (baud != 19200 && baud != 57600 && baud != 115200)
- {
- printf ("Baud rate must be one of 19200, 57600 or 115200.\n");
- return 1;
- }
- break;
- case 's':
- useSerial = true;
- break;
- default:
- printf ("Usage: %s [-p port] [-b baud] [-s]\n\n"
- "-p port\tPort the laser scanner is connected to.\n"
- "-b baud\tBaud rate to connect at (19200, 57600 or 115200).\t"
- "-s\tUse RS232 connection instead of USB.\n", argv[0]);
- return 1;
- }
- }
-
- try
- {
- urg_nz::urg_laser laser; // Laser scanner object
- // Set the laser to verbose mode (so we see more information in the console)
- laser.SetVerbose (true);
-
- // Open the laser
- laser.Open (port, useSerial, baud);
-
- // Set the timeout to 1000ms
- laser.SetTimeOut (1000);
-
- // Check the SCIP protocol version
- int version = laser.GetSCIPVersion ();
- printf ("Laser is using SCIP protocol version %d\n", version);
-
- // Get the laser serial number
- int serial = 0;
- serial = laser.GetIDInfo ();
- printf ("Laser serial number:\t%d\n", serial);
-
- // Get the laser configuration
- urg_nz::urg_nz_laser_config_t config; // Laser configuration structure
- laser.GetSensorConfig (&config);
- printf ("Laser configuration:\n"
- "Min angle: %f\tMax angle: %f\tResolution: %f\tMax range: %f\n",
- config.min_angle, config.max_angle, config.resolution, config.max_range);
-
- // Calculate the minimum and maximum indices to retrieve - this is only necessary if you want
- // less than the full scan, otherwise simply don't supply min_i and max_i to urg_laser.GetReadings()
- // and the full scan will be returned.
- int minIndex = static_cast<int> (round ((urg_nz::MAX_READINGS / 2) + config.min_angle / config.resolution));
- int maxIndex = static_cast<int> (round ((urg_nz::MAX_READINGS / 2) + config.max_angle / config.resolution));
-
- if (useSerial && version == 1) // Baud rate changing is not currently supported on SCIP v2 scanners
- {
- // Change the baud rate
- if (laser.ChangeBaud (19200, 57600) == 0)
- printf ("Changed baud rate to 57600.\n");
- else
- printf ("Unable to change baud rate.\n");
- }
-
- // Get range readings from the laser
- urg_nz::urg_nz_laser_readings_t readings; // Laser readings structure
- printf ("Getting readings from %d to %d\n", minIndex, maxIndex);
- unsigned int numRead = laser.GetReadings (&readings, minIndex, maxIndex);
- printf ("Got %d range readings:\n", numRead);
- for (unsigned int ii = 0; ii < numRead; ii++)
- {
- float angle = config.min_angle + (ii * config.resolution);
- if (readings.Readings[ii] < 20) // Values less than 20 indicate no return in the scan
- printf ("%f: %f\t\t", angle, config.max_range);
- else
- printf ("%f: %d\t\t", angle, readings.Readings[ii]);
- }
- printf ("\n");
-
- // Close the laser
- laser.Close ();
- }
- catch (urg_nz::urg_nz_exception e)
- {
- printf ("Caught exception: (%d) %s\n", e.error_code, e.error_desc.c_str ());
- return -1;
- }
-
- return 0;
-}
Copied: gearbox/trunk/retired/urg_nz/example.cpp (from rev 271, gearbox/trunk/src/urg_nz/example.cpp)
===================================================================
--- gearbox/trunk/retired/urg_nz/example.cpp (rev 0)
+++ gearbox/trunk/retired/urg_nz/example.cpp 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,111 @@
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <gearbox/urg_nz/urg_nz.h>
+
+int main (int argc, char **argv)
+{
+ int opt, baud = 115200;
+ bool useSerial = false;
+ char port[256];
+
+ // Get some options from the command line
+ while ((opt = getopt (argc, argv, "p:b:s")) != -1)
+ {
+ switch (opt)
+ {
+ case 'p':
+ strncpy (port, optarg, 256);
+ break;
+ case 'b':
+ baud = atoi (optarg);
+ if (baud != 19200 && baud != 57600 && baud != 115200)
+ {
+ printf ("Baud rate must be one of 19200, 57600 or 115200.\n");
+ return 1;
+ }
+ break;
+ case 's':
+ useSerial = true;
+ break;
+ default:
+ printf ("Usage: %s [-p port] [-b baud] [-s]\n\n"
+ "-p port\tPort the laser scanner is connected to.\n"
+ "-b baud\tBaud rate to connect at (19200, 57600 or 115200).\t"
+ "-s\tUse RS232 connection instead of USB.\n", argv[0]);
+ return 1;
+ }
+ }
+
+ try
+ {
+ urg_nz::urg_laser laser; // Laser scanner object
+ // Set the laser to verbose mode (so we see more information in the console)
+ laser.SetVerbose (true);
+
+ // Open the laser
+ laser.Open (port, useSerial, baud);
+
+ // Set the timeout to 1000ms
+ laser.SetTimeOut (1000);
+
+ // Check the SCIP protocol version
+ int version = laser.GetSCIPVersion ();
+ printf ("Laser is using SCIP protocol version %d\n", version);
+
+ // Get the laser serial number
+ int serial = 0;
+ serial = laser.GetIDInfo ();
+ printf ("Laser serial number:\t%d\n", serial);
+
+ // Get the laser configuration
+ urg_nz::urg_nz_laser_config_t config; // Laser configuration structure
+ laser.GetSensorConfig (&config);
+ printf ("Laser configuration:\n"
+ "Min angle: %f\tMax angle: %f\tResolution: %f\tMax range: %f\n",
+ config.min_angle, config.max_angle, config.resolution, config.max_range);
+
+ // Calculate the minimum and maximum indices to retrieve - this is only necessary if you want
+ // less than the full scan, otherwise simply don't supply min_i and max_i to urg_laser.GetReadings()
+ // and the full scan will be returned.
+ int minIndex = static_cast<int> (round ((urg_nz::MAX_READINGS / 2) + config.min_angle / config.resolution));
+ int maxIndex = static_cast<int> (round ((urg_nz::MAX_READINGS / 2) + config.max_angle / config.resolution));
+
+ if (useSerial && version == 1) // Baud rate changing is not currently supported on SCIP v2 scanners
+ {
+ // Change the baud rate
+ if (laser.ChangeBaud (19200, 57600) == 0)
+ printf ("Changed baud rate to 57600.\n");
+ else
+ printf ("Unable to change baud rate.\n");
+ }
+
+ // Get range readings from the laser
+ urg_nz::urg_nz_laser_readings_t readings; // Laser readings structure
+ printf ("Getting readings from %d to %d\n", minIndex, maxIndex);
+ unsigned int numRead = laser.GetReadings (&readings, minIndex, maxIndex);
+ printf ("Got %d range readings:\n", numRead);
+ for (unsigned int ii = 0; ii < numRead; ii++)
+ {
+ float angle = config.min_angle + (ii * config.resolution);
+ if (readings.Readings[ii] < 20) // Values less than 20 indicate no return in the scan
+ printf ("%f: %f\t\t", angle, config.max_range);
+ else
+ printf ("%f: %d\t\t", angle, readings.Readings[ii]);
+ }
+ printf ("\n");
+
+ // Close the laser
+ laser.Close ();
+ }
+ catch (urg_nz::urg_nz_exception e)
+ {
+ printf ("Caught exception: (%d) %s\n", e.error_code, e.error_desc.c_str ());
+ return -1;
+ }
+
+ return 0;
+}
Deleted: gearbox/trunk/retired/urg_nz/example.readme
===================================================================
--- gearbox/trunk/src/urg_nz/example.readme 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/example.readme 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,24 +0,0 @@
-Building
---------
-
-The example can be built by making a directory (anywhere on your system where
-you have write permissions will do), changing to that directory and executing
-CMake with the example's source directory as an argument. For example, if you
-have installed GearBox into /usr/local, you could do the following:
-
-$ cd ~
-$ mkdir urg_nz_example
-$ cd urg_nz_example
-$ ccmake /usr/local/share/gearbox/urg_nz/
-
-Running
--------
-
-The example requires that you specify a path to the laser scanner's port and,
-optionally, a baud rate and whether to use an RS232 connection or not. For
-example:
-
-./urg_nz_example -p /dev/ttyS1 -b 115200 -s
-
-This will start the example, looking for the laser on port /dev/ttyS1 and
-using a baud rate of 115200bps in RS232 mode.
Copied: gearbox/trunk/retired/urg_nz/example.readme (from rev 271, gearbox/trunk/src/urg_nz/example.readme)
===================================================================
--- gearbox/trunk/retired/urg_nz/example.readme (rev 0)
+++ gearbox/trunk/retired/urg_nz/example.readme 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,24 @@
+Building
+--------
+
+The example can be built by making a directory (anywhere on your system where
+you have write permissions will do), changing to that directory and executing
+CMake with the example's source directory as an argument. For example, if you
+have installed GearBox into /usr/local, you could do the following:
+
+$ cd ~
+$ mkdir urg_nz_example
+$ cd urg_nz_example
+$ ccmake /usr/local/share/gearbox/urg_nz/
+
+Running
+-------
+
+The example requires that you specify a path to the laser scanner's port and,
+optionally, a baud rate and whether to use an RS232 connection or not. For
+example:
+
+./urg_nz_example -p /dev/ttyS1 -b 115200 -s
+
+This will start the example, looking for the laser on port /dev/ttyS1 and
+using a baud rate of 115200bps in RS232 mode.
Deleted: gearbox/trunk/retired/urg_nz/urg_nz.cpp
===================================================================
--- gearbox/trunk/src/urg_nz/urg_nz.cpp 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/retired/urg_nz/urg_nz.cpp 2008-07-10 00:15:51 UTC (rev 272)
@@ -1,991 +0,0 @@
-/*
- * Hokuyo URG laser scanner driver class.
- * Originally written by Toby Collett for the Player project.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <poll.h>
-#include <sstream>
-
-#include "urg_nz.h"
-
-using namespace urg_nz;
-using namespace std;
-
-#ifndef M_PI
- #define M_PI 3.14159265358979323846
-#endif
-// Convert radians to degrees
-#ifndef RTOD
- #define RTOD(r) ((r) * 180 / M_PI)
-#endif
-// Convert degrees to radians
-#ifndef DTOR
- #define DTOR(d) ((d) * M_PI / 180)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-// Constructor
-///////////////////////////////////////////////////////////////////////////////
-urg_laser::urg_laser (void)
-{
- // Defaults to SCIP version 1
- SCIP_Version = 1;
- laser_port = NULL;
- verbose = false;
- poll_timeout = -1;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Destructor
-///////////////////////////////////////////////////////////////////////////////
-urg_laser::~urg_laser (void)
-{
- if (PortOpen ())
- Close ();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Read functions
-///////////////////////////////////////////////////////////////////////////////
-int urg_laser::ReadUntil_nthOccurence (int file, int n, char c)
-{
- int retval = 0, bytes_read = 0;
- unsigned char buffer[2];
- buffer[0] = 0;
- buffer[1] = 0;
- for (int i = 0; i < n; i++)
- {
- do
- {
- retval = ReadUntil (file, &buffer[0], 1, poll_timeout);
- if (retval > 0)
- bytes_read += retval;
- } while (buffer[0] != c && retval > 0);
- }
- return bytes_read;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-int urg_laser::ReadUntil (int fd, unsigned char *buf, int len, int timeout)
-{
- int ret;
- int current=0;
- struct pollfd ufd[1];
- int retval;
-
- ufd[0].fd = fd;
- ufd[0].events = POLLIN;
-
- do
- {
- if(timeout >= 0)
- {
- if ((retval = poll (ufd, 1, timeout)) < 0)
- {
- stringstream error_desc;
- error_desc << "Error in ReadUntil at poll(): " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_READPOLL, error_desc.str ());
- }
- else if (retval == 0)
- {
- stringstream error_desc;
- error_desc << "Timed out on poll in ReadUntil";
- throw urg_nz_exception (URG_ERR_READTIMEOUT, error_desc.str ());
- }
- }
-
- ret = read (fd, &buf[current], len-current);
- if (ret < 0)
- {
- stringstream error_desc;
- error_desc << "Error in ReadUntil at read(): " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_READ, error_desc.str ());
- }
-
- current += ret;
- if (current > 2 && current < len && buf[current-2] == '\n' && buf[current-1] == '\n')
- {
- stringstream error_desc;
- error_desc << "Got an end of command while waiting for more data.";
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- } while (current < len);
- return current;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Port control functions
-///////////////////////////////////////////////////////////////////////////////
-int urg_laser::ChangeBaud (int curr_baud, int new_baud)
-{
- struct termios newtio;
- int fd;
- fd = fileno (laser_port);
- int new_baud_constant;
-
- switch (curr_baud)
- {
- case 19200:
- curr_baud = B19200;
- break;
- case 57600:
- curr_baud = B57600;
- break;
- case 115200:
- curr_baud = B115200;
- break;
- default:
- stringstream error_desc;
- error_desc << "Unknown current baud rate: " << curr_baud;
- throw urg_nz_exception (URG_ERR_BADBAUDRATE, error_desc.str ());
- }
-
- switch (new_baud)
- {
- case 19200:
- new_baud_constant = B19200;
- break;
- case 57600:
- new_baud_constant = B57600;
- break;
- case 115200:
- new_baud_constant = B115200;
- break;
- default:
- stringstream error_desc;
- error_desc << "Unknown new baud rate: " << new_baud;
- throw urg_nz_exception (URG_ERR_BADBAUDRATE, error_desc.str ());
- }
-
- if (tcgetattr (fd, &newtio) < 0)
- {
- close (fd);
- stringstream error_desc;
- error_desc << "Error in ChangeBaud at tcgetattr: " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_CHANGEBAUD, error_desc.str ());
- }
-
- cfmakeraw (&newtio);
- cfsetispeed (&newtio, curr_baud);
- cfsetospeed (&newtio, curr_baud);
-
- if (tcsetattr (fd, TCSAFLUSH, &newtio) < 0 )
- {
- close (fd);
- stringstream error_desc;
- error_desc << "Error in ChangeBaud at tcsetattr: " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_CHANGEBAUD, error_desc.str ());
- }
-
- unsigned char buf[17];
- memset (buf,0,sizeof (buf));
-
- // TODO: Check if this works with SCIP2.0
- if (SCIP_Version == 1)
- {
- buf[0] = 'S';
- switch (new_baud_constant)
- {
- case B19200:
- buf[1] = '0';
- buf[2] = '1';
- buf[3] = '9';
- buf[4] = '2';
- buf[5] = '0';
- buf[6] = '0';
- break;
- case B57600:
- buf[1] = '0';
- buf[2] = '5';
- buf[3] = '7';
- buf[4] = '6';
- buf[5] = '0';
- buf[6] = '0';
- break;
- case B115200:
- buf[1] = '1';
- buf[2] = '1';
- buf[3] = '5';
- buf[4] = '2';
- buf[5] = '0';
- buf[6] = '0';
- break;
- default:
- // Already checked above
- break;
- }
- buf[7] = '0';
- buf[8] = '0';
- buf[9] = '0';
- buf[10] = '0';
- buf[11] = '0';
- buf[12] = '0';
- buf[13] = '0';
- buf[14] = '\n';
- }
- else // SCIP 2
- {
- buf[0] = 'S';
- buf[1] = 'S';
- switch (new_baud)
- {
- case B19200:
- buf[2] = '0';
- buf[3] = '1';
- buf[4] = '9';
- buf[5] = '2';
- buf[6] = '0';
- buf[7] = '0';
- break;
- case B57600:
- buf[2] = '0';
- buf[3] = '5';
- buf[4] = '7';
- buf[5] = '6';
- buf[6] = '0';
- buf[7] = '0';
- break;
- case B115200:
- buf[2] = '1';
- buf[3] = '1';
- buf[4] = '5';
- buf[5] = '2';
- buf[6] = '0';
- buf[7] = '0';
- break;
- default:
- // Already checked above
- break;
- }
- buf[8] = '\n';
- }
-
- fprintf (laser_port, "%s", buf);
- memset (buf, 0, sizeof (buf));
- int len;
- // The docs say that the response ends in 'status LF LF', where
- // status is '0' if everything went alright. But it seems that
- // the response actually ends in 'LF status LF'.
- if (((len = ReadUntil (fd, buf, sizeof (buf), poll_timeout)) < 0) ||
- (buf[15] != '0'))
- {
- if (verbose)
- fprintf (stderr, "urg_nz: W: Failed to change baud rate to %d\n", new_baud);
- return -1;
- }
- else
- {
- if (tcgetattr (fd, &newtio) < 0)
- {
- close (fd);
- stringstream error_desc;
- error_desc << "Error in ChangeBaud at tcgetattr: " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_CHANGEBAUD, error_desc.str ());
- }
- cfmakeraw (&newtio);
- cfsetispeed (&newtio, new_baud_constant);
- cfsetospeed (&newtio, new_baud_constant);
- if (tcsetattr (fd, TCSAFLUSH, &newtio) < 0 )
- {
- close (fd);
- stringstream error_desc;
- error_desc << "Error in ChangeBaud at tcsetattr: " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_CHANGEBAUD, error_desc.str ());
- }
- else
- {
- usleep (200000);
- }
- }
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-void urg_laser::Open (const char *port_name, bool use_serial, int baud)
-{
- if (PortOpen ())
- this->Close ();
-
- laser_port = fopen (port_name, "r+");
- if (laser_port == NULL)
- {
- stringstream error_desc;
- error_desc << "Failed to open port " << port_name << " << with error " << errno << ":" << strerror (errno);
- throw urg_nz_exception (URG_ERR_OPEN_FAILED, error_desc.str ());
- }
-
- int fd = fileno (laser_port);
- if (use_serial)
- {
- if (verbose)
- {
- fprintf (stderr, "urg_nz: I: Connecting using serial connection to %s\n", port_name);
- fprintf (stderr, "urg_nz: I: Trying to connect at 19200\n");
- }
- if (this->ChangeBaud (19200, baud) != 0)
- {
- if (verbose)
- fprintf (stderr, "urg_nz: I: Trying to connect at 57600\n");
- if (this->ChangeBaud (57600, baud) != 0)
- {
- if (verbose)
- fprintf (stderr, "urg_nz: I: Trying to connect at 115200\n");
- if (this->ChangeBaud (115200, baud) != 0)
- {
- close (fd);
- stringstream error_desc;
- error_desc << "Failed to connect at any baud";
- throw urg_nz_exception (URG_ERR_CONNECT_FAILED, error_desc.str ());
- }
- }
- }
- if (verbose)
- fprintf (stderr, "urg_nz: I: Successfully changed baud rate\n");
- }
- else
- {
- if (verbose)
- fprintf (stderr, "urg_nz: I: Connecting using USB connection to %s\n", port_name);
- // set up new settings
- struct termios newtio;
- memset (&newtio, 0, sizeof (newtio));
- newtio.c_cflag = /*(rate & CBAUD) |*/ CS8 | CLOCAL | CREAD;
- newtio.c_iflag = IGNPAR;
- newtio.c_oflag = 0;
- newtio.c_lflag = ICANON;
-
- // activate new settings
- tcflush (fd, TCIFLUSH);
- tcsetattr (fd, TCSANOW, &newtio);
- usleep (200000);
- GetSCIPVersion ();
- tcflush (fd, TCIOFLUSH);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-void urg_laser::Close (void)
-{
- assert (this->laser_port);
-
- if (verbose)
- fprintf (stderr, "urg_nz: I: Closing port\n");
-
- tcflush (fileno (this->laser_port), TCIOFLUSH);
- if (fclose (this->laser_port) != 0)
- {
- stringstream error_desc;
- error_desc << "Error closing port: " << errno << ":" << strerror (errno);
- this->laser_port = NULL;
- throw urg_nz_exception (URG_ERR_CLOSE_FAILED, error_desc.str ());
- }
- this->laser_port = NULL;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-bool urg_laser::PortOpen (void)
-{
- return laser_port != NULL;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Laser sensor access functions
-///////////////////////////////////////////////////////////////////////////////
-unsigned int urg_laser::GetReadings (urg_nz_laser_readings_t *readings, unsigned int min_i, unsigned int max_i)
-{
- unsigned char buffer[16];
- unsigned int num_readings_read = 0;
-
- if (readings == NULL)
- {
- stringstream error_desc;
- error_desc << "NULL destination buffer";
- throw urg_nz_exception (URG_ERR_NODESTINATION, error_desc.str ());
- }
-
- if (!PortOpen ())
- {
- stringstream error_desc;
- error_desc << "Laser port is not open";
- throw urg_nz_exception (URG_ERR_NOPORT, error_desc.str ());
- }
-
- if (SCIP_Version == 1)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- // send the command
- fprintf (laser_port, "G00076801\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer, 10, poll_timeout);
-
- if (strncmp ((const char *) buffer, "G00076801", 9) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // check the returned status
- ReadUntil (file, buffer, 2, poll_timeout);
-
- if (buffer[0] != '0')
- {
- stringstream error_desc;
- error_desc << "Error reported by laser scanner: " << buffer[0] - '0';
- throw urg_nz_exception (URG_ERR_LASERERROR, error_desc.str ());
- }
-
- for (unsigned int i=0; ; ++i)
- {
- ReadUntil (file, buffer, 2, poll_timeout);
-
- if (buffer[0] == '\n' && buffer[1] == '\n')
- break;
- else if (buffer[0] == '\n')
- {
- buffer[0] = buffer[1];
- ReadUntil (file, &buffer[1], 1, poll_timeout);
- }
-
- if (i < MAX_READINGS)
- {
- readings->Readings[i] = ((buffer[0]-0x30) << 6) | (buffer[1]-0x30);
- num_readings_read++;
- }
- else
- {
- stringstream error_desc;
- error_desc << "Got too many readings: " << i;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- }
-
- // Shift the range readings down by min_i if necessary
- if (min_i > 0)
- {
- memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i + 1) * sizeof (readings->Readings[0]));
- // Don't forget to adjust the number of readings to account for this
- num_readings_read -= (MAX_READINGS - max_i) + min_i - 1; // -1 because max_i is inclusive
- }
- }
- else // SCIP_Version == 2
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- // send the command
- fprintf (laser_port, "GD0000076801\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer, 13, poll_timeout);
-
- if (strncmp ((const char *) buffer, "GD0000076801", 12) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // check the returned status
- ReadUntil (file, buffer, 3, poll_timeout);
- buffer[2] = 0;
- if (buffer[0] != '0' || buffer[1] != '0')
- {
- stringstream error_desc;
- error_desc << "Error reported by laser scanner: " << (buffer[0] - '0') * 10 + (buffer[1] - '0');
- throw urg_nz_exception (URG_ERR_LASERERROR, error_desc.str ());
- }
-
- ReadUntil_nthOccurence (file, 2, (char)0xa);
-
- // NOTE: This only works for 769 requested samples.. (64 data bytes
- // blocks are not the best choice for 3-byte values...)
-
- for (unsigned int i = 0; ; ++i)
- {
- ReadUntil (file, buffer, 3, poll_timeout);
-
- if ((buffer[1] == '\n') && (buffer[2] == '\n'))
- break;
- else if (buffer[2] == '\n')
- ReadUntil (file, &buffer[1], 2, poll_timeout);
- else if (buffer[0] == '\n')
- {
- if (i <= MAX_READINGS)
- {
- readings->Readings[i - 1] = ((readings->Readings[i - 1] & 0xFFC0) | (buffer[1]-0x30));
- buffer [0] = buffer [2];
- ReadUntil (file, &buffer[1], 2, poll_timeout);
- }
- else
- {
- stringstream error_desc;
- error_desc << "Got too many readings: " << i;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- }
- else if (buffer[1] == '\n')
- {
- buffer[0] = buffer[2];
- ReadUntil (file, &buffer[1], 2, poll_timeout);
- }
-
- if (i < MAX_READINGS)
- {
- readings->Readings[i] = ((buffer[0]-0x30) << 12) | ((buffer[1]-0x30) << 6) | (buffer[2]-0x30);
- num_readings_read++;
- if ((readings->Readings[i] > 5600) && (i >= min_i) && (i <= max_i))
- {
- stringstream error_desc;
- error_desc << "Reading " << i << " value of " << readings->Readings[i] << " is bigger than 5.6 metres.";
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- }
- else
- {
- stringstream error_desc;
- error_desc << "Got too many readings: " << i;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- }
-
- // Shift the range readings down by min_i if necessary
- if (min_i > 0)
- {
- memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i + 1) * sizeof (readings->Readings[0]));
- // Don't forget to adjust the number of readings to account for this
- num_readings_read -= (MAX_READINGS - max_i) + min_i - 1; // -1 because max_i is inclusive
- }
- }
-
- return num_readings_read;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-int urg_laser::GetIDInfo (void)
-{
- unsigned char buffer [18];
- memset (buffer, 0, 18);
- int i;
- int id;
-
- if (!PortOpen ())
- {
- stringstream error_desc;
- error_desc << "Laser port is not open";
- throw urg_nz_exception (URG_ERR_NOPORT, error_desc.str ());
- }
-
- tcflush (fileno (laser_port), TCIFLUSH);
-
- if (SCIP_Version == 1)
- {
- // send the command
- fprintf (laser_port, "V\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer, 2, poll_timeout);
-
- if (strncmp ((const char *) buffer, "V", 1) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // check the returned status
- ReadUntil (file, buffer, 2, poll_timeout);
-
- if (buffer[0] != '0')
- {
- stringstream error_desc;
- error_desc << "Error reported by laser scanner: " << buffer[0] - '0';
- throw urg_nz_exception (URG_ERR_LASERERROR, error_desc.str ());
- }
-
- buffer[0] = 0;
- // Read the rest of the values
- for (i = 0; i < 4; i++)
- {
- do
- {
- ReadUntil (file, &buffer[0], 1, poll_timeout);
- } while (buffer[0] != 0xa);
- }
-
- // Read "SERI:H"
- ReadUntil (file, buffer, 6, poll_timeout);
- // Read the serial number value
- for (i = 0; ; i++)
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- if (buffer[i] == 0xa)
- break;
- }
-
- id = atol ((const char*)buffer);
- // Read the last LF
- ReadUntil (file, buffer, 1, poll_timeout);
- }
- else // SCIP_Version == 2
- {
- // send the command
- fprintf (laser_port, "VV\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer, 7, poll_timeout);
-
- if (strncmp ((const char *) buffer, "VV\n00P\n", 7) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- buffer[0] = 0;
- // Read the rest of the values
- for (i = 0; i < 4; i++)
- {
- do
- {
- ReadUntil (file, &buffer[0], 1, poll_timeout);
- } while (buffer[0] != 0xa);
- }
-
- // Read "SERI:H"
- ReadUntil (file, buffer, 6, poll_timeout);
- // Read the serial number value
- for (i = 0; ; i++)
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- if (buffer[i] == ';')
- {
- buffer[i] = 0;
- break;
- }
- }
-
- id = atol ((const char*)buffer);
-
- ReadUntil (file, buffer, 3, poll_timeout);
- }
-
- return id;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-void urg_laser::GetSensorConfig (urg_nz_laser_config_t *cfg)
-{
- memset (cfg, 0, sizeof (urg_nz_laser_config_t));
-
- if (SCIP_Version == 1)
- {
- unsigned char buffer[10];
- memset (buffer, 0, 10);
- tcflush (fileno (laser_port), TCIFLUSH);
- // send the command
- fprintf (laser_port, "V\n");
-
- // Set the default resolution
- cfg->resolution = DTOR (270.0) / static_cast<float> (MAX_READINGS);
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer, 4, poll_timeout);
-
- if (strncmp ((const char *) buffer, "V\n0\n", 4) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // The following might not work on all versions of the hokuyos
- // since it reads out the Product description returned by 'V'
-
- ReadUntil_nthOccurence (file, 2, (char)0xa);
-
- // Read FIRM:
- ReadUntil (file, buffer, 5, poll_timeout);
-
- if (strncmp ((const char *) buffer, "FIRM:", 5) == 0)
- {
- // Read the firmware version major value
- ReadUntil (file, buffer, 5, poll_timeout);
- buffer[1] = 0;
- int firmware = atol ((const char*)buffer);
- if (verbose)
- fprintf (stderr, "urg_nz: I: Firmware major version is %d\n", firmware);
-
- if (firmware < 3)
- {
- ReadUntil_nthOccurence (file, 4, (char)0xa);
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Bad firmware version: " << firmware;
- throw urg_nz_exception (URG_ERR_BADFIRMWARE, error_desc.str ());
- }
- }
-
- ReadUntil_nthOccurence(file, 1, (char)'(');
- ReadUntil_nthOccurence(file, 1, (char)'-');
-
- int i = 0;
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- } while (buffer[i++] != '[');
-
- buffer[i-1] = 0;
- int max_range = atol((const char*)buffer);
-
- ReadUntil_nthOccurence (file, 2, (char)',');
- i = 0;
- do
- {
- ReadUntil(file, &buffer[i], 1, poll_timeout);
- } while (buffer[i++] != '-');
-
- buffer[i-1] = 0;
- int min_i = atol ((const char*)buffer);
- i = 0;
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- } while (buffer[i++] != '[');
- buffer[i-1] = 0;
-
- int max_i = atol ((const char*)buffer);
-
- ReadUntil (file, buffer, 4, poll_timeout);
- if (strncmp ((const char *) buffer, "step", 4) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading angle_min_idx and angle_max_idx. Check firmware version.";
- throw urg_nz_exception (URG_ERR_READ, error_desc.str ());
- }
- cfg->max_range = max_range;
- cfg->min_angle = (min_i-384)*cfg->resolution;
- cfg->max_angle = (max_i-384)*cfg->resolution;
- if (verbose)
- {
- fprintf (stderr, "urg_nz: I: URG-04 specifications: [min_angle, max_angle, resolution, max_range] = [%f, %f, %f, %f]\n",
- cfg->min_angle, cfg->max_angle, cfg->resolution, cfg->max_range);
- }
- tcflush (fileno(laser_port), TCIFLUSH);
- }
- else // SCIP_Version = 2
- {
- // ask hokuyo: PP
- unsigned char buffer[10];
- memset (buffer, 0, 10);
- tcflush (fileno (laser_port), TCIFLUSH);
-
- // send the command
- fprintf (laser_port, "PP\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- ReadUntil (file, buffer,7, poll_timeout);
-
- if (strncmp ((const char *) buffer, "PP\n00P\n", 7) != 0)
- {
- tcflush (fileno (laser_port), TCIFLUSH);
- stringstream error_desc;
- error_desc << "Error reading command result: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
- int i = 0;
- ReadUntil_nthOccurence (file, 2, (char)0xa);
- // read DMAX
- ReadUntil_nthOccurence (file, 1, ':');
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- i++;
- } while (buffer[i-1] != ';');
- buffer[i-1] = 0;
- cfg->max_range = atol ((const char*)buffer);
-
- // read angular resolution
- ReadUntil_nthOccurence (file, 1, ':');
- i = 0;
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- i++;
- } while (buffer[i-1] != ';');
- buffer[i-1] = 0;
- cfg->resolution = DTOR (360.0 / atol ((const char*)buffer));
-
- // read AMIN
- ReadUntil_nthOccurence (file, 1, ':');
- i = 0;
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- i++;
- } while (buffer[i-1] != ';');
- buffer[i-1] = 0;
- cfg->min_angle = atol ((const char*)buffer);
- cfg->min_angle -= 384.0;
- cfg->min_angle *= cfg->resolution;
-
- // read AMAX
- ReadUntil_nthOccurence (file, 1, ':');
- i=0;
- do
- {
- ReadUntil (file, &buffer[i], 1, poll_timeout);
- i++;
- } while (buffer[i-1] != ';');
- buffer[i-1] = 0;
- cfg->max_angle = atol ((const char*)buffer);
- cfg->max_angle -= 384.0;
- cfg->max_angle *= cfg->resolution;
-
- ReadUntil_nthOccurence (file, 4, (char)0xa);
-
- if (verbose)
- {
- fprintf (stderr, "urg_nz: I: URG-04 specifications: [min_angle, max_angle, resolution, max_range] = [%f, %f, %f, %f]\n",
- cfg->min_angle, cfg->max_angle, cfg->resolution, cfg->max_range);
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-int urg_laser::GetSCIPVersion (void)
-{
- unsigned char buffer [18];
- memset (buffer, 0, 18);
- int file = fileno (laser_port);
- /////////////////
- // try SCIP1 first:
- /////////////////
- tcflush (fileno (laser_port), TCIFLUSH);
- fprintf (laser_port, "V\n");
-
- // check the returned command
- memset (buffer, 0, 18);
- ReadUntil (file, buffer, 4, poll_timeout);
-
- if (strncmp ((const char *) buffer, "V\n0\n", 4) != 0)
- {
- // SCIP1.0 failed, so we test it with SCIP2.0:
- tcflush (fileno (laser_port), TCIFLUSH);
- fprintf (laser_port, "VV\n");
-
- int file = fileno (laser_port);
-
- // check the returned command
- memset (buffer, 0, 18);
- ReadUntil (file, buffer, 7, poll_timeout);
- tcflush (fileno (laser_port), TCIFLUSH);
-
- if (strncmp ((const char *) buffer, "VV\n00P\n", 7) != 0)
- {
- stringstream error_desc;
- error_desc << "Error reading after VV command. Answer: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // Set SCIP version 2 and return
- SCIP_Version = 2;
- return SCIP_Version;
- }
-
- // we are currently in SCIP 1.0
- else
- {
- buffer[0] = 0;
- // Read the rest of the values, up till right before firmware version
- ReadUntil_nthOccurence (file, 2, (char)0xa);
- // Read "FIRM:"
- memset (buffer, 0, 18);
- ReadUntil (file, buffer, 5, poll_timeout);
-
- if (strncmp ((const char *) buffer, "FIRM:", 5) != 0)
- {
- stringstream error_desc;
- error_desc << "FIRM: is not where it is supposed to be: " << buffer;
- throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
- }
-
- // Read the firmware version major value
- ReadUntil (file, buffer, 5, poll_timeout);
- buffer[1] = 0;
- int firmware = atol ((const char*)buffer);
- if (verbose)
- fprintf (stderr, "urg_nz: I: Firmware major version is %d\n", firmware);
-
- ReadUntil_nthOccurence (file, 4, (char)0xa);
- if (firmware < 3)
- {
- // Set SCIP version 1 and return
- SCIP_Version = 1;
- return SCIP_Version;
- }
- else
- {
- // try to switch to SCIP2.0
- tcflush (fileno (laser_port), TCIFLUSH);
- fprintf (laser_port, "SCIP2.0\n");
-
- // check the returned command
- memset (buffer, 0, 18);
- ReadUntil (file, buffer, 2, poll_timeout);
- if (strncmp ((const char *) buffer, "SC", 2) != 0)
- {
- // Set SCIP version 1 and return
- SCIP_Version = 1;
- return SCIP_Version;
- }
- else
- {
- memset (&buffer[2], 0, 16);
- ReadUntil (file, &buffer[2], 8, poll_timeout);
- if (strncmp ((const char *) buffer, "SCIP2.0\n0\n", 11) != 0)
- {
- // Set SCIP version 1 and return
- SCIP_Version = 1;
- return SCIP_Version;
- }
- // Set SCIP version 2, turn laser on and return
- SCIP_Version = 2;
- fprintf (laser_port, "BM\n");
- ReadUntil_nthOccurence (file, 3, (char)0xa);
- tcflush (fileno (laser_port), TCIFLUSH);
- return SCIP_Version;
- }
- }
- }
-
- // Shouldn't get here
- stringstream error_desc;
- error_desc << "Unknown SCIP version";
- throw urg_nz_exception (URG_ERR_SCIPVERSION, error_desc.str ());
-}
Copied: gearbox/trunk/retired/urg_nz/urg_nz.cpp (from rev 271, gearbox/trunk/src/urg_nz/urg_nz.cpp)
===================================================================
--- gearbox/trunk/retired/urg_nz/urg_nz.cpp (rev 0)
+++ gearbox/trunk/retired/urg_nz/urg_nz.cpp 2008-07-10 00:15:51 UTC (rev 272)
@@ -0,0 +1,991 @@
+/*
+ * Hokuyo URG laser scanner driver class.
+ * Originally written by Toby Collett for the Player project.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <poll.h>
+#include <sstream>
+
+#include "urg_nz.h"
+
+using namespace urg_nz;
+using namespace std;
+
+#ifndef M_PI
+ #define M_PI 3.14159265358979323846
+#endif
+// Convert radians to degrees
+#ifndef RTOD
+ #define RTOD(r) ((r) * 180 / M_PI)
+#endif
+// Convert degrees to radians
+#ifndef DTOR
+ #define DTOR(d) ((d) * M_PI / 180)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////////////////
+urg_laser::urg_laser (void)
+{
+ // Defaults to SCIP version 1
+ SCIP_Version = 1;
+ laser_port = NULL;
+ verbose = false;
+ poll_timeout = -1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Destructor
+///////////////////////////////////////////////////////////////////////////////
+urg_laser::~urg_laser (void)
+{
+ if (PortOpen ())
+ Close ();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Read functions
+///////////////////////////////////////////////////////////////////////////////
+int urg_laser::ReadUntil_nthOccurence (int file, int n, char c)
+{
+ int retval = 0, bytes_read = 0;
+ unsigned char buffer[2];
+ buffer[0] = 0;
+ buffer[1] = 0;
+ for (int i = 0; i < n; i++)
+ {
+ do
+ {
+ retval = ReadUntil (file, &buffer[0], 1, poll_timeout);
+ if (retval > 0)
+ bytes_read += retval;
+ } while (buffer[0] != c && retval > 0);
+ }
+ return bytes_read;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+int urg_laser::ReadUntil (int fd, unsigned char *buf, int len, int timeout)
+{
+ int ret;
+ int current=0;
+ struct pollfd ufd[1];
+ int retval;
+
+ ufd[0].fd = fd;
+ ufd[0].events = POLLIN;
+
+ do
+ {
+ if(timeout >= 0)
+ {
+ if ((retval = poll (ufd, 1, timeout)) < 0)
+ {
+ stringstream error_desc;
+ error_desc << "Error in ReadUntil at poll(): " << errno << ":" << strerror (errno);
+ throw urg_nz_exception (URG_ERR_READPOLL, error_desc.str ());
+ }
+ else if (retval == 0)
+ {
+ stringstream error_desc;
+ error_desc << "Timed out on poll in ReadUntil";
+ throw urg_nz_exception (URG_ERR_READTIMEOUT, error_desc.str ());
+ }
+ }
+
+ ret = read (fd, &buf[current], len-current);
+ if (ret < 0)
+ {
+ stringstream error_desc;
+ error_desc << "Error in ReadUntil at read(): " << errno << ":" << strerror (errno);
+ throw urg_nz_exception (URG_ERR_READ, error_desc.str ());
+ }
+
+ current += ret;
+ if (current > 2 && current < len && buf[current-2] == '\n' && buf[current-1] == '\n')
+ {
+ stringstream error_desc;
+ error_desc << "Got an end of command while waiting for more data.";
+ throw urg_nz_exception (URG_ERR_PROTOCOL, error_desc.str ());
+ }
+ } while (current < len);
+ return current;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Port control functions
+///////////////////////////////////////////////////////////////////////////////
+int urg_laser::ChangeBaud (int curr_baud, int new_baud)
+{
+ struct termios newtio;
+ int fd;
+ fd = fileno (laser_port);
+ int new_baud_constant;
+
+ switch (curr_baud)
+ {
+ case 19200:
+ curr_baud = B19200;
+ break;
+ case 57600:
+ curr_baud = B57600;
+ break;
+ case 115200:
+ curr_baud = B115200;
+ break;
+ default:
+ stringstream error_desc;
+ error_desc << "Unknown current baud rate: " << curr_baud;
+ throw urg_nz_exception (URG_ERR_BADBAUDRATE, error_desc.str ());
+ }
+
+ switch (new_baud)
+ {
+ case 19200:
+ new_baud_constant = B19200;
+ break;
+ case 57600:
+ new_baud_constant = B57600;
+ break;
+ case 115200:
+ new_baud_constant = B115200;
+ break;
+ default:
+ stringstream error_desc;
+ error_desc << "Unknown new baud rate: " << new_baud;
+ throw urg_nz_exception (URG_ERR_BADBAUDRATE, error_desc.str ());
+ }
+
+ if (tcgetattr (fd, &newtio) < 0)
+ {
+ close (fd);
+ stringstream error_desc;
+ error_desc << "Error in ChangeBaud at tcgetattr: " << errno << ":" << strerror (errno);
+ throw urg_nz_exception (URG_ERR_CHANGEBAUD, error_desc.str ());
+ }
+
+ cfmakeraw (&newtio);
+ cfsetispeed (&newtio, curr_baud);
+ cfsetospeed (&newtio, curr_baud);
+
+ if (tcsetattr (fd, TCSAFLUSH, &newtio) < 0 )
+ {
+ close (fd);
+ stringstream error_desc;
+ error_desc << "Error in ChangeB...
[truncated message content] |
|
From: <gb...@us...> - 2008-07-09 23:57:09
|
Revision: 271
http://gearbox.svn.sourceforge.net/gearbox/?rev=271&view=rev
Author: gbiggs
Date: 2008-07-09 16:57:17 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Minor changes to comments and strings
Modified Paths:
--------------
gearbox/trunk/submitted/flexiport/utils/porttoport.cpp
gearbox/trunk/submitted/hokuyo_aist/doc.dox
gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h
Modified: gearbox/trunk/submitted/flexiport/utils/porttoport.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/utils/porttoport.cpp 2008-07-09 05:36:56 UTC (rev 270)
+++ gearbox/trunk/submitted/flexiport/utils/porttoport.cpp 2008-07-09 23:57:17 UTC (rev 271)
@@ -212,7 +212,7 @@
if ((buffer = reinterpret_cast<uint8_t*> (realloc (buffer,
sizeof (uint8_t) * bytesWaiting + 1))) == NULL)
{
- cerr << "Failed to reallocate memory for right buffer." << endl;
+ cerr << "Failed to reallocate memory for buffer." << endl;
exit (1);
}
bytesToRead = bytesWaiting;
Modified: gearbox/trunk/submitted/hokuyo_aist/doc.dox
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/doc.dox 2008-07-09 05:36:56 UTC (rev 270)
+++ gearbox/trunk/submitted/hokuyo_aist/doc.dox 2008-07-09 23:57:17 UTC (rev 271)
@@ -49,6 +49,10 @@
@par Dependencies
@ref Flexiport
+@par Known issues
+ - There has been a report that retrieving data over the serial connection of a URG-04LX is
+ unusually slow (~1Hz).
+
*/
/*!
Modified: gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h 2008-07-09 05:36:56 UTC (rev 270)
+++ gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h 2008-07-09 23:57:17 UTC (rev 271)
@@ -387,8 +387,9 @@
/** @brief Get a new scan from the scanner.
Unlike @ref GetRanges, which returns the most recent scan the scanner took, this function
- will request a new scan. This means it will wait while the scanner performs the scan.
- Otherwise behaves identicallty to @ref GetRanges.
+ will request a new scan. This means it will wait while the scanner performs the scan, which
+ means the rate at which scans can be retrieved using this function is less than with @ref
+ GetRanges. Otherwise behaves identicallty to @ref GetRanges.
Not available with the SCIP v1 protocol.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <to...@us...> - 2008-07-09 05:36:47
|
Revision: 270
http://gearbox.svn.sourceforge.net/gearbox/?rev=270&view=rev
Author: tobasco
Date: 2008-07-08 22:36:56 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
moved smartbatteryacfr to src
Modified Paths:
--------------
gearbox/trunk/src/CMakeLists.txt
gearbox/trunk/submitted/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/src/gbxsmartbatteryacfr/
Removed Paths:
-------------
gearbox/trunk/submitted/gbxsmartbatteryacfr/
Modified: gearbox/trunk/src/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/CMakeLists.txt 2008-07-09 03:07:18 UTC (rev 269)
+++ gearbox/trunk/src/CMakeLists.txt 2008-07-09 05:36:56 UTC (rev 270)
@@ -11,4 +11,5 @@
ADD_SUBDIRECTORY( gbxutilacfr )
ADD_SUBDIRECTORY( gbxgarminacfr )
ADD_SUBDIRECTORY( gbxsickacfr )
+ADD_SUBDIRECTORY( gbxsmartbatteryacfr )
ADD_SUBDIRECTORY( urg_nz )
Copied: gearbox/trunk/src/gbxsmartbatteryacfr (from rev 269, gearbox/trunk/submitted/gbxsmartbatteryacfr)
Modified: gearbox/trunk/submitted/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/CMakeLists.txt 2008-07-09 03:07:18 UTC (rev 269)
+++ gearbox/trunk/submitted/CMakeLists.txt 2008-07-09 05:36:56 UTC (rev 270)
@@ -11,7 +11,6 @@
# Otherwise, maintain alphabetical order.
# E.g. ADD_SUBDIRECTORY( mydir )
ADD_SUBDIRECTORY( flexiport )
- ADD_SUBDIRECTORY( gbxsmartbatteryacfr )
ADD_SUBDIRECTORY( gbxnovatelacfr )
ADD_SUBDIRECTORY( hokuyo_aist )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <to...@us...> - 2008-07-09 03:07:13
|
Revision: 269
http://gearbox.svn.sourceforge.net/gearbox/?rev=269&view=rev
Author: tobasco
Date: 2008-07-08 20:07:18 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
more docco after hardware test
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsmartbatteryacfr/oceanserversystem.h
gearbox/trunk/submitted/gbxsmartbatteryacfr/smartbatteryacfr.dox
Modified: gearbox/trunk/submitted/gbxsmartbatteryacfr/oceanserversystem.h
===================================================================
--- gearbox/trunk/submitted/gbxsmartbatteryacfr/oceanserversystem.h 2008-07-08 03:59:24 UTC (rev 268)
+++ gearbox/trunk/submitted/gbxsmartbatteryacfr/oceanserversystem.h 2008-07-09 03:07:18 UTC (rev 269)
@@ -47,8 +47,8 @@
int minToEmpty;
std::string messageToSystem;
- //! Battery module states.
- //! Each vector is always of size 8 because OceanServer's MP08 battery management module has 8 slots
+ //! Battery module states. Each vector is always of size 8 because OceanServer's Battery
+ //! Management Modules have a maximum of 8 slots (either 2, 4, or 8 dependent on the model)
std::vector<bool> availableBatteries;
std::vector<bool> chargingStates;
std::vector<bool> supplyingPowerStates;
Modified: gearbox/trunk/submitted/gbxsmartbatteryacfr/smartbatteryacfr.dox
===================================================================
--- gearbox/trunk/submitted/gbxsmartbatteryacfr/smartbatteryacfr.dox 2008-07-08 03:59:24 UTC (rev 268)
+++ gearbox/trunk/submitted/gbxsmartbatteryacfr/smartbatteryacfr.dox 2008-07-09 03:07:18 UTC (rev 269)
@@ -52,12 +52,12 @@
- This is a Linux-only implementation (due to the Linux-only serial library).
- It works with those serial devices which @ref gbx_library_gbxserialacfr supports.
- The library is tailored to the OceanServer battery system.
-- Has been tested with the following hardware configuration: battery management module MP08SR, DC/DC converter module DC123SR, and a variable number of battery modules of type BA95HC-FL (can be added and removed at runtime)
+- Has been tested with Battery Management Modules MP08SR and BB04FR and a variable number of battery modules of type BA95HC-FL (individual modules can be added and removed at runtime).
- Has been tested with the following firmware: V2.10 (2007)
-@par MP08SR Layout
+@par MP08SR and BB04FR Layouts
-The battery number reported by the driver corresponds to the following connectors on the Battery Management Module board MP08SR:
+The battery number reported by the driver corresponds to the following connectors on the Battery Management Module boards (the BB04FR board only has the lower level whereas the MP08SR has both levels):
@verbatim
Level 1 (lower level):
@@ -82,6 +82,7 @@
- SmartBattery standard: http://sbs-forum.org/specs/
- OceanServer battery systems: http://www.ocean-server.com/overview.html
- OceanServer battery system manuals: http://www.ocean-server.com/download.html
+- OceanServer online store: http://www.oceanserver-store.com/
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-08 03:59:15
|
Revision: 268
http://gearbox.svn.sourceforge.net/gearbox/?rev=268&view=rev
Author: rumataxyz
Date: 2008-07-07 20:59:24 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
more detailed decoding of receiver status, added type info to the toString gear
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-08 03:58:07 UTC (rev 267)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-08 03:59:24 UTC (rev 268)
@@ -753,6 +753,7 @@
std::string
InsPvaData::toString(){
std::stringstream ss;
+ ss << "InsPvaData ";
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
ss << "gpsWeekNr " << std::fixed << std::setprecision(4) << gpsWeekNr << " ";
@@ -773,6 +774,7 @@
std::string
BestGpsPosData::toString(){
std::stringstream ss;
+ ss << "BestGpsPosData ";
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
ss << "gpsWeekNr " << gpsWeekNr << " ";
@@ -804,8 +806,9 @@
};
std::string
- BestGpsVelData::toString(){
+BestGpsVelData::toString(){
std::stringstream ss;
+ ss << "BestGpsVelData ";
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
ss << "gpsWeekNr " << gpsWeekNr << " ";
@@ -824,7 +827,7 @@
std::string
RawImuData::toString(){
std::stringstream ss;
- //int defPrecsion = ss.precision();
+ ss << "RawImuData ";
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
ss << "gpsWeekNr " << std::fixed << gpsWeekNr << " ";
@@ -1054,11 +1057,42 @@
data->statusMessage = "all is good";
lastStatusWasGood = true;
}
- }else{
- //whoops
- data->statusMessageType = gna::Fault; // warning?
+ }else if(true == gnua::receiverStatusIsWarning(bestGpsPos.header.receiverStatus)){
+ data->statusMessageType = gna::Warning;
data->statusMessage = gnua::receiverStatusToString(bestGpsPos.header.receiverStatus);
lastStatusWasGood = false;
+ }else if(true == gnua::receiverStatusIsError(bestGpsPos.header.receiverStatus)){
+ data->statusMessageType = gna::Fault;
+ data->statusMessage = gnua::receiverStatusToString(bestGpsPos.header.receiverStatus);
+ lastStatusWasGood = false;
+ }else if(true == gnua::receiverStatusIsFatal(bestGpsPos.header.receiverStatus)){
+ //ouch, need to bug out
+ std::stringstream ss;
+ ss << "Receiver reports hardware-error! This is not recoverable!\n"
+ << "You can get additional information by sending \"log rxstatusa once\" to the receiver (minicom/other-terminal-program)!\n"
+ << "GpsStatus:\n";
+ ss << gnua::receiverStatusToString(bestGpsPos.header.receiverStatus);
+ lastStatusWasGood = false;
+ throw ( gua::HardwareException(ERROR_INFO, ss.str()) );
+ }else if(true == gnua::receiverStatusIsReservedValue(bestGpsPos.header.receiverStatus)){
+ //whoops
+ data->statusMessageType = gna::Warning;
+ std::stringstream ss;
+ ss << "Got GPS status which used to be a reserved value: 0x" << hex << bestGpsPos.header.receiverStatus
+ << " Please check your manual what this means, and tell us (gea...@li...) about it.\n"
+ << "Thanks.\n";
+ data->statusMessage = ss.str();
+ lastStatusWasGood = false;
+ }else{
+ // Can't happen
+ data->statusMessageType = gna::Warning;
+ std::stringstream ss;
+ ss << "Failed to decode GPS status: 0x" << hex << bestGpsPos.header.receiverStatus
+ << " Please send a bug-report to gea...@li....\n"
+ << "Include this message and details about your hardware/software configuration.\n"
+ << "Thanks.\n";
+ data->statusMessage = ss.str();
+ lastStatusWasGood = false;
}
return genericData;
@@ -1100,12 +1134,47 @@
data->statusMessage = "all is good";
lastStatusWasGood = true;
}
- }else{
- //whoops
- data->statusMessageType = gna::Fault; // warning?
+ }else if(true == gnua::receiverStatusIsWarning(bestGpsVel.header.receiverStatus)){
+ data->statusMessageType = gna::Warning;
data->statusMessage = gnua::receiverStatusToString(bestGpsVel.header.receiverStatus);
lastStatusWasGood = false;
+ }else if(true == gnua::receiverStatusIsError(bestGpsVel.header.receiverStatus)){
+ data->statusMessageType = gna::Fault;
+ data->statusMessage = gnua::receiverStatusToString(bestGpsVel.header.receiverStatus);
+ lastStatusWasGood = false;
+ }else if(true == gnua::receiverStatusIsFatal(bestGpsVel.header.receiverStatus)){
+ //ouch, need to bug out
+ std::stringstream ss;
+ ss << "Receiver reports hardware-error! This is not recoverable!\n"
+ << "You can get additional information by sending \"log rxstatusa once\" to the receiver (minicom/other-terminal-program)!\n"
+ << "GpsStatus:\n";
+ ss << gnua::receiverStatusToString(bestGpsVel.header.receiverStatus);
+ lastStatusWasGood = false;
+ throw ( gua::HardwareException(ERROR_INFO, ss.str()) );
+ }else if(true == gnua::receiverStatusIsReservedValue(bestGpsVel.header.receiverStatus)){
+ //whoops
+ data->statusMessageType = gna::Warning;
+ std::stringstream ss;
+ ss << "Got GPS status which used to be a reserved value: 0x" << hex << bestGpsVel.header.receiverStatus
+ << " Please check your manual what this means, and tell us (gea...@li...) about it.\n"
+ << "Thanks.\n";
+ data->statusMessage = ss.str();
+ lastStatusWasGood = false;
+ }else{
+ // Can't happen
+ data->statusMessageType = gna::Warning;
+ std::stringstream ss;
+ ss << "Failed to decode GPS status: 0x" << hex << bestGpsVel.header.receiverStatus
+ << " Please send a bug-report to gea...@li....\n"
+ << "Include this message and details about your hardware/software configuration.\n"
+ << "Thanks.\n";
+ data->statusMessage = ss.str();
+ lastStatusWasGood = false;
}
+
+
+
+
return genericData;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-08 03:57:57
|
Revision: 267
http://gearbox.svn.sourceforge.net/gearbox/?rev=267&view=rev
Author: rumataxyz
Date: 2008-07-07 20:58:07 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
more status decoding
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h 2008-07-08 03:57:12 UTC (rev 266)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h 2008-07-08 03:58:07 UTC (rev 267)
@@ -15,60 +15,68 @@
#include <sstream>
namespace gbxnovatelutilacfr{
bool receiverStatusIsGood(uint32_t receiverStatus){
- return 0 == (receiverStatus & 0xe1fe8fef);
+ return 0 == (receiverStatus & 0xe1fe8fef); // quick cross-check: this magic value needs to be the sum of the magic values in the next three functions
}
-//bool receiverStatusIsWarning(uint32_t receiverStatus){
-//}
-//bool receiverStatusIsError(uint32_t receiverStatus){
-//}
+bool receiverStatusIsWarning(uint32_t receiverStatus){
+ return 0 != (receiverStatus & 0xe1fc000e);
+}
+bool receiverStatusIsError(uint32_t receiverStatus){
+ return 0 != (receiverStatus & 0x00028fe0);
+}
+bool receiverStatusIsFatal(uint32_t receiverStatus){
+ return 0 != (receiverStatus & 0x00000001);
+}
+bool receiverStatusIsReservedValue(uint32_t receiverStatus){
+ return 0 != (receiverStatus & 0x1e017010); // quick cross-check: this magic value, summed with the one from receiverStatusIsGood() should yield 0xffffffff
+}
std::string receiverStatusToString(uint32_t receiverStatus){
std::stringstream ss;
ss << "Error flag: "
- << ((0 == (receiverStatus & 0x00000001)) ? "No error" : "Error") << "; ";
+ << ((0 == (receiverStatus & 0x00000001)) ? "No error" : "Error") << "; "; // unrecoverable --> exception
ss << "Temperature status: "
- << ((0 == (receiverStatus & 0x00000002)) ? "Within specifications" : "Warning") << "; ";
+ << ((0 == (receiverStatus & 0x00000002)) ? "Within specifications" : "Warning") << "; ";// warning (error?)
ss << "Voltage supply status: "
- << ((0 == (receiverStatus & 0x00000004)) ? "OK" : "Warning") << "; ";
+ << ((0 == (receiverStatus & 0x00000004)) ? "OK" : "Warning") << "; "; // warning (error?)
ss << "Antenna power status: "
- << ((0 == (receiverStatus & 0x00000008)) ? "Powered" : "Not powered") << "; ";
+ << ((0 == (receiverStatus & 0x00000008)) ? "Powered" : "Not powered") << "; "; // warning (are there unpowered antennas??)
ss << "Antenna open flag: "
- << ((0 == (receiverStatus & 0x00000020)) ? "OK" : "Open") << "; ";
+ << ((0 == (receiverStatus & 0x00000020)) ? "OK" : "Open") << "; "; // error
ss << "Antenna shorted flag: "
- << ((0 == (receiverStatus & 0x00000040)) ? "OK" : "Shorted") << "; ";
+ << ((0 == (receiverStatus & 0x00000040)) ? "OK" : "Shorted") << "; "; // error
ss << "CPU overload flag: "
- << ((0 == (receiverStatus & 0x00000080)) ? "No overload" : "Overload") << "; ";
+ << ((0 == (receiverStatus & 0x00000080)) ? "No overload" : "Overload") << "; "; // error (recoverable? warning?)
ss << "COM1 buffer overrun flag: "
- << ((0 == (receiverStatus & 0x00000100)) ? "No overrun" : "Overrun") << "; ";
+ << ((0 == (receiverStatus & 0x00000100)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?)
ss << "COM2 buffer overrun flag: "
- << ((0 == (receiverStatus & 0x00000200)) ? "No overrun" : "Overrun") << "; ";
+ << ((0 == (receiverStatus & 0x00000200)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?)
ss << "COM3 buffer overrun flag: "
- << ((0 == (receiverStatus & 0x00000400)) ? "No overrun" : "Overrun") << "; ";
+ << ((0 == (receiverStatus & 0x00000400)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?)
ss << "USB buffer overrun flag: "
- << ((0 == (receiverStatus & 0x00000800)) ? "No overrun" : "Overrun") << "; ";
+ << ((0 == (receiverStatus & 0x00000800)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?)
ss << "RF1 AGC status: "
- << ((0 == (receiverStatus & 0x00008000)) ? "OK" : "Bad") << "; ";
+ << ((0 == (receiverStatus & 0x00008000)) ? "OK" : "Bad") << "; "; // error
ss << "RF2 AGC status: "
- << ((0 == (receiverStatus & 0x00020000)) ? "OK" : "Bad") << "; ";
+ << ((0 == (receiverStatus & 0x00020000)) ? "OK" : "Bad") << "; "; // error
ss << "Almanac flag/UTC known: "
- << ((0 == (receiverStatus & 0x00040000)) ? "Valid" : "Invalid") << "; ";
+ << ((0 == (receiverStatus & 0x00040000)) ? "Valid" : "Invalid") << "; "; //warning
ss << "Position solution flag: "
- << ((0 == (receiverStatus & 0x00080000)) ? "Valid" : "Invalid") << "; ";
+ << ((0 == (receiverStatus & 0x00080000)) ? "Valid" : "Invalid") << "; "; //warning
ss << "Position fixed flag: "
- << ((0 == (receiverStatus & 0x00100000)) ? "Not" : "fixed Fixed") << "; ";
+ << ((0 == (receiverStatus & 0x00100000)) ? "Not" : "fixed Fixed") << "; "; //warning
ss << "Clock steering status: "
- << ((0 == (receiverStatus & 0x00200000)) ? "Enabled" : "Disabled") << "; ";
+ << ((0 == (receiverStatus & 0x00200000)) ? "Enabled" : "Disabled") << "; "; //warning
ss << "Clock model flag: "
- << ((0 == (receiverStatus & 0x00400000)) ? "Valid" : "Invalid") << "; ";
+ << ((0 == (receiverStatus & 0x00400000)) ? "Valid" : "Invalid") << "; "; //warning
ss << "OEMV card external oscillator flag: "
- << ((0 == (receiverStatus & 0x00800000)) ? "Disabled" : "Enabled") << "; ";
+ << ((0 == (receiverStatus & 0x00800000)) ? "Disabled" : "Enabled") << "; "; //warning (is this really a warning??)
ss << "Software resource: "
- << ((0 == (receiverStatus & 0x01000000)) ? "OK" : "Warning") << "; ";
+ << ((0 == (receiverStatus & 0x01000000)) ? "OK" : "Warning") << "; "; //warning (error?)
ss << "Auxiliary 3 status event flag: "
- << ((0 == (receiverStatus & 0x20000000)) ? "No event" : "Event") << "; ";
+ << ((0 == (receiverStatus & 0x20000000)) ? "No event" : "Event") << "; "; //warning
ss << "Auxiliary 2 status event flag: "
- << ((0 == (receiverStatus & 0x40000000)) ? "No event" : "Event") << "; ";
+ << ((0 == (receiverStatus & 0x40000000)) ? "No event" : "Event") << "; "; //warning
ss << "Auxiliary 1 status event flag: "
- << ((0 == (receiverStatus & 0x80000000)) ? "No event" : "Event");
+ << ((0 == (receiverStatus & 0x80000000)) ? "No event" : "Event"); //warning
return ss.str();
}
}//namespace
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-08 03:57:04
|
Revision: 266
http://gearbox.svn.sourceforge.net/gearbox/?rev=266&view=rev
Author: rumataxyz
Date: 2008-07-07 20:57:12 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
confirmed unit of error estimates
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-08 03:56:31 UTC (rev 265)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-08 03:57:12 UTC (rev 266)
@@ -62,9 +62,9 @@
double heightAMSL; //24 8 [m] AMSL == above mean sea level (geoid)
float undulation; //32 4 [m] aka geoidal seperation: undulation == heigth_ellipsoid - height_geoid/AMSL
uint32_t datumId; //36 4
- float sigmaLatitude; //40 4 [m? deg?] 1 standard deviation error estimate
- float sigmaLongitude; //44 4 [m? deg?] 1 standard deviation error estimate
- float sigmaHeight; //48 4 [m? deg?] 1 standard deviation error estimate
+ float sigmaLatitude; //40 4 [m] 1 standard deviation error estimate
+ float sigmaLongitude; //44 4 [m] 1 standard deviation error estimate
+ float sigmaHeight; //48 4 [m] 1 standard deviation error estimate
int8_t baseStationId[4]; //52 4
float diffAge; //56 4 [s]
float solutionAge; //60 4 [s]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-08 03:56:23
|
Revision: 265
http://gearbox.svn.sourceforge.net/gearbox/?rev=265&view=rev
Author: rumataxyz
Date: 2008-07-07 20:56:31 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
confirmed unit of position error estimates
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-05 05:31:12 UTC (rev 264)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-08 03:56:31 UTC (rev 265)
@@ -334,9 +334,9 @@
double heightAMSL; //!< [m] AMSL == above mean sea level (geoid)
float undulation; //!< [m] aka geoidal seperation: undulation == heigth_ellipsoid - height_geoid/AMSL
unsigned int datumId; //
- float sigmaLatitude; //!< [m? deg?] 1 standard deviation error estimate
- float sigmaLongitude; //!< [m? deg?] 1 standard deviation error estimate
- float sigmaHeight; //!< [m? deg?] 1 standard deviation error estimate
+ float sigmaLatitude; //!< [m] 1 standard deviation error estimate
+ float sigmaLongitude; //!< [m] 1 standard deviation error estimate
+ float sigmaHeight; //!< [m] 1 standard deviation error estimate
char baseStationId[4]; //
float diffAge; //!< [s] how old the correction info from the basestation is
float solutionAge; //!< [s]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-05 05:31:02
|
Revision: 264
http://gearbox.svn.sourceforge.net/gearbox/?rev=264&view=rev
Author: rumataxyz
Date: 2008-07-04 22:31:12 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
got rid of unused variable
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-04 13:15:31 UTC (rev 263)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-05 05:31:12 UTC (rev 264)
@@ -753,7 +753,6 @@
std::string
InsPvaData::toString(){
std::stringstream ss;
- int defPrecsion = ss.precision();
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
ss << "gpsWeekNr " << std::fixed << std::setprecision(4) << gpsWeekNr << " ";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-04 13:15:35
|
Revision: 263
http://gearbox.svn.sourceforge.net/gearbox/?rev=263&view=rev
Author: rumataxyz
Date: 2008-07-04 06:15:31 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
corrected some typos, added checking during initialisation phase, cerr for errors, sensible precision for toString() gear
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
gearbox/trunk/submitted/gbxnovatelacfr/driver.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-04 13:11:12 UTC (rev 262)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.cpp 2008-07-04 13:15:31 UTC (rev 263)
@@ -20,6 +20,7 @@
#include <gbxutilacfr/trivialtracer.h>
#include <iostream>
+#include <iomanip>
#include <sstream>
#include <stdlib.h>
#include <assert.h>
@@ -106,12 +107,14 @@
baud_ = config_.baudRate_;
std::string serialDevice = config_.serialDevice_;
serial_.reset(new Serial( serialDevice, baud_, Serial::Timeout(1,0) ));
+ assert(0 != serial_.get());
serial_->setDebugLevel(0);
+
connectToHardware();
-
// just in case something is running... stops the novatel logging any messages
serial_->writeString( "unlogall\r\n" );
serial_->drain();
+ serial_->flush();
configureImu();
configureIns();
configureGps();
@@ -154,7 +157,7 @@
tracer_->info( "Trying to hook up to receiver at different Baudrates" );
int maxTry = 4;
int successThresh = 4;
- int timeOutMsec = 150;
+ int timeOutMsec = 250;
std::string challenge("unlogall\r\n");
std::string ack("<OK");
size_t i=0;
@@ -188,39 +191,63 @@
void
Driver::configureImu() {
- int put;
+ std::string challenge = "";
+ std::string ack = "<OK";
+ std::string errorResponse = "";
+ int timeOutMsec = 200;
if(config_.enableImu_){
+ tracer_->info("Configuring IMU, switching INS ON!");
imuDecoder_.reset(gnua::createImuDecoder(config_.imuType_));
std::stringstream ss;
// tell the novatel what serial port the imu is attached to (com3 == aux)
- put = serial_->writeString( "interfacemode com3 imu imu on\r\n" );
+ challenge = ( "interfacemode com3 imu imu on\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
// the type of imu being used
ss << "setimutype "
<< config_.imuType_
<< "\r\n";
- put = serial_->writeString( ss.str().c_str() );
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
+ challenge = "inscommand enable\r\n";
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
//force the IMU to re-align at every startup
//put = serial_->writeString( "inscommand reset\r\n" );
//tracer_->info("Reset IMU; Waiting 5 seconds before continuing!");
//sleep(5);
}else{
- // no IMU --> disable INS
- put = serial_->writeString( "inscommand disable\r\n" );
+ tracer_->info("No IMU, switching INS OFF!");
+ challenge = "inscommand disable\r\n";
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
return;
}
void
Driver::configureIns() {
- int put;
+ std::string challenge = "";
+ std::string ack = "<OK";
+ std::string errorResponse = "";
+ int timeOutMsec = 200;
+
if(config_.enableSetImuOrientation_ && config_.enableImu_){
std::stringstream ss;
// imu orientation constant
// this tells the imu where its z axis (up) is pointing. constants defined in manual.
// with imu mounted upside down, constant is 6 and axes are remapped: x = y, y = x, -z = z
ss << "setimuorientation " << config_.setImuOrientation_ << "\r\n";
- put = serial_->writeString( ss.str().c_str() );
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
if(config_.enableVehicleBodyRotation_ && config_.enableImu_){
@@ -240,102 +267,155 @@
<< config_.vehicleBodyRotationUncertainty_[2];
}
ss << "\r\n";
- put = serial_->writeString( ss.str().c_str() );
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
if(config_.enableImu_){
std::stringstream ss;
// The span system kalman fiter needs this info; make _sure_ you do this right
ss << "setimutoantoffset "
- << config_.imuToGpsOffset_[0]
- << config_.imuToGpsOffset_[1]
+ << config_.imuToGpsOffset_[0] << " "
+ << config_.imuToGpsOffset_[1] << " "
<< config_.imuToGpsOffset_[2];
if( 3 == config_.imuToGpsOffsetUncertainty_.size() ){
- ss << config_.imuToGpsOffsetUncertainty_[0]
- << config_.imuToGpsOffsetUncertainty_[1]
+ ss << " "
+ << config_.imuToGpsOffsetUncertainty_[0] << " "
+ << config_.imuToGpsOffsetUncertainty_[1] << " "
<< config_.imuToGpsOffsetUncertainty_[2];
}
ss << "\r\n";
- put = serial_->writeString( ss.str().c_str() );
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
return;
}
void
Driver::configureGps() {
+ std::string challenge = "";
+ std::string ack = "<OK";
+ std::string errorResponse = "";
+ int timeOutMsec = 200;
+
// hardcoded settings first
// turn off posave as this command implements position averaging for base stations.
- int put = serial_->writeString( "posave off\r\n" );
// make sure that fixposition has not been set
- put = serial_->writeString( "fix none\r\n" );
+ challenge = ( "fix none\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
// select the geodetic datum for operation of the receiver (wgs84 = default)
- put = serial_->writeString( "datum wgs84\r\n" );
+ challenge = ( "datum wgs84\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
//Let the receiver figure out which range corrections are best
- put = serial_->writeString( "PSRDIFFSOURCE AUTO\r\n" );
+ challenge = ( "PSRDIFFSOURCE AUTO\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
// CDGPS
if(config_.enableCDGPS_){
tracer_->info("Turning on CDGPS!");
- put = serial_->writeString( "ASSIGNLBAND CDGPS 1547547 4800\r\n" );
+ challenge = ( "ASSIGNLBAND CDGPS 1547547 4800\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
// turn SBAS on/off (essentially global DGPS)
if(config_.enableSBAS_){
tracer_->info("Turning on SBAS!");
- put = serial_->writeString( "SBASCONTROL ENABLE Auto 0 ZEROTOTWO\r\n");
+ challenge = ( "SBASCONTROL ENABLE Auto 0 ZEROTOTWO\r\n");
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
//we try to use WAAS satellites even below the horizon
- put = serial_->writeString( "WAASECUTOFF -5.0\r\n");
+ challenge = ( "WAASECUTOFF -5.0\r\n");
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
else{
tracer_->info("Turning off SBAS!");
- put = serial_->writeString( "SBASCONTROL DISABLE Auto 0 NONE\r\n");
+ challenge = ( "SBASCONTROL DISABLE Auto 0 NONE\r\n");
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
// rtk
if(config_.enableRTK_){
tracer_->info("Turning on RTK!");
- put = serial_->writeString( "com com2,9600,n,8,1,n,off,on\r\n" );
- put = serial_->writeString( "interfacemode com2 rtca none\r\n" );
+ challenge = ( "com com2,9600,n,8,1,n,off,on\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
+ challenge = ( "interfacemode com2 rtca none\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
if(config_.enableUseOfOmniStarCarrier_){
//Let the receiver figure out which rtk corrections are best
- put = serial_->writeString( "RTKSOURCE AUTO\r\n" );
+ challenge = ( "RTKSOURCE AUTO\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}else{
//We only use our own rtk corrections; _not_ OmniSTAR HP/XP
- put = serial_->writeString( "RTKSOURCE RTCA ANY\r\n" );
+ challenge = ( "RTKSOURCE RTCA ANY\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
return;
}
void
Driver::requestData() {
+ std::string challenge = "";
+ std::string ack = "<OK";
+ std::string errorResponse = "";
+ int timeOutMsec = 200;
//we assume that the config_ has been checked at this point (isValid())
//so we don't need to check that the rates make sense
- int put;
// GPS messages
// gps position without ins
if(config_.enableGpsPos_){
std::stringstream ss;
- ss << "log bestgpsposb ontime " << config_.dtGpsPos_ << "\r\n";
- put = serial_->writeString(ss.str().c_str());
- ss.str("");
ss << "Turning on GPS position at " << 1.0/config_.dtGpsPos_ << "Hz!";
tracer_->info(ss.str().c_str());
+ ss.str("");
+ ss << "log bestgpsposb ontime " << config_.dtGpsPos_ << "\r\n";
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ //throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
// gps velocity without ins
if(config_.enableGpsVel_){
std::stringstream ss;
- ss << "log bestgpsvelb ontime " << config_.dtGpsVel_ << "\r\n";
- put = serial_->writeString(ss.str().c_str());
- ss.str("");
ss << "Turning on GPS velocity at " << 1.0/config_.dtGpsVel_ << "Hz!";
tracer_->info(ss.str().c_str());
+ ss.str("");
+ ss << "log bestgpsvelb ontime " << config_.dtGpsVel_ << "\r\n";
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ //throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
@@ -344,11 +424,14 @@
// pva data in wgs84 coordinates
if(config_.enableInsPva_){
std::stringstream ss;
- ss << "log inspvasb ontime " << config_.dtInsPva_ << "\r\n";
- put = serial_->writeString(ss.str().c_str());
- ss.str("");
ss << "Turning on INS position/velocity/orientation at " << 1.0/config_.dtInsPva_ << "Hz!";
tracer_->info(ss.str().c_str());
+ ss.str("");
+ ss << "log inspvasb ontime " << config_.dtInsPva_ << "\r\n";
+ challenge = ss.str();
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ //throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
}
@@ -356,7 +439,10 @@
// raw accelerometer and gyro data
if(config_.enableRawImu_){
- put = serial_->writeString( "log rawimusb onnew\r\n" );
+ challenge = ( "log rawimusb onnew\r\n" );
+ if(false == gnua::sendCmdWaitForResponse(challenge, ack, errorResponse, *(serial_.get()), timeOutMsec)){
+ //throw ( gua::Exception(ERROR_INFO, errorResponse));
+ }
tracer_->info("Turning on raw imu data!");
}
@@ -497,7 +583,7 @@
&& 57600 != baudRate_
&& 115200 != baudRate_
&& 230400 != baudRate_)){
- std::cout << "serial settings invalid\n";
+ std::cerr << "serial settings invalid\n";
valid = false;
}
@@ -507,59 +593,59 @@
|| 3 != imuToGpsOffset_.size()
|| ( 3 != imuToGpsOffsetUncertainty_.size()
&& 0 != imuToGpsOffsetUncertainty_.size()))){
- std::cout << "imuType/imuToGpsOffset invalid\n";
+ std::cerr << "imuType/imuToGpsOffset invalid\n";
valid = false;
}
if(enableImu_ && enableSetImuOrientation_
&& ( 0 > setImuOrientation_
|| 6 < setImuOrientation_)){
- std::cout << "setImuOrientation invalid\n";
+ std::cerr << "setImuOrientation invalid\n";
valid = false;
}
if(enableImu_ && enableVehicleBodyRotation_
&& ( 3 != vehicleBodyRotation_.size()
|| ( 3 != vehicleBodyRotationUncertainty_.size()
&& 0 != vehicleBodyRotationUncertainty_.size()))){
- std::cout << "vehicleBodyRotation invalid\n";
+ std::cerr << "vehicleBodyRotation invalid\n";
valid = false;
}
//ins gear
if(enableImu_ && enableInsOffset_
&& 3 != insOffset_.size()){
- std::cout << "insOffset invalid\n";
+ std::cerr << "insOffset invalid\n";
valid = false;
}
//data
if(false == (enableInsPva_ || enableGpsPos_ || enableGpsVel_ || enableRawImu_)){
- std::cout << "data settings invalid, you need to enable at least one message\n";
+ std::cerr << "data settings invalid, you need to enable at least one message\n";
valid = false;
}
if(enableRawImu_ && 0.02 > dtInsPva_){
if(fixInvalidRateSettings_){
- std::cout << "data rate for InsPva too high; must be 50Hz or less if RawImu is enabled. FIXED!\n";
+ std::cerr << "data rate for InsPva too high; must be 50Hz or less if RawImu is enabled. FIXED!\n";
dtInsPva_ = 0.02;
}else{
- std::cout << "data rate for InsPva too high; must be 50Hz or less if RawImu is enabled\n";
+ std::cerr << "data rate for InsPva too high; must be 50Hz or less if RawImu is enabled\n";
valid = false;
}
}
if( (enableRawImu_ || enableInsPva_) && 0.2 > dtGpsPos_ ){
if(fixInvalidRateSettings_){
- std::cout << "data rate for BestGpsPos too high; must be 5Hz or less if RawImu or InsPva is enabled. FIXED!\n";
+ std::cerr << "data rate for BestGpsPos too high; must be 5Hz or less if RawImu or InsPva is enabled. FIXED!\n";
dtGpsPos_ = 0.2;
}else{
- std::cout << "data rate for BestGpsPos too high; must be 5Hz or less if RawImu or InsPva is enabled\n";
+ std::cerr << "data rate for BestGpsPos too high; must be 5Hz or less if RawImu or InsPva is enabled\n";
valid = false;
}
}
if( (enableRawImu_ || enableInsPva_) && 0.2 > dtGpsVel_ ){
if(fixInvalidRateSettings_){
- std::cout << "data rate for BestGpsVel too high; must be 5Hz or less if RawImu or InsPva is enabled. FIXED!\n";
+ std::cerr << "data rate for BestGpsVel too high; must be 5Hz or less if RawImu or InsPva is enabled. FIXED!\n";
dtGpsVel_ = 0.2;
}else{
- std::cout << "data rate for BestGpsVel too high; must be 5Hz or less if RawImu or InsPva is enabled\n";
+ std::cerr << "data rate for BestGpsVel too high; must be 5Hz or less if RawImu or InsPva is enabled\n";
valid = false;
}
}
@@ -579,11 +665,11 @@
dataRate += 1.0/dtGpsVel_ * 8 * sizeof (gnua::BestGpsVelLogB);
}
if(dataRate > (double)baudRate_){
- std::cout << "The combined data-rate of the messages/message rates you configured excceeds the configured baud rate " << dataRate << " / " << baudRate_ << "\n";
+ std::cerr << "The combined data-rate of the messages/message rates you configured excceeds the configured baud rate " << dataRate << " / " << baudRate_ << "\n";
valid = false;
}else if(dataRate > 0.95 * baudRate_){
- std::cout << "The combined data-rate of the messages/message rates you configured is more than 95\% of the configured baud rate! " << dataRate << " / " << baudRate_ << "\n";
- std::cout << "Consider using a higher baud rate (maximum 230400) or less messages or lower message-rates.";
+ std::cerr << "The combined data-rate of the messages/message rates you configured is more than 95\% of the configured baud rate! " << dataRate << " / " << baudRate_ << "\n";
+ std::cerr << "Consider using a higher baud rate (maximum 230400) or less messages or lower message-rates.";
}
return valid;
@@ -667,13 +753,14 @@
std::string
InsPvaData::toString(){
std::stringstream ss;
+ int defPrecsion = ss.precision();
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
- ss << "gpsWeekNr " << gpsWeekNr << " ";
+ ss << "gpsWeekNr " << std::fixed << std::setprecision(4) << gpsWeekNr << " ";
ss << "secIntoWeek " << secIntoWeek << " ";
- ss << "latitude " << latitude << " ";
+ ss << "latitude " << std::setprecision(9) << latitude << " "; // ~1/10mm resolution (equator)
ss << "longitude " << longitude << " ";
- ss << "height " << height << " ";
+ ss << "height " << std::setprecision(4) << height << " ";
ss << "northVelocity " << northVelocity << " ";
ss << "eastVelocity " << eastVelocity << " ";
ss << "upVelocity " << upVelocity << " ";
@@ -693,9 +780,9 @@
ss << "msIntoWeek " << msIntoWeek << " ";
ss << "solutionStatus " << solutionStatus << " ";
ss << "positionType " << positionType << " ";
- ss << "latitude " << latitude << " ";
+ ss << "latitude " << std::fixed << std::setprecision(9) << latitude << " "; // ~1/10mm resolution (equator)
ss << "longitude " << longitude << " ";
- ss << "heightAMSL " << heightAMSL << " ";
+ ss << "heightAMSL " << std::setprecision(4) << heightAMSL << " ";
ss << "undulation " << undulation << " ";
ss << "datumId " << datumId << " ";
ss << "sigmaLatitude " << sigmaLatitude << " ";
@@ -726,7 +813,7 @@
ss << "msIntoWeek " << msIntoWeek << " ";
ss << "solutionStatus " << solutionStatus << " ";
ss << "positionType " << positionType << " ";
- ss << "latency " << latency << " ";
+ ss << "latency " << std::fixed << std::setprecision(4) << latency << " ";
ss << "diffAge " << diffAge << " ";
ss << "horizontalSpeed " << horizontalSpeed << " ";
ss << "trackOverGround " << trackOverGround << " ";
@@ -738,14 +825,15 @@
std::string
RawImuData::toString(){
std::stringstream ss;
+ //int defPrecsion = ss.precision();
ss << "timeStampSec " << timeStampSec << " ";
ss << "timeStampUSec " << timeStampUSec << " ";
- ss << "gpsWeekNr " << gpsWeekNr << " ";
- ss << "secIntoWeek " << secIntoWeek << " ";
- ss << "zDeltaV " << zDeltaV << " ";
+ ss << "gpsWeekNr " << std::fixed << gpsWeekNr << " ";
+ ss << "secIntoWeek " << std::setprecision(4) << secIntoWeek << " ";
+ ss << "zDeltaV " << std::setprecision(10)<< zDeltaV << " "; // ~1/10 LSB for best IMU
ss << "yDeltaV " << yDeltaV << " ";
ss << "xDeltaV " << xDeltaV << " ";
- ss << "zDeltaAng " << zDeltaAng << " ";
+ ss << "zDeltaAng " << std::setprecision(11) << zDeltaAng << " "; // ~1/10 LSB for best IMU
ss << "yDeltaAng " << yDeltaAng << " ";
ss << "xDeltaAng " << xDeltaAng << " ";
ss << statusToString(statusMessageType, statusMessage);
@@ -1036,6 +1124,7 @@
data->zDeltaV = imuDecoder->accelCnt2MperSec(rawImu.data.zAccelCnt);
data->yDeltaV = -1.0*imuDecoder->accelCnt2MperSec(rawImu.data.yNegativAccelCnt);
data->xDeltaV = imuDecoder->accelCnt2MperSec(rawImu.data.xAccelCnt);
+ //std::cout << "\nCnt " << rawImu.data.xAccelCnt << " decoded " << data->xDeltaV << "\n";
//gyros
data->zDeltaAng = imuDecoder->gyroCnt2Rad(rawImu.data.zGyroCnt);
data->yDeltaAng = -1.0*imuDecoder->gyroCnt2Rad(rawImu.data.yNegativGyroCnt);
Modified: gearbox/trunk/submitted/gbxnovatelacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-04 13:11:12 UTC (rev 262)
+++ gearbox/trunk/submitted/gbxnovatelacfr/driver.h 2008-07-04 13:15:31 UTC (rev 263)
@@ -172,7 +172,7 @@
//!@name INS settings for fast (dynamic) alignment
//! !I'd strongly recommend that you read the manual _very_ closely!
- //! These guys enbale the Span system to do an alignment while moving, they also allow you to mount the IMU in weird ways (e.g. upside down).
+ //! These guys enable the Span system to do an alignment while moving, they also allow you to mount the IMU in weird ways (e.g. upside down).
//! It's worth to accept a fair amount of pain to mount the IMU in the recommended way. Otherwise you'll probably need a good amount of
//! experimentation/calibration to get a parameter-set that works.
//
@@ -420,7 +420,7 @@
public:
//! @name Ctor:
- //! @brief Trys to establish serial communication to the GPS receiver, then configures it
+ //! @brief Tries to establish serial communication to the GPS receiver, then configures it
//
//!@{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-04 13:11:35
|
Revision: 262
http://gearbox.svn.sourceforge.net/gearbox/?rev=262&view=rev
Author: rumataxyz
Date: 2008-07-04 06:11:12 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
corrected type-mistake (unsigned instead of signed)
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-04 13:09:51 UTC (rev 261)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2008-07-04 13:11:12 UTC (rev 262)
@@ -141,13 +141,13 @@
// Y - forward
// Z - up
// X - out the right hand side
- uint32_t zAccelCnt; //16 4
- uint32_t yNegativAccelCnt; //20 4
- uint32_t xAccelCnt; //24 4
- uint32_t zGyroCnt; //28 4
- uint32_t yNegativGyroCnt; //32 4
- uint32_t xGyroCnt; //36 4
- uint32_t crc; //40 4
+ int32_t zAccelCnt; //16 4
+ int32_t yNegativAccelCnt ; //20 4
+ int32_t xAccelCnt; //24 4
+ int32_t zGyroCnt; //28 4
+ int32_t yNegativGyroCnt; //32 4
+ int32_t xGyroCnt; //36 4
+ int32_t crc; //40 4
}RawImuData;
//binary log with full headers
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-04 13:10:15
|
Revision: 261
http://gearbox.svn.sourceforge.net/gearbox/?rev=261&view=rev
Author: rumataxyz
Date: 2008-07-04 06:09:51 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
corrected type-mistake (unsigned instead of signed), uses cerr for error output
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp 2008-07-04 13:08:05 UTC (rev 260)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp 2008-07-04 13:09:51 UTC (rev 261)
@@ -72,7 +72,7 @@
ImuDecoderImarFsas(){
gyroConstant_ = gnua::GyroConstantImarFsas;
accelConstant_ = gnua::AccelConstantImarFsas;
- std::cout << "This driver has _not_ been tested with this IMU!\n";
+ std::cerr << "This driver has _not_ been tested with this IMU!\n";
};
inline bool statusIsGood(const uint32_t imuStatus){
return 0 == ((imuStatus & 0xefec9580));
@@ -133,7 +133,7 @@
ImuDecoderLn200(){
gyroConstant_ = gnua::GyroConstantLn200;
accelConstant_ = gnua::AccelConstantLn200;
- std::cout << "This driver has _not_ been tested with this IMU!\n";
+ std::cerr << "This driver has _not_ been tested with this IMU!\n";
};
inline bool statusIsGood(const uint32_t imuStatus){
return 0 == ((imuStatus & 0xf8000010));
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h 2008-07-04 13:08:05 UTC (rev 260)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h 2008-07-04 13:09:51 UTC (rev 261)
@@ -30,8 +30,8 @@
class ImuDecoder {
public:
virtual ~ImuDecoder(){}
- inline double gyroCnt2Rad(const uint32_t cnt){ return cnt*gyroConstant_; }
- inline double accelCnt2MperSec(const uint32_t cnt){ return cnt*accelConstant_; }
+ inline double gyroCnt2Rad(const int32_t cnt){ return cnt*gyroConstant_; }
+ inline double accelCnt2MperSec(const int32_t cnt){ return cnt*accelConstant_; }
virtual inline bool statusIsGood(const uint32_t imuStatus){return true;} // possibly we need isWarning(), isError() as well. Currently anything not good is treated as error.
virtual std::string statusToString(const uint32_t imuStatus)=0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-07-04 13:08:08
|
Revision: 260
http://gearbox.svn.sourceforge.net/gearbox/?rev=260&view=rev
Author: rumataxyz
Date: 2008-07-04 06:08:05 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
added another utility function, to send commands and test for success
Modified Paths:
--------------
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp
gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp 2008-07-03 08:15:02 UTC (rev 259)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp 2008-07-04 13:08:05 UTC (rev 260)
@@ -44,41 +44,23 @@
serial.flush();
}
catch( SerialException &e ){
- std::cout <<"Caught SerialException: " << e.what()<<"\n";
+ std::cerr <<"Caught SerialException: " << e.what()<<"\n";
return false;
}
catch( std::exception &e ){
- std::cout <<"Caught std::exception: " << e.what()<<"\n";
+ std::cerr <<"Caught std::exception: " << e.what()<<"\n";
return false;
}
catch(...){
- std::cout <<"Caught unknown Exception :-(\n";
+ std::cerr <<"Caught unknown Exception :-(\n";
return false;
}
int successCnt = 0;
+ std::string errorResponse;
for(int i=0; i<numTry; i++){
- // send challenge
- serial.writeString(challenge.c_str());
- usleep(timeOutMsec*1000);
-
- //read response
- int available;
- available = serial.bytesAvailable();
- if(0<available){
- char *buf;
- buf = new char[available+1];
- int read = serial.read(buf, available);
- assert( read != -1 );
-
- //and look for an ACK
- buf[read] = '\0';
- std::string response(buf);
- size_t found = response.find(ack);
- if(std::string::npos != found){
- successCnt++;
- }
- delete []buf;
+ if(true == sendCmdWaitForResponse( challenge, ack, errorResponse, serial, timeOutMsec)){
+ successCnt++;
}
}
std::cout << successCnt << "/"<< numTry << " ";
@@ -90,4 +72,38 @@
return false;
}
}
+
+bool sendCmdWaitForResponse(
+ std::string &challenge,
+ std::string &ack,
+ std::string &errorResponse,
+ gbxserialacfr::Serial& serial,
+ int timeOutMsec){
+ // send challenge
+ serial.writeString(challenge.c_str());
+ usleep(timeOutMsec*1000);
+
+ //read response
+ int available;
+ bool success = false;
+ available = serial.bytesAvailable();
+ if(0<available){
+ char *buf;
+ buf = new char[available+1];
+ int read = serial.read(buf, available);
+ assert( read != -1 );
+
+ //and look for an ACK
+ buf[read] = '\0';
+ std::string response(buf);
+ size_t found = response.find(ack);
+ if(std::string::npos != found){
+ success = true;
+ }else{
+ errorResponse = response;
+ }
+ delete []buf;
+ }
+ return success;
+}
}//namespace
Modified: gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h
===================================================================
--- gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h 2008-07-03 08:15:02 UTC (rev 259)
+++ gearbox/trunk/submitted/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h 2008-07-04 13:08:05 UTC (rev 260)
@@ -19,7 +19,7 @@
// Limitations: amount of data expected before timeOutMsec should be
// reasonably small
//
-// returns 0 for Success; -1 for failure
+// returns true for Success; false for failure
namespace gbxnovatelutilacfr{
bool testConnectivity(
std::string &challenge,
@@ -29,4 +29,19 @@
int numTry,
int successThresh,
int baudrate);
+
+// send a [challenge] (command ...) to
+// which the device will answer with a unique [ack] in [timeOutMsec] milliseconds.
+//
+// Limitations: amount of data expected before timeOutMsec should be
+// reasonably small
+//
+// returns true for Success (i.e. ack received in time),
+// false for failure, in case of failure errorResponse contains the reply from the receiver
+bool sendCmdWaitForResponse(
+ std::string &challenge,
+ std::string &ack,
+ std::string &errorResponse,
+ gbxserialacfr::Serial& serial,
+ int timeOutMsec);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-03 08:14:59
|
Revision: 259
http://gearbox.svn.sourceforge.net/gearbox/?rev=259&view=rev
Author: gbiggs
Date: 2008-07-03 01:15:02 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Header file in the wrong #if block
Modified Paths:
--------------
gearbox/trunk/submitted/flexiport/logfile.cpp
Modified: gearbox/trunk/submitted/flexiport/logfile.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-03 07:52:47 UTC (rev 258)
+++ gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-03 08:15:02 UTC (rev 259)
@@ -28,10 +28,11 @@
#include "flexiport.h"
#include "logfile.h"
-#if !defined (WIN32)
+#if defined (WIN32)
+ #include <windows.h> // For Sleep()
+#else
#include <arpa/inet.h>
#include <unistd.h>
- #include <windows.h> // For Sleep()
#endif
#include <sys/types.h>
#include <sys/stat.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-07-03 07:52:44
|
Revision: 258
http://gearbox.svn.sourceforge.net/gearbox/?rev=258&view=rev
Author: gbiggs
Date: 2008-07-03 00:52:47 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
LogWriterPort and LogWriterPort now work on Windows
Modified Paths:
--------------
gearbox/trunk/submitted/flexiport/logfile.cpp
gearbox/trunk/submitted/flexiport/logfile.h
Modified: gearbox/trunk/submitted/flexiport/logfile.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-03 05:58:24 UTC (rev 257)
+++ gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-03 07:52:47 UTC (rev 258)
@@ -28,25 +28,24 @@
#include "flexiport.h"
#include "logfile.h"
-#include <cstdlib>
-#include <cstring>
-#include <arpa/inet.h>
+#if !defined (WIN32)
+ #include <arpa/inet.h>
+ #include <unistd.h>
+ #include <windows.h> // For Sleep()
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
-#include <unistd.h>
+#include <cstdlib>
+#include <cstring>
#include <sstream>
#include <iostream>
using namespace std;
#if defined (WIN32)
#define __func__ __FUNCTION__
- #define timercmp(a, b, CMP) \
- (((a)->tv_sec == (b)->tv_sec) ? \
- ((a)->tv_usec CMP (b)->tv_usec) : \
- ((a)->tv_sec CMP (b)->tv_sec))
#define timeradd(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
@@ -66,7 +65,6 @@
(result)->tv_usec += 1000000; \
} \
} while (0)
- #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#endif
namespace flexiport
@@ -137,14 +135,14 @@
if (_read)
{
- if ((_readFile = fopen ((fileName + "r").c_str (), "r")) == NULL)
+ if ((_readFile = fopen ((fileName + "r").c_str (), "rb")) == NULL)
{
stringstream ss;
ss << "LogFile::" << __func__ << "() fopen(_readFile) error: (" << ErrNo () << ") " <<
StrError (ErrNo ());
throw PortException (ss.str ());
}
- if ((_writeFile = fopen ((fileName + "w").c_str (), "r")) == NULL)
+ if ((_writeFile = fopen ((fileName + "w").c_str (), "rb")) == NULL)
{
stringstream ss;
ss << "LogFile::" << __func__ << "() fopen(_writeFile) error: (" << ErrNo () << ") " <<
@@ -157,14 +155,14 @@
}
else
{
- if ((_readFile = fopen ((fileName + "r").c_str (), "w")) == NULL)
+ if ((_readFile = fopen ((fileName + "r").c_str (), "wb")) == NULL)
{
stringstream ss;
ss << "LogFile::" << __func__ << "() fopen(_readFile) error: (" << ErrNo () << ") " <<
StrError (ErrNo ());
throw PortException (ss.str ());
}
- if ((_writeFile = fopen ((fileName + "w").c_str (), "w")) == NULL)
+ if ((_writeFile = fopen ((fileName + "w").c_str (), "wb")) == NULL)
{
stringstream ss;
ss << "LogFile::" << __func__ << "() fopen(_writeFile) error: (" << ErrNo () << ") " <<
@@ -401,7 +399,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec << "s " <<
diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
return totalRead;
}
@@ -438,7 +445,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec << "s " <<
diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
return totalRead;
}
@@ -516,7 +532,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec << "s " <<
diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
return size;
}
@@ -553,7 +578,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec << "s " <<
diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
return size;
}
@@ -683,7 +717,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec << "s " <<
diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
}
else if (timeout->_sec > 0 || timeout->_usec > 0)
@@ -719,7 +762,16 @@
cerr << "LogFile::" << __func__ << "() Sleeping for " << diff2.tv_sec <<
"s " << diff2.tv_nsec << "ns." << endl;
}
+#if defined (WIN32)
+ DWORD sleepTime = 0;
+ if (diff2.tv_sec > 0)
+ sleepTime += diff2.tv_sec * 1000;
+ if (diff2.tv_nsec > 0)
+ sleepTime += diff2.tv_nsec / 1000000;
+ Sleep (sleepTime);
+#else
nanosleep (&diff2, NULL);
+#endif
}
}
// else no data available
@@ -1039,7 +1091,7 @@
size = ntohl (tempSize);
// Rewind the file back to the beginning of the chunk header
- if (fseek (file, -1 * CHUNK_HEADER_SIZE, SEEK_CUR) < 0)
+ if (fseek (file, -1 * static_cast<int> (CHUNK_HEADER_SIZE), SEEK_CUR) < 0)
{
stringstream ss;
ss << "LogFile::" << __func__ << "() fseek() error: (" << ErrNo () << ") " <<
@@ -1189,7 +1241,7 @@
}
// Read as much as can fit into data
- ReadFromFile (file, data, sizeof (*reinterpret_cast<uint8_t*> (data)) * count);
+ ReadFromFile (file, data, sizeof (uint8_t) * count);
if (_debug >= 3)
{
cerr << "LogFile::" << __func__ << "() Read " <<
@@ -1209,7 +1261,7 @@
else
{
// It'll fit so read straight into data
- ReadFromFile (file, data, sizeof (*reinterpret_cast<uint8_t*> (data)) * size);
+ ReadFromFile (file, data, sizeof (uint8_t) * size);
if (_debug >= 3)
{
cerr << "LogFile::" << __func__ << "() Read " <<
Modified: gearbox/trunk/submitted/flexiport/logfile.h
===================================================================
--- gearbox/trunk/submitted/flexiport/logfile.h 2008-07-03 05:58:24 UTC (rev 257)
+++ gearbox/trunk/submitted/flexiport/logfile.h 2008-07-03 07:52:47 UTC (rev 258)
@@ -37,6 +37,7 @@
#include <vector>
#include "timeout.h"
+#include "flexiport_types.h"
namespace flexiport
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|