From: VIMAL M. <vim...@ya...> - 2008-02-14 23:39:44
|
HI I am using the following palyer 2.1.0rc1 and stage 2.1.0rc1 the cfg and world files are as follows world file # Desc: Stage demo with lots of models. Works with everything.cfg. # CVS: $Id: everything.world,v 1.86 2007/03/26 19:54:36 gerkey Exp $ # the size of a pixel in Stage's underlying raytrace model in meters resolution 0.02 interval_sim 100 # milliseconds per update step interval_real 100 # real-time milliseconds per update step # defines Pioneer-like robots include "mypioneer.inc" include "mypioneertarget.inc" include "mycamera.inc" include "roomba.inc" # defines 'map' object used for floorplans include "map.inc" # defines the laser model `sick_laser' configured like a Sick LMS-200 include "sick.inc" size [50 50 ] gui_disable 0 gui_interval 100 gui_menu_interval 20 window( size [ 755.000 684.000 ] #center [-7.707 2.553] #size [ 1680.000 1050.000 ] center [8 7] scale 0.025 ) map( bitmap "bitmaps/table.png" map_resolution 0.02 size [50 50] name "cave" ) pioneer2dx ( name "robot1" color "OrangeRed" size [0.5 0.5] pose [4 4 0] sick_laser(color "OrangeRed") ) pioneer2dx ( name "robot2" color "OrangeRed" size [0.5 0.5] pose [4 4 0] sick_laser(color "OrangeRed") ) ..cfg file # Desc: Player sample configuration file for controlling Stage devices # Date: 18 Apr 2003 # CVS: $Id: everything.cfg,v 1.34 2007/03/26 19:54:36 gerkey Exp $ # load the Stage plugin simulation driver driver ( name "stage" provides ["simulation:0" ] plugin "libstageplugin" # load the named file into the simulator worldfile "opaquetest2.world" ) # Export the map driver ( name "stage" provides ["map:0"] model "cave" ) # Create a Stage driver and attach position2d and laser interfaces # to the model "robot1" driver ( name "stage" provides ["6665:position2d:0" "6665:laser:0"] requires ["6665:opaque:0"] model "robot1" ) driver ( name "stage" provides ["6666:position2d:0" "6666:laser:0"] requires ["6666:opaque:0"] model "robot2" ) driver ( name "relay" provides ["6665:opaque:0"] ) driver ( name "relay" provides ["6666:opaque:0"] ) # Demonstrates use of a Player "abstract driver": one that doesn't # interface directly with hardware, but only with other Player devices. # The VFH driver attempts to drive to commanded positions without # bumping into obstacles. driver ( name "vfh" provides ["6665:position2d:1" "6666:position2d:1"] requires ["6665:position2d:0" "6665:laser:0" "6666:position2d:0" "6666:laser:0"] ) *************************** ..cc file *************************** #include <libplayerc++/playerc++.h> #include <libplayerc/playerc.h> #include <iostream> #include "args.h" #define PLAYER_OPAQUE_MAX_SIZE 10 //inherits PlayerCc::ClientProxy. int main(int argc, char **argv) { parse_args(argc,argv); int i=0; // we throw exceptions on creation if we fail try { using namespace PlayerCc; PlayerClient robot1("localhost", 6665); Position2dProxy pp1(&robot1, 0); LaserProxy lp1(&robot1, 0); OpaqueProxy opq_1(&robot1,0); PlayerClient robot2("localhost", 6666); Position2dProxy pp2(&robot2, 0); LaserProxy lp2(&robot2, 0); OpaqueProxy opq_2(&robot2,0); player_opaque_data_t opData; uint8_t opGetData[1024]; std::cout << robot1 << std::endl; std::cout << robot2 << std::endl; pp1.SetMotorEnable (true); pp2.SetMotorEnable (true); for(i = 1; i<= 5 ; i++) { robot1.Read(); robot1.Read(); } for(;;) { opData.data_count = 5; opData.data[0] = 'a'; opData.data[1] = 'b'; opData.data[2] = 'c'; opData.data[3] = 'd'; opData.data[4] = 'e'; opq_1.SendCmd(&opData); robot1.Read(); uint count1 = opq_1.GetCount(); std::cout << "count1 = " << count1 << std::endl; opq_1.GetData(opGetData); std::cout <<"opGetData[0]="<<opGetData[0]<< std::endl; std::cout <<"opGetData[1]="<<opGetData[1]<< std::endl; std::cout <<"opGetData[2]="<<opGetData[2]<< std::endl; std::cout <<"opGetData[3]="<<opGetData[3]<< std::endl; std::cout <<"opGetData[4]="<<opGetData[4]<< std::endl; if (opGetData[0] == 'a') { opData.data_count = 3; opData.data[0] = 'D'; opData.data[1] = 'E'; opData.data[2] = 'F'; opq_2.SendCmd(&opData); robot2.Read(); opq_2.GetData(opGetData); std::cout <<"opGetData[0]="<<opGetData[0]<< std::endl; std::cout <<"opGetData[1]="<<opGetData[1]<< std::endl; std::cout <<"opGetData[2]="<<opGetData[2]<< std::endl; } } } catch (PlayerCc::PlayerError e) { std::cerr << e << std::endl; return -1; } } Toby Collett <tco...@pl...> wrote: Hi which version of player and stage are you using and what is your server side setup (i.e. which drivers are you using). If code is segfaulting it is also useful to post a gdb backtrace of the failing code. Toby On 15/02/2008, VIMAL MEHTA <vim...@ya...> wrote: HI I tried to transmit data using the opaque interface. I donot know why the o/p is a segmentation error always. Can anyone please take a look at the simple code below. Your valuable suggestions will be appreciated highly. Thanks VIMAL #include <libplayerc++/playerc++.h> #include <iostream> #include "args.h" #define PLAYER_OPAQUE_MAX_SIZE 10 //inherits PlayerCc::ClientProxy. int main(int argc, char **argv) { parse_args(argc,argv); int i=0; // we throw exceptions on creation if we fail try { using namespace PlayerCc; PlayerClient camera1("localhost", 6665); OpaqueProxy opq_1(&camera1, 0); LogProxy lp_1(&camera1, 0); PlayerClient target("localhost", 6666); Position2dProxy pp(&target, 0); LaserProxy lp(&target, 0); player_opaque_data_t opData; uint8_t opGetData[PLAYER_OPAQUE_MAX_SIZE]; uint32_t i=0; std::cout <<"a"<< std::endl; for(;;) { std::cout <<"a"<< std::endl; opData.data_count = 5; opData.data[0] = 'a'; opData.data[1] = 'b'; opData.data[2] = 'c'; opData.data[3] = 'd'; opData.data[4] = 'e'; opq_1.SendCmd(&opData); camera1.Read(); camera1.Read(); std::cout <<"b"<< std::endl; uint count1 = opq_1.GetCount(); std::cout << "count1 = " << count1 << std::endl; opq_1.GetData(opGetData); std::cout <<"opGetData[0]="<<opGetData[0]<< std::endl; std::cout <<"opGetData[1]="<<opGetData[1]<< std::endl; std::cout <<"opGetData[2]="<<opGetData[2]<< std::endl; std::cout <<"opGetData[3]="<<opGetData[3]<< std::endl; std::cout <<"opGetData[4]="<<opGetData[4]<< std::endl; } } catch (PlayerCc::PlayerError e) { std::cerr << e << std::endl; return -1; } } --------------------------------- Forgot the famous last words? Access your message archive online. Click here. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Playerstage-users mailing list Pla...@li... https://lists.sourceforge.net/lists/listinfo/playerstage-users -- This email is intended for the addressee only and may contain privileged and/or confidential information ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ Playerstage-users mailing list Pla...@li... https://lists.sourceforge.net/lists/listinfo/playerstage-users --------------------------------- Unlimited freedom, unlimited storage. Get it now |