61 player_fiducial_data_t pdata;
62 memset( &pdata, 0,
sizeof(pdata) );
64 std::vector<ModelFiducial::Fiducial>& fids =
67 pdata.fiducials_count = fids.size();
69 if( pdata.fiducials_count > 0 )
71 pdata.fiducials =
new player_fiducial_item_t[pdata.fiducials_count];
73 for(
unsigned int i=0; i<pdata.fiducials_count; i++ )
75 pdata.fiducials[i].id = fids[i].id;
78 double xpos = fids[i].range * cos(fids[i].bearing);
79 double ypos = fids[i].range * sin(fids[i].bearing);
81 pdata.fiducials[i].pose.px = xpos;
82 pdata.fiducials[i].pose.py = ypos;
83 pdata.fiducials[i].pose.pz = 0.0;
84 pdata.fiducials[i].pose.proll = 0.0;
85 pdata.fiducials[i].pose.ppitch = 0.0;
86 pdata.fiducials[i].pose.pyaw = fids[i].geom.a;
93 PLAYER_FIDUCIAL_DATA_SCAN,
94 &pdata,
sizeof(pdata), NULL);
96 if ( pdata.fiducials )
97 delete [] pdata.fiducials;
101 player_msghdr_t* hdr,
107 if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
108 PLAYER_FIDUCIAL_REQ_GET_GEOM,
115 player_laser_geom_t pgeom;
116 pgeom.pose.px = pose.
x;
117 pgeom.pose.py = pose.
y;
118 pgeom.pose.pz = pose.
z;
119 pgeom.pose.proll = 0.0;
120 pgeom.pose.ppitch = 0.0;
121 pgeom.pose.pyaw = pose.
a;
122 pgeom.size.sl = geom.
size.
x;
123 pgeom.size.sw = geom.
size.
y;
126 PLAYER_MSGTYPE_RESP_ACK,
127 PLAYER_FIDUCIAL_REQ_GET_GEOM,
128 (
void*)&pgeom,
sizeof(pgeom), NULL);
131 else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
132 PLAYER_FIDUCIAL_REQ_SET_ID,
135 if( hdr->size ==
sizeof(player_fiducial_id_t) )
138 player_fiducial_id_t* incoming = (player_fiducial_id_t*)data;
141 int id = incoming->id;
145 player_fiducial_id_t pid;
150 PLAYER_MSGTYPE_RESP_ACK,
151 PLAYER_FIDUCIAL_REQ_SET_ID,
152 (
void*)&pid,
sizeof(pid) );
156 PRINT_ERR2(
"Incorrect packet size setting fiducial ID (%d/%d)",
157 (
int)hdr->size, (
int)
sizeof(player_fiducial_id_t) );
161 else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
162 PLAYER_FIDUCIAL_REQ_GET_ID,
167 player_fiducial_id_t pid;
172 PLAYER_MSGTYPE_RESP_ACK,
173 PLAYER_FIDUCIAL_REQ_GET_ID,
174 (
void*)&pid,
sizeof(pid) );
226 PRINT_WARN2(
"fiducial doesn't support msg with type/subtype %d/%d",
227 hdr->type, hdr->subtype);
The Stage library uses its own namespace.
virtual void Publish(void)
#define PRINT_WARN2(m, a, b)
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr_t *hdr, void *data)
meters_t z
location in 3 axes
void SetFiducialReturn(int fid)
int GetFiducialReturn() const
#define PRINT_ERR2(m, a, b)
radians_t a
rotation about the z axis.
InterfaceFiducial(player_devaddr_t addr, StgDriver *driver, ConfigFile *cf, int section)