Re: getting camera data from robot

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: getting camera data from robot

Nicola Bellotto
On Wednesday 05 Oct 2005 16:14, you wrote:
> Hi,
>
> I saw your post to the sourceforge.net player-stage
> mailing list regarding getting data from a camera
> using the CameraProxy object.

Here's a simple program that uses Player to get images from a Logitech
QuickCam Pro 4000 and shows them using OpenCV. There's also a basic
configuration file for Player. Hope it helps.
Cheers
Nicola

--
------------------------------------------
Nicola Bellotto
University of Essex
Department of Computer Science
Wivenhoe Park
Colchester CO4 3SQ
United Kingdom

Room: 1N1.2.8
Tel. +44 (0)1206 874094
E-Mail: [hidden email]
URL: http://privatewww.essex.ac.uk/~nbello
------------------------------------------

webcam.cpp (2K) Download Attachment
webcam.cfg (144 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: getting camera data from robot

Amanda Whitbrook
>Here's a simple program that uses Player to get
>images from a Logitech
>QuickCam Pro 4000 and shows them using OpenCV.
>There's also a basic
>configuration file for Player. Hope it helps.
>Cheers
>Nicola

Hi,

In trying to compile the program I get some errors as
below:

webcam.cpp:38: error: 'class CameraProxy' has no
member named 'fresh'

When I remove reference to cp.fresh I get these
errors:

/tmp/cciwwHrk.o(.text+0xa7): In function `main':
: undefined reference to `cvCreateImage'
/tmp/cciwwHrk.o(.text+0xc1): In function `main':
: undefined reference to `cvNamedWindow'
/tmp/cciwwHrk.o(.text+0x257): In function `main':
: undefined reference to `cvShowImage'
/tmp/cciwwHrk.o(.text+0x263): In function `main':
: undefined reference to `cvWaitKey'
collect2: ld returned 1 exit status

Amanda



               
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users
Reply | Threaded
Open this post in threaded view
|

Re: getting camera data from robot

Amanda Whitbrook
In reply to this post by Nicola Bellotto
Hello again,

>If you need simulated images, Gazebo is the choice
>for you.

Thanks for the tip - I'm now using Gazebo and trying
to use the demo pan-tilt-zoom program with CameraProxy
added in but I'm having some problems: This is my
output:

#Ptz(8:0) - a
#pan    tilt    zoom    panspeed        tiltspeed
0.925   0.000   1.030   -1.274  0.000
#Camera(40:0) - e
Height(0 px), Width(0 px), Depth(0 bit), ImageSize(0
bytes)

Obviously I'm getting some kind of camera error and
hence no camera data. My world file, config file and
program are as follows:

config
------

driver
(
  name "gz_sim"
  provides ["simulation:0"]
  alwayson 1
)

driver
(
  name "gz_ptz"
  provides ["ptz:0"]
  gz_id "camera1"
)

driver
(
  name "gz_position"
  provides ["position:0"]
  gz_id "robot1"
)

driver
(
  name "gz_laser"
  provides ["laser:0"]
  gz_id "laser1"
)

driver
(
  name "gz_camera"
  provides ["camera:0"]
  gz_id "camera1"
)

driver
(
  name "gz_gripper"
  provides ["gripper:0"]
  gz_id "gripper1"
)
---------

world
---------

<?xml version="1.0"?>
<gz:world
xmlns:gz="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"
xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"
xmlns:window="http://playerstage.sourceforge.net/gazebo/xmlschema/#window"
xmlns:params="http://playerstage.sourceforge.net/gazebo/xmlschema/#params">

  <model:ObserverCam>
    <id>usercam1</id>
    <xyz>-0.588 -1.430 1.756</xyz>
    <rpy>0 41 46</rpy>
    <imageSize>640 480</imageSize>
    <displayRays>true</displayRays>
  </model:ObserverCam>

  <model:LightSource>
    <id>light1</id>
    <xyz>-1.000 -1.000 10.000</xyz>
  </model:LightSource>

  <model:GroundPlane>
    <id>ground1</id>
    <texture2D>grid.ppm</texture2D>
  </model:GroundPlane>

  <model:Pioneer2DX>
    <id>robot1</id>
    <xyz>-0.350 0.000 0.234</xyz>
    <rpy>-0 0 0</rpy>

    <model:SickLMS200>
      <id>laser1</id>
      <xyz>0.0 0 0</xyz>
    </model:SickLMS200>
   
    <model:Pioneer2Gripper>
      <id>gripper1</id>
      <xyz>0.14003 0 -0.0975</xyz>
    </model:Pioneer2Gripper>

    <model:SonyVID30>
        <id>camera1</id>
        <xyz>0 0 0.20</xyz>
        <rpy>0 0 0</rpy>
        <updateRate>.3</updateRate>
    </model:SonyVID30>
 
  </model:Pioneer2DX>

 
  <model:SimpleSolid>
      <xyz>-0.000 -0.000 -0.000</xyz>
      <shape>box</shape>
      <size>0.07 0.07 0.07</size>
      <color>1 1 0</color>
      <mass>0.1</mass>
      <rpy>0 -0 45</rpy>
      <canBeGrip>yes</canBeGrip>
  </model:SimpleSolid>
 
  <!-- Cannot be gripped. Note: ODE physic will do
undesirable gripping behavior if gripped anyway -->
  <model:SimpleSolid>
      <xyz>2.000 -0.000 -0.000</xyz>
      <shape>box</shape>
      <size>0.07 0.07 0.07</size>
      <color>1 0 0</color>
      <mass>0.1</mass>      
  </model:SimpleSolid>

</gz:world>

----------

controller
----------

/*
 * ptz.cc
 *
 * a simple demo to show how to send commands to and
get feedback from
 * the Sony PTZ camera.  this program will pan the
camera in a loop
 * from side to side
 */

#include <playerclient.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>  

using namespace std;

char host[256] = "localhost";
int port = PLAYER_PORTNUM;

/* parse command-line args */
void
parse_args(int argc, char** argv)
{
  int i;

  i=1;
  while(i<argc)
  {
    if(!strcmp(argv[i],"-h"))
    {
      if(++i<argc)
        strcpy(host,argv[i]);
      else
      {
        //puts(USAGE);
        exit(1);
      }
    }
    else if(!strcmp(argv[i],"-p"))
    {
      if(++i<argc)
        port = atoi(argv[i]);
      else
      {
        //puts(USAGE);
        exit(1);
      }
    }
    else
    {
      //puts(USAGE);
      exit(1);
    }
    i++;
  }
}

int main(int argc, char **argv)
{
  parse_args(argc,argv);
 
  /* Connect to Player server */
  PlayerClient robot(host,port);

  /* Request sensor data */
  PtzProxy zp(&robot,0,'a');
 
  CameraProxy cp(&robot,0,'c');

  int dir = 1;
  double newpan;
  for(;;)
  {
    if(robot.Read())
      exit(1);

    zp.Print();
    cp.Print();

    if(zp.pan > DTOR(80) || zp.pan < DTOR(-80))
    {
      newpan = DTOR(dir*70);
      zp.SetCam(newpan,zp.tilt,zp.zoom);
      for(int i=0;i<10;i++)
      {
        if(robot.Read())
          exit(1);
      }
 
      dir = -dir;
    }
    newpan = zp.pan + dir * DTOR(5);
    zp.SetCam(newpan,zp.tilt,zp.zoom);
  }

  return(0);
}

Anyone know what I am doing wrong?

Thanks
Amanda


       
       
               
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users
Reply | Threaded
Open this post in threaded view
|

Re: Re: getting camera data from robot

Nicola Bellotto
In reply to this post by Amanda Whitbrook
On Thursday 06 Oct 2005 11:28, Amanda Whitbrook wrote:

> When I remove reference to cp.fresh I get these
> errors:
>
> /tmp/cciwwHrk.o(.text+0xa7): In function `main':
> : undefined reference to `cvCreateImage'
>
> /tmp/cciwwHrk.o(.text+0xc1): In function `main':
> : undefined reference to `cvNamedWindow'
>
> /tmp/cciwwHrk.o(.text+0x257): In function `main':
> : undefined reference to `cvShowImage'
>
> /tmp/cciwwHrk.o(.text+0x263): In function `main':
> : undefined reference to `cvWaitKey'
>
> collect2: ld returned 1 exit status
>

You get those errors because you probably don't have OpenCV installed. You can
remove all the "cv..." stuff and use the library you prefer to show the frame
on the screen.
Also, I suggest you to read carefully the Player's documentation
( http://playerstage.sourceforge.net/doc/Player-current/player-html), which
covers most of your doubts/problems.
Cheers
Nicola

--
------------------------------------------
Nicola Bellotto
University of Essex
Department of Computer Science
Wivenhoe Park
Colchester CO4 3SQ
United Kingdom

Room: 1N1.2.8
Tel. +44 (0)1206 874094
E-Mail: [hidden email]
URL: http://privatewww.essex.ac.uk/~nbello
------------------------------------------


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users
Reply | Threaded
Open this post in threaded view
|

Re: getting camera data from robot

Amanda Whitbrook
In reply to this post by Nicola Bellotto
It's OK I've worked out what the problem was. Access
was set wrongly on the camera proxy. I changed it to
'r' and I am now getting data. cheers

> CameraProxy
> added in but I'm having some problems: This is my
> output:
>
> #Ptz(8:0) - a
> #pan    tilt    zoom    panspeed        tiltspeed
> 0.925   0.000   1.030   -1.274  0.000
> #Camera(40:0) - e
> Height(0 px), Width(0 px), Depth(0 bit), ImageSize(0
> bytes)



               
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users