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+x-startX), 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+x-startX ;
    gz_truth_lock(iface->truth,1);
    //iface->truth->data->pos[0]=pos_x+x-startX
    iface->truth->data->cmd_pos[0]=pos_x+x-startX;
    iface->truth->data->cmd_pos[1]=pos_y+y-startY;
    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


_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo

Reply via email to