From: Jordi <mumismo@gm...>  20060614 00:48:59

That was it! Anyway, now I have one new problem. Each time I call that function I print the results The first time the object is in x=10 , I set cmd_pos[0]=11 Even thought the next time the object is in x=47.8293 or 58.734245 a very strange and too big number So I once more add 1 and set it to cmd_pos[0] The next time x=7324,21849234 next x= something e06 next something e32 next e100 and gazebo server dies I only modify the values there and I'm sure i'm just adding one. Even if I set cmd_pos[0]=1 everytime the function is called, the same thing happens any clue? > Hi Jordi, > > I've used the truth interface without any problem. > > The only thing you shoud add is: > > truth>data>cmd_new = 1; > > To "inform" the interface that new data is available. > > I hope it helps, > > Didac > > Jordi wrote: > >Hi > >I have some problems playing with the truth interface, I'm using the > > libgazebo interface directly, Gazebo 0.6 > >The code attached below can't modify the position of any object of the > > world. I've added truth intefaces to anything with no results: I always > > get the same readings and nothing changes. > >The interface is correctly opened. > >The readings of the interface are correct and if I try to modify the > > readings (for instance: iface>truth>data>pos[0]=pos_x+xstartX), the > > next time my function is called, those readings go back to the real > > reading of the object so I'm sure the server is working and updating the > > data. > > > > > > double pos_x, pos_y, pos_z; > > double rot_u, rot_x, rot_y, rot_z; > > > > pos_x=iface>truth>data>pos[0]; > > pos_y=iface>truth>data>pos[1]; > > pos_z=iface>truth>data>pos[2]; > > > > rot_u=iface>truth>data>pos[0]; > > rot_x=iface>truth>data>pos[1]; > > rot_y=iface>truth>data>pos[2]; > > rot_z=iface>truth>data>pos[3]; > > > > > > Debug () << "post_x " << pos_x << " x " << x << " startX " <<startX << > > " total " <<pos_x+xstartX ; > > gz_truth_lock(iface>truth,1); > > //iface>truth>data>pos[0]=pos_x+xstartX > > iface>truth>data>cmd_pos[0]=pos_x+xstartX; > > iface>truth>data>cmd_pos[1]=pos_y+ystartY; > > iface>truth>data>cmd_pos[2]=pos_z; > > iface>truth>data>cmd_rot[0]= rot_u; > > iface>truth>data>cmd_rot[1]= rot_x; > > iface>truth>data>cmd_rot[2]= rot_y; > > iface>truth>data>cmd_rot[3]= rot_z; > > gz_truth_unlock(iface>truth); > > > > > > > >x and startX are defined elsewhere. The output is like this. > > > >post_x 8.64727 x 478 startX 477 total 9.64727 > >post_x 8.64727 x 481 startX 478 total 11.6473 > >post_x 8.64727 x 482 startX 481 total 9.64727 > >post_x 8.64727 x 483 startX 482 total 9.64727 > >post_x 8.64727 x 483 startX 483 total 8.64727 > > > > > >That numbers are logical to me, except that I'm overriding cmd_pos with > > the position named total but it is not changing anything of the real > > position of the object. > > > > > >Jordi Polo > > > > > >_______________________________________________ > >Playerstagegazebo mailing list > >Playerstagegazebo@... > >https://lists.sourceforge.net/lists/listinfo/playerstagegazebo 