hi,

In an experiment i wanted to move simple solids and know their changed position and orientation. I used the simplesolids.world as my world file and  added a truth-widget model to one of the solids.

Following is the control program that i used to read the pos:
--------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <gazebo.h>

void get_true_pose(gz_client_t *client, gz_truth_t *true_pose);

int main (int argc, char *argv[])
{
  gz_client_t *client;
  gz_truth_t *true_pose;
  int server_id;
  int client_id;

  // Assume one server and one client
  server_id = 0;
  client_id = 0;

  // Print all errors
  gz_error_init(1, 9);

  // Create a client object
  client = gz_client_alloc(); 

  // Connect to the server
  if (gz_client_connect_wait(client, server_id, client_id) != 0)
    return -1;

  // Create a truth widget interface
  true_pose = gz_truth_alloc();

  // Connect to device on server
  if (gz_truth_open(true_pose, client, "truth1") != 0)
    return -1;

  get_true_pose(client,true_pose);

 // Close the interface and free object
  gz_truth_close(true_pose);
  gz_truth_free(true_pose);

  // Close the connection and free the client object
  gz_client_disconnect(client);
  gz_client_free(client);

  return 0;
}

void get_true_pose(gz_client_t *client, gz_truth_t *true_pose)
{
    // Wait for new data
    gz_client_wait(client);
   
    // Lock it
    gz_truth_lock(true_pose, 1);

    // Print it
    printf("%0.3f  %0.3f\n", true_pose->data->pos[0], true_pose->data->pos[1]);
    printf("------------------------");
   
    // Unlock it
    gz_truth_unlock(true_pose);
 
}
----------------------------------------------------------------------------------------------------------

following is the error when i compiled and linked the program:

/usr/local/player-stage/lib/libgazebo.a(gz_truth.o): In function `gz_truth_quatern_from_euler':
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `cos'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `cos'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `cos'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `sin'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `sin'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:150: undefined reference to `sin'
/usr/local/player-stage/lib/libgazebo.a(gz_truth.o): In function `gz_truth_euler_from_quatern':
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:136: undefined reference to `atan2'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:137: undefined reference to `asin'
/usr/local/player-stage/code/gazebo/libgazebo/gz_truth.c:138: undefined reference to `atan2'
-------------------------------------------------------------------------------------------------

am i using the truth widget model correctly ? if not , then anyone could guide me how to use it. any ideas why i m getting this error ?

Raman
(Researcher, Fraunhofer - Bonn)





-------------------------------
Contact:

Address
: am Wichelshof 32
    Zimmer 01-07
    53111
    Bonn, Germany

Phone : +49 - (0)228 - 2408481

Handy : +49 - (0)177 - 6370708

Website : www.geocities.com/raman_agarwal82


Yahoo! Sports Fantasy Football 06 - Go with the leader. Start your league today!