Revision: 9062
http://playerstage.svn.sourceforge.net/playerstage/?rev=9062&view=rev
Author: jpgr87
Date: 2011-07-16 23:57:00 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Added vmapfile format to vmapfile driver description, cleaned up indentation in
gridmap.h, addded a couple of comments to the TimedRequest() function in
libplayercore
Modified Paths:
--------------
code/player/trunk/libplayercore/device.cc
code/player/trunk/server/drivers/map/gridmap.h
code/player/trunk/server/drivers/map/vmapfile.cc
Modified: code/player/trunk/libplayercore/device.cc
===================================================================
--- code/player/trunk/libplayercore/device.cc 2011-07-07 00:01:18 UTC (rev
9061)
+++ code/player/trunk/libplayercore/device.cc 2011-07-16 23:57:00 UTC (rev
9062)
@@ -333,9 +333,11 @@
dri->Update();
}
+ // Wait until the message arrives in the response queue
if((msg = resp_queue->Pop()))
break;
+ // Or until we reach our timeout
if (timeout > 0)
{
GlobalTime->GetTimeDouble(&curr_time);
Modified: code/player/trunk/server/drivers/map/gridmap.h
===================================================================
--- code/player/trunk/server/drivers/map/gridmap.h 2011-07-07 00:01:18 UTC
(rev 9061)
+++ code/player/trunk/server/drivers/map/gridmap.h 2011-07-16 23:57:00 UTC
(rev 9062)
@@ -50,58 +50,59 @@
class Sonar
{
public:
-double px,py,th;
-double sonar_treshold; //default to 4.5
-double sonar_aperture; // 30 degrees
-double sensor_model(double x,double y,double r);
+ double px,py,th;
+ double sonar_treshold; //default to 4.5
+ double sonar_aperture; // 30 degrees
+ double sensor_model(double x,double y,double r);
+
Sonar()
{
- sonar_treshold=4.5;
- sonar_aperture=0.5235987;
+ sonar_treshold=4.5;
+ sonar_aperture=0.5235987;
}
};
class MAP_POINT
{
public:
-int x;
-int y; // coordinates on map
+ int x;
+ int y; // coordinates on map
-MAP_POINT(int x1,int y1)
-{
- x=x1;
- y=y1;
-}
+ MAP_POINT(int x1,int y1)
+ {
+ x=x1;
+ y=y1;
+ }
- bool operator<(const MAP_POINT &b) const {
- if (x < b.x) return(1);
- else if (x == b.x) return(y < b.y);
- else return(0);
+ bool operator<(const MAP_POINT &b) const
+ {
+ if (x < b.x)
+ return(1);
+ else if (x == b.x)
+ return(y < b.y);
+ else
+ return(0);
}
-
};
class MAP_POSE
{
public:
-double px;
-double py;
-double pa; // where the robot was when this point was added
-double P; // occupancy probability
+ double px;
+ double py;
+ double pa; // where the robot was when this point was added
+ double P; // occupancy probability
- MAP_POSE()
- {pa=px=py=P=0;}
+ MAP_POSE()
+ {pa=px=py=P=0;}
-MAP_POSE(double px1,
- double py1,
- double pa1,
- double P1) {
- pa=pa1;
- px=px1;
- py=py1;
- P=P1;
- }
-
+ MAP_POSE(double px1, double py1, double pa1, double P1)
+ {
+ pa=pa1;
+ px=px1;
+ py=py1;
+ P=P1;
+ }
};
@@ -111,21 +112,23 @@
/// the map is defined as x,y -> pose (px,py,pa,P)
///
public:
-int width;
-int height;
-int startx;
-int starty;
-float scale; //default to 0.028
-float sonar_treshold; //default to 4.5
-Map();
-Map(int width,
+ int width;
+ int height;
+ int startx;
+ int starty;
+ float scale; //default to 0.028
+ float sonar_treshold; //default to 4.5
+
+ Map();
+ Map(int width,
int height,
int startx,
int starty,
int scale,
int sonar_treshold);
-~Map();
-player_map_data_t ToPlayer();
+ ~Map();
+
+ player_map_data_t ToPlayer();
};
Map::~Map() {
@@ -133,13 +136,13 @@
Map::Map()
{
-//some default values (not always good)
-width=800;
-height=800;
-startx=0;
-starty=0;
-scale=0.028f;
-sonar_treshold=4.5;
+ //some default values (not always good)
+ width=800;
+ height=800;
+ startx=0;
+ starty=0;
+ scale=0.028f;
+ sonar_treshold=4.5;
}
Map::Map(int width,
@@ -149,15 +152,11 @@
int scale,
int sonar_treshold)
{
-std::cout<< "not implemented yet" << std::endl;
+ std::cout<< "not implemented yet" << std::endl;
}
-
-
double Sonar::sensor_model(double x,double y,double r)
{
-return(
-exp((-pow(x,2)/r)-(pow(y,2)/sonar_aperture))/((double)1.7)
-);
-
+ return(exp((-pow(x,2)/r)-(pow(y,2)/sonar_aperture))/((double)1.7));
}
+
Modified: code/player/trunk/server/drivers/map/vmapfile.cc
===================================================================
--- code/player/trunk/server/drivers/map/vmapfile.cc 2011-07-07 00:01:18 UTC
(rev 9061)
+++ code/player/trunk/server/drivers/map/vmapfile.cc 2011-07-16 23:57:00 UTC
(rev 9062)
@@ -32,8 +32,14 @@
The vmapfile driver reads a vector map from a text file and
provides the map to others via the @ref interface_map interface.
-The format of the text file is...
+The text file should contain lines in the format
+x1 y1 x2 y2
+
+where (x1,y1) and (x2,y2) are the cartesian coordinates representing
+the endpoints of each vector. The endpoints are read in as floating
+point numbers, so they can have decimal values.
+
@par Compile-time dependencies
- None
@@ -283,6 +289,9 @@
player_msghdr * hdr,
void * data)
{
+ HANDLE_CAPABILITY_REQUEST(device_addr, resp_queue, hdr, data,
PLAYER_MSGTYPE_REQ, PLAYER_CAPABILITIES_REQ);
+ HANDLE_CAPABILITY_REQUEST(device_addr, resp_queue, hdr, data,
PLAYER_MSGTYPE_REQ, PLAYER_MAP_REQ_GET_VECTOR);
+
// Is it a request for the map?
if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
PLAYER_MAP_REQ_GET_VECTOR,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit