Hello,
Sorry for the long delay. I have tested your code and world file.
Everything worked for me. I'm using player-2.0 and CVS gazebo. I made
a couple changes to the files, which I have included below. Let me
know if they work for you.
*** Gazebo World File ***
<model:ObserverCam>
<id>userCam0</id>
<xyz>-0.389 -0.898 1.046</xyz>
<rpy>0 37 31</rpy>
<imageSize>320 200</imageSize>
<updateRate>10</updateRate>
<displayRays>false</displayRays>
<displayAxes>false</displayAxes>
<displayCoM>false</displayCoM>
<displayTextures>true</displayTextures>
</model:ObserverCam>
<model:LightSource>
<id>light1</id>
<xyz>0.000 0.000 5.000</xyz>
<ambientColor>0.2, 0.2, 0.2</ambientColor>
<diffuseColor>0.8, 0.8, 0.8</diffuseColor>
<specularColor>0.2, 0.2, 0.2</specularColor>
<attenuation>1.0, 0.0, 0.00</attenuation>
</model:LightSource>
<model:GroundPlane>
<id>ground1</id>
<color>0.5 0.5 0.5</color>
<textureFile>grid.ppm</textureFile>
</model:GroundPlane>
<model:Pioneer2DX>
<id>robot1</id>
<xyz>0 0 0.200</xyz>
<model:SonyVID30>
<id>camera1</id>
<xyz>0 0 0.0</xyz>
</model:SonyVID30>
</model:Pioneer2DX>
<model:SimpleSolid>
<color>0 1 0 </color>
<xyz> 3 0 .05 </xyz>
<shape>box</shape>
</model:SimpleSolid>
*** Color File **
[Colors]
(255, 0, 0) 0.000000 10 Red
( 0,255, 0) 0.000000 10 Green
( 0, 0,255) 0.000000 10 Blue
[Thresholds]
( 25:164, 80:120,150:240)
( 20:220, 50:120, 40:115)
( 15:190,145:255, 40:120)
*** Player config file ***
driver
(
name "gazebo"
provides ["simulation:0"]
plugin "libgazeboplugin"
server_id "default"
)
driver
(
name "gazebo"
provides ["camera:0"]
gz_id "camera1"
)
driver
(
name "cameracompress"
provides ["camera:1"]
requires ["camera:0"]
)
driver
(
name "cmvision"
provides ["blobfinder:0"]
requires ["camera:0"]
colorfile "colors.txt"
)
*** Player Client Code ***
#include <stdio.h>
#include <libplayerc/playerc.h>
int main()
{
playerc_client_t *client;
playerc_blobfinder_t *blobfinder;
playerc_camera_t *camera;
// Create a client object and connect to the server; the server must
// be running on "localhost" at port 6665
client = playerc_client_create(NULL, "localhost", 6665);
if (playerc_client_connect(client) != 0)
{
fprintf(stderr, "error: %s\n", playerc_error_str());
return -1;
}
//Create a camera proxy
camera = playerc_camera_create(client,0);
if (playerc_camera_subscribe(camera, 1) !=0)
{
fprintf(stderr, "error: %s\n", playerc_error_str());
return -1;
}
//Create a Blobfinder proxy
blobfinder = playerc_blobfinder_create(client, 0);
if (playerc_blobfinder_subscribe(blobfinder, PLAYER_OPEN_MODE) != 0)
{
fprintf(stderr,"error: %s\n", playerc_error_str());
return -1;
}
unsigned int red, green, blue;
while(true)
{
// Read data from the server and display current robot position
playerc_client_read(client);
if ( (blobfinder->blobs_count) > 0)
{
red = (blobfinder->blobs[0].color&0xFF0000) >> 16;
green = (blobfinder->blobs[0].color&0xFF00) >> 8;
blue = blobfinder->blobs[0].color&0xFF;
printf("blob count is %d\n", blobfinder->blobs_count);
printf("blob color is RGB[%d, %d, %d]\n", red,green,blue);
printf("blob ID is %x\n", blobfinder->blobs[0].id);
}
else
printf("blob count is 0 \n");
}
playerc_camera_unsubscribe(camera);
playerc_client_disconnect(client);
playerc_client_destroy(client);
return 0;
}
-nate
On 4/8/06, Valentino <[EMAIL PROTECTED]> wrote:
> Thanks for answer
> Blob count it's ok but there are problems for blob color and blob id
> (they are always zero)
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo