Revision: 8184
http://playerstage.svn.sourceforge.net/playerstage/?rev=8184&view=rev
Author: gbiggs
Date: 2009-08-07 08:48:58 +0000 (Fri, 07 Aug 2009)
Log Message:
-----------
Reworked checksum-ignoring
Modified Paths:
--------------
code/player/trunk/server/drivers/mixed/p2os/p2os.cc
code/player/trunk/server/drivers/mixed/p2os/p2os.h
code/player/trunk/server/drivers/mixed/p2os/packet.cc
code/player/trunk/server/drivers/mixed/p2os/packet.h
Modified: code/player/trunk/server/drivers/mixed/p2os/p2os.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/p2os/p2os.cc 2009-08-07 08:14:17 UTC
(rev 8183)
+++ code/player/trunk/server/drivers/mixed/p2os/p2os.cc 2009-08-07 08:48:58 UTC
(rev 8184)
@@ -292,9 +292,9 @@
- armgrip_innersize (3 floats, metres)
- Default: (0.054, 0.025, 1.0)
- Size of the inside of the arm's gripper (largest object it can hold)
-- oldschool (integer)
- - Default: 0 (no effect)
- - If set to 1, checksum will be compared the same way as in older versions
of this driver
+- ignore_checksum (boolean)
+ - Default: False (no effect)
+ - If set to True, the checksum will be ignored
@par Example
@@ -560,7 +560,7 @@
::initialize_robot_params();
// Read config file options
- this->oldschool = cf->ReadInt(section, "oldschool", 0);
+ this->ignore_checksum = cf->ReadBool(section, "ignore_checksum", false);
this->bumpstall = cf->ReadInt(section,"bumpstall",-1);
this->pulse = cf->ReadFloat(section,"pulse",-1);
this->rot_kp = cf->ReadInt(section, "rot_kp", -1);
@@ -998,7 +998,7 @@
}
usleep(P2OS_CYCLETIME_USEC);
- if(receivedpacket.Receive(this->psos_fd, this->oldschool))
+ if(receivedpacket.Receive(this->psos_fd, this->ignore_checksum))
{
if((psos_state == NO_SYNC) && (num_sync_attempts >= 0))
{
@@ -1728,7 +1728,7 @@
/* receive a packet */
pthread_testcancel();
- if(packet.Receive(this->psos_fd, this->oldschool))
+ if(packet.Receive(this->psos_fd, this->ignore_checksum))
{
puts("RunPsosThread(): Receive errored");
pthread_exit(NULL);
Modified: code/player/trunk/server/drivers/mixed/p2os/p2os.h
===================================================================
--- code/player/trunk/server/drivers/mixed/p2os/p2os.h 2009-08-07 08:14:17 UTC
(rev 8183)
+++ code/player/trunk/server/drivers/mixed/p2os/p2os.h 2009-08-07 08:48:58 UTC
(rev 8184)
@@ -225,8 +225,6 @@
class P2OS : public ThreadedDriver
{
private:
- int oldschool;
-
player_p2os_data_t p2os_data;
player_devaddr_t position_id;
@@ -349,7 +347,6 @@
const char* psos_tcp_host; // hostname to use if using TCP
int psos_tcp_port; // remote port to use if using TCP
-
struct timeval lastblob_tv;
// Max motor speeds (mm/sec,deg/sec)
@@ -366,6 +363,7 @@
int radio_modemp; // are we using a radio modem?
int joystickp; // are we using a joystick?
int bumpstall; // should we change the bumper-stall behavior?
+ bool ignore_checksum;
// PTZ Camera Stuff
player_ptz_data_t ptz_data;
Modified: code/player/trunk/server/drivers/mixed/p2os/packet.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/p2os/packet.cc 2009-08-07
08:14:17 UTC (rev 8183)
+++ code/player/trunk/server/drivers/mixed/p2os/packet.cc 2009-08-07
08:48:58 UTC (rev 8184)
@@ -55,15 +55,15 @@
}
-bool P2OSPacket::Check(bool oldschool) {
+bool P2OSPacket::Check( bool ignore_checksum ) {
short chksum;
chksum = CalcChkSum();
- if (oldschool)
+ if ( ignore_checksum )
{
- if ( (chksum == packet[size-2] << 8) | packet[size-1])
- return(true);
- } else
+ return(true);
+ }
+ else
{
if ( chksum == (packet[size-2] << 8 | packet[size-1]))
return(true);
@@ -90,7 +90,7 @@
return(c);
}
-int P2OSPacket::Receive( int fd, bool oldschool )
+int P2OSPacket::Receive( int fd, bool ignore_checksum )
{
unsigned char prefix[3];
//int skipped=0;
@@ -137,7 +137,7 @@
return(1);
}
}
- } while (!Check(oldschool));
+ } while (!Check(ignore_checksum));
return(0);
}
Modified: code/player/trunk/server/drivers/mixed/p2os/packet.h
===================================================================
--- code/player/trunk/server/drivers/mixed/p2os/packet.h 2009-08-07
08:14:17 UTC (rev 8183)
+++ code/player/trunk/server/drivers/mixed/p2os/packet.h 2009-08-07
08:48:58 UTC (rev 8184)
@@ -50,9 +50,9 @@
void PrintHex();
int Build( unsigned char *data, unsigned char datasize );
int Send( int fd );
- int Receive( int fd, bool oldschool );
- bool Check(bool oldschool = false);
-
+ int Receive( int fd, bool ignore_checksum );
+ bool Check( bool ignore_checksum = false );
+
bool operator!= ( P2OSPacket p ) {
if ( size != p.size) return(true);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit