Update of /cvsroot/playerstage/code/player/server/drivers/shell
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23248/server/drivers/shell
Modified Files:
Tag: release-2-0-patches
readlog.cc writelog.cc
Log Message:
applied patch 1771457
Index: writelog.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/shell/writelog.cc,v
retrieving revision 1.71.2.3
retrieving revision 1.71.2.4
diff -C2 -d -r1.71.2.3 -r1.71.2.4
*** writelog.cc 18 Oct 2007 21:14:11 -0000 1.71.2.3
--- writelog.cc 18 Oct 2007 21:18:18 -0000 1.71.2.4
***************
*** 70,73 ****
--- 70,74 ----
The writelog driver can will log data from the following interfaces:
+ - @ref interface_aio
- @ref interface_laser
- @ref interface_sonar
***************
*** 202,205 ****
--- 203,209 ----
player_msghdr_t* hdr, void *data);
+ // Write aio data to file
+ private: int WriteAio(player_msghdr_t* hdr, void *data);
+
// Write laser data to file
private: int WriteLaser(player_msghdr_t* hdr, void *data);
***************
*** 582,587 ****
}
! void
! WriteLog::CloseFile()
{
if(this->file)
--- 586,590 ----
}
! void WriteLog::CloseFile()
{
if(this->file)
***************
*** 767,770 ****
--- 770,776 ----
switch (iface.interf)
{
+ case PLAYER_AIO_CODE:
+ retval = this->WriteAio(hdr, data);
+ break;
case PLAYER_LASER_CODE:
retval = this->WriteLaser(hdr, data);
***************
*** 840,843 ****
--- 846,890 ----
/** @ingroup tutorial_datalog
+ * @defgroup player_driver_writelog_position aio format
+
+ @brief position2d log format
+
+ The following type:subtype aio messages can be logged:
+ - 1:1 (PLAYER_POSITION2D_DATA_STATE) Odometry information. The format is:
+ - voltages_count (unint32_t): Number of valid samples to follow
+ - list of voltages; for each voltage
+ - voltage (float): in volts
+ #endif
+ */
+ int
+ WriteLog::WriteAio(player_msghdr_t* hdr, void *data)
+ {
+ // Check the type
+ switch(hdr->type)
+ {
+ case PLAYER_MSGTYPE_DATA:
+ // Check the subtype
+ switch(hdr->subtype)
+ {
+ case PLAYER_AIO_DATA_STATE:
+ {
+ player_aio_data_t* adata = (player_aio_data_t*)data;
+ fprintf(this->file, "%04d ", adata->voltages_count);
+
+ for (unsigned int i = 0; i < adata->voltages_count; i++)
+ fprintf(this->file, "%10.4f ", adata->voltages[i]);
+ return(0);
+ }
+ default:
+ return(-1);
+ }
+
+ default:
+ return(-1);
+ }
+ }
+
+
+ /** @ingroup tutorial_datalog
* @defgroup player_driver_writelog_laser laser format
Index: readlog.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/shell/readlog.cc,v
retrieving revision 1.40.2.1
retrieving revision 1.40.2.2
diff -C2 -d -r1.40.2.1 -r1.40.2.2
*** readlog.cc 22 Sep 2006 23:58:35 -0000 1.40.2.1
--- readlog.cc 18 Oct 2007 21:18:18 -0000 1.40.2.2
***************
*** 57,60 ****
--- 57,61 ----
The readlog driver can provide the following device interfaces.
+ - @ref interface_aio
- @ref interface_laser
- @ref interface_position2d
***************
*** 243,246 ****
--- 244,253 ----
#endif
+ // Parse aio data
+ private: int ParseAio(player_devaddr_t id,
+ unsigned short type, unsigned short subtype,
+ int linenum,
+ int token_count, char **tokens, double time);
+
// Parse laser data
private: int ParseLaser(player_devaddr_t id,
***************
*** 1087,1091 ****
token_count, tokens, time);
#endif
! if (id.interf == PLAYER_LASER_CODE)
return this->ParseLaser(id, type, subtype, linenum,
token_count, tokens, time);
--- 1094,1101 ----
token_count, tokens, time);
#endif
! if (id.interf == PLAYER_AIO_CODE)
! return this->ParseAio(id, type, subtype, linenum,
! token_count, tokens, time);
! else if (id.interf == PLAYER_LASER_CODE)
return this->ParseLaser(id, type, subtype, linenum,
token_count, tokens, time);
***************
*** 1314,1317 ****
--- 1324,1383 ----
////////////////////////////////////////////////////////////////////////////
+ // Parse aio data
+ int ReadLog::ParseAio(player_devaddr_t id,
+ unsigned short type, unsigned short subtype,
+ int linenum,
+ int token_count, char **tokens, double time)
+ {
+ int i, count;
+
+ switch(type)
+ {
+ case PLAYER_MSGTYPE_DATA:
+ switch(subtype)
+ {
+ case PLAYER_AIO_DATA_STATE:
+ {
+ player_aio_data_t data;
+
+ if (token_count < 8)
+ {
+ PLAYER_ERROR2("incomplete line at %s:%d",
+ this->filename, linenum);
+ return -1;
+ }
+
+ data.voltages_count = atoi(tokens[7]);
+
+ count = 0;
+ for (i = 8; i < token_count; i++)
+ {
+ data.voltages[count] = atof(tokens[i]);
+ count++;
+ }
+
+ if (count != (int)data.voltages_count)
+ {
+ PLAYER_ERROR2("voltage count mismatch at %s:%d",
+ this->filename, linenum);
+ return -1;
+ }
+ this->Publish(id, NULL, type, subtype,
+ (void*)&data, sizeof(data), &time);
+ return(0);
+ }
+
+ default:
+ PLAYER_ERROR1("unknown aio data subtype %d\n", subtype);
+ return(-1);
+ }
+ break;
+
+ default:
+ PLAYER_ERROR1("unknown aio msg type %d\n", type);
+ return(-1);
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
// Parse laser data
int ReadLog::ParseLaser(player_devaddr_t id,
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit