Which version of player are you running? Does the logging device work
properly if you log data from a stage laser interface? and with that player
config does playerprint position2d return anything?
Toby
2009/4/23 Martin Krähling <martin.kraehling@...>
> Hello,
>
> I've got a problem logging the data from a joystick. I am using the
> config file and the C++ code below. I can start player with that config
> file, and I can compile and run the client program. But the program gets
> stuck in the marked line. I can read the state and the type of the log
> device. Both return a zero.
>
> 1. Is it right that for a writelog device "type=0" and for a readlog
> device "type=1"?
>
> 2. Then my program can't finish the command "/logger.SetState(1);/". The
> command "/logger.SetWriteState(1);/" does not work either.
>
> 3. Why is it that "/GetState()/" returns zero although I set
> "/autorecord 1/" in the config file?
>
> Thank you for your help,
> Martin
>
>
> *My config file:*
> /
> driver
> (
> name "linuxjoystick"
> provides ["position2d:0"]
> port "/dev/input/js0"
> # scale_pos [ 0.0001 0.0001 0.0001 ]
> alwayson 1
> )
> # WriteLog Joystick
> driver(
> name "writelog"
> log_directory "/home/martin/Desktop/logs"
> basename "Joystick-Log"
> requires ["position2d:0"]
> provides ["log:0"]
> alwayson 1
> autorecord 1
> )/*
>
> My C++ code:*
>
> /#include <iostream>
> #include <stdio.h>
> #include <libplayerc++/playerc++.h>
>
> int
> main(int argc, char *argv[])
> {
> using namespace PlayerCc;
>
> PlayerClient robot("localhost");
> Position2dProxy joystick(&robot,0);
> LogProxy logger(&robot,0);
>
> double xPos;
> double yPos;
> int counter;
> int state;
> int type;
>
> printf("Joystick test program\n\n");
>
> state = logger.GetState();
> type = logger.GetType();
> printf("Actual log state: %d\n",state);
> printf("Actual log type: %d\n",type);
>
> // Here the program fails!!!
> <<<<-------------------------------------------------------------
> logger.SetState(1);
> counter = 0;
> while(counter<1e3){
> counter++;
> robot.Read();
> xPos = joystick.GetXPos();
> yPos = joystick.GetYPos();
> printf("\r%.0f\t\t%.0f\t\t%d", xPos, yPos,counter);
> usleep(50000);
> }
> logger.SetState(0);
> return 0;
> }/
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Playerstage-users mailing list
> Playerstage-users@...
> https://lists.sourceforge.net/lists/listinfo/playerstage-users
>
--
This email is intended for the addressee only and may contain privileged
and/or confidential information
|