From: Toby C. <tco...@pl...> - 2008-02-19 21:31:17
|
what version of player are you using? On 20/02/2008, jalg <hea...@gm...> wrote: > > > I'm trying to write a simple client that uses the laser device, but I > there's > a pointer error in my code. I studied it over and over again, and I can't > find my mistake. I would appreciate if someone could help me look at it. I > get the following as output: > > ======= Backtrace: ========= > /lib/tls/i686/cmov/libc.so.6[0xb7deed65] > /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7df2800] > > /usr/local/lib/libplayerxdr.so.2(player_laser_config_t_free+0x2a)[0xb7ef4c0a] > /usr/local/lib/libplayerc.so.2(playerc_laser_set_config+0xa2)[0xb7f54c62] > ./myclient[0x8048b7b] > /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7d9b050] > ./myclient[0x8048961] > ======= Memory map: ======== > 08048000-08049000 r-xp 00000000 08:01 1338549 /home/jars/work/myclient > 08049000-0804a000 rw-p 00000000 08:01 1338549 /home/jars/work/myclient > 0804a000-0806c000 rw-p 0804a000 00:00 0 [heap] > b3300000-b3321000 rw-p b3300000 00:00 0 > b3321000-b3400000 ---p b3321000 00:00 0 > b3498000-b34a2000 r-xp 00000000 08:01 522307 /lib/libgcc_s.so.1 > b34a2000-b34a3000 rw-p 0000a000 08:01 522307 /lib/libgcc_s.so.1 > b34a3000-b34ac000 r-xp 00000000 08:01 557911 > /lib/tls/i686/cmov/libnss_files-2.6.1.so > b34ac000-b34ae000 rw-p 00008000 08:01 557911 > /lib/tls/i686/cmov/libnss_files-2.6.1.so > b34ae000-b7d08000 rw-p b34ae000 00:00 0 > b7d08000-b7d27000 r-xp 00000000 08:01 > 67088 /usr/lib/libjpeg.so.62.0.0 > b7d27000-b7d28000 rw-p 0001e000 08:01 > 67088 /usr/lib/libjpeg.so.62.0.0 > b7d28000-b7d2a000 r-xp 00000000 08:01 557905 > /lib/tls/i686/cmov/libdl-2.6.1.so > b7d2a000-b7d2c000 rw-p 00001000 08:01 557905 > /lib/tls/i686/cmov/libdl-2.6.1.so > b7d2c000-b7d32000 r-xp 00000000 08:01 73712 /usr/lib/libltdl.so.3.1.5 > b7d32000-b7d33000 rw-p 00005000 08:01 73712 /usr/lib/libltdl.so.3.1.5 > b7d33000-b7d47000 r-xp 00000000 08:01 67378 /usr/lib/libz.so.1.2.3.3 > b7d47000-b7d48000 rw-p 00013000 08:01 67378 /usr/lib/libz.so.1.2.3.3 > b7d48000-b7d4f000 r-xp 00000000 08:01 557918 > /lib/tls/i686/cmov/librt-2.6.1.so > b7d4f000-b7d51000 rw-p 00006000 08:01 557918 > /lib/tls/i686/cmov/librt-2.6.1.so > b7d51000-b7d65000 r-xp 00000000 08:01 557908 > /lib/tls/i686/cmov/libnsl-2.6.1.so > b7d65000-b7d67000 rw-p 00013000 08:01 557908 > /lib/tls/i686/cmov/libnsl-2.6.1.so > b7d67000-b7d6a000 rw-p b7d67000 00:00 0 > b7d6a000-b7d7e000 r-xp 00000000 08:01 557916 > /lib/tls/i686/cmov/libpthread-2.6.1.so > b7d7e000-b7d80000 rw-p 00013000 08:01 557916 > /lib/tls/i686/cmov/libpthread-2.6.1.so > b7d80000-b7d82000 rw-p b7d80000 00:00 0 > b7d82000-b7d84000 r-xp 00000000 08:01 67189 > /usr/local/lib/libplayerutils.so.2.1.0 > b7d84000-b7d85000 rw-p 00001000 08:01 67189 > /usr/local/lib/libplayerutils.so.2.1.0 > b7d85000-b7ec9000 r-xp 00000000 08:01 557902 > /lib/tls/i686/cmov/libc-2.6.1.so > b7ec9000-b7eca000 r--p 00143000 08:01 557902 > /lib/tls/i686/cmov/libc-2.6.1.so > b7eca000-b7ecc000 rw-p 00144000 08:01 557902 > /lib/tls/i686/cmov/libc-2.6.1.so > b7ecc000-b7ecf000 rw-p b7ecc000 00:00 0 > b7ecf000-b7ed0000 r-xp 00000000 08:01 67013 > /usr/local/lib/libplayererror.so.2.1.0 > b7ed0000-b7ed1000 rw-p 00000000 08:01 67013 > /usr/local/lib/libplayererror.so.2.1.0 > b7ed1000-b7f10000 r-xp 00000000 08:01 66780 > /usr/local/lib/libplayerxdr.so.2.1.0 > b7f10000-b7f13000 rw-p 0003e000 08:01 66780 > /usr/local/lib/libplayerxdr.so.2.1.0 > b7f13000-b7f14000 rw-p b7f13000 00:00 0 > b7f14000-b7f37000 r-xp 00000000 08:01 557906 > /lib/tls/i686/cmov/libm-2.6.1.so > b7f37000-b7f39000 rw-p 00023000 08:01 557906 > /lib/tls/i686/cmov/libm-2.6.1.so > b7f46000-b7f5d000 r-xp 00000000 08:01 73042 > /usr/local/lib/libplayerc.so.2.1.0 > b7f5d000-b7f5e000 rw-p 00016000 08:01 73042 > /usr/local/lib/libplayerc.so.2.1.0 > b7f5e000-b7f60000 rw-p b7f5e000 00:00 0 > b7f60000-b7f7a000 r-xp 00000000 08:01 523922 /lib/ld-2.6.1.so > b7f7a000-b7f7c000 rw-p 00019000 08:01 523922 /lib/ld-2.6.1.so > bf9a8000-bf9bd000 rw-p bf9a8000 00:00 0 [stack] > ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] > Aborted (core dumped) > > > Here's my code: > > #include <stdio.h> > #include <libplayerc/playerc.h> > > int main(int argc, const char **argv) > { > int i; > playerc_client_t *client; > playerc_position2d_t *position2d; > playerc_laser_t *laser; > > double min, max, scanning_frequency, resolution, range_res; > unsigned char intensity; > > 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 position2d proxy (device id "position2d:0") and > susbscribe > // in read/write mode > position2d = playerc_position2d_create(client, 0); > if (playerc_position2d_subscribe(position2d, PLAYERC_OPEN_MODE) != > 0) > { > fprintf(stderr, "error: %s\n", playerc_error_str()); > return -1; > } > > // Enable the robots motors > playerc_position2d_enable(position2d, 1); > > // Start the robot moving > playerc_position2d_set_cmd_vel(position2d, 0.3, 0, 0.2, 1); > > // Create a laser proxy (device id "laser:0") and susbscribe > // in read/write mode > laser = playerc_laser_create(client,0); > if(playerc_laser_subscribe(laser, PLAYERC_OPEN_MODE) != 0) > { > fprintf(stderr, "error: %s\n", playerc_error_str()); > return -1; > } > > // Configure laser > min = -3.1416/2; > max = 3.1416/2; > resolution = 100; > range_res = 1; > intensity = 1; > if(playerc_laser_set_config(laser, min, max, resolution, > range_res, > intensity, scanning_frequency) != 0) > { > fprintf(stderr, "error: %s\n", playerc_error_str()); > return -1; > } > > > > for (i = 0; i < 50; i++) > { > // Read data from the server and display current robot > position > playerc_client_read(client); > printf("position : %f %f %f\n",position2d->px, > position2d->py, > position2d->pa); > } > > playerc_laser_unsubscribe(laser); > playerc_laser_destroy(laser); > > playerc_position2d_unsubscribe(position2d); > playerc_position2d_destroy(position2d); > > playerc_client_disconnect(client); > playerc_client_destroy(client); > > return 0; > } > > -- > View this message in context: > http://www.nabble.com/Laser-error-tp15566516p15566516.html > Sent from the playerstage-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > 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 |