I have a set of differential equations for the dynamics of a UAV. They give me the rpy, xyz and their respective rates. I am solving these in my client program and then pass on the velocities (xyz & rpy rates) using playerc_position3d_set_velocity. (I put these equations in the client program and not the controller, because otherwise the UAV model will start falling down as soon as the world file is executed, if it has been initiated with 0 velocity. It will have to be initiated with trim conditions. I need stationary UAV's at the beginning.)

As the parameters of my model are different from that of the Avatar Heli, this doesn't work too well. Also the update times of the method used to solved the differential equations in the client program (eg. delta time for the euler method) and the update time of the visualization is not synchronized) Any suggestions?

Anyway, I finally changed the update function of the controller program as given below. Basically I just want to pass the position of the Helicopter from the clent program at each time instant and plot the positions of the Helicopter. This isn't quite working though. Even when I initiate the position of my model at 100, 100, 0 (xyz) using the world file it is shown at 0,0,0.

Also, what is the double step passed to the update function, it is never used.

void Helicopter::Update(double step)
  GzPose pose;
  if (this->world->GetSimTime() - this->updateTime > this->updatePeriod)
    this->updateTime = this->world->GetSimTime();


  // I am passing the positions using playerc_position3d_set_velocity
  xxx   = this->position->data->cmd_vel_pos[0];
  yyy   = this->position->data->cmd_vel_pos[1];
  zzz   = this->position->data->cmd_vel_pos[2];
  roll  = this->position->data->cmd_vel_rot[0];
  pitch = this->position->data->cmd_vel_rot[1];
  yaw   = this->position->data->cmd_vel_rot[2];
GzVector pos0  = GzVectorSet(xxx, -yyy, zzz);
GzQuatern rot0 = GzQuaternFromEuler(roll, -pitch, -yaw);
GzPose pose;
pose.pos = pos0;
pose.rot = rot0;
// Update the interface


Another issue is the update rate (the rate at which the update function is called). Changing it in the world file doesn't make a difference but when I change the update rate by changing the second parameter of GetDouble function I get lower update times. (Relevant code is given below). I need to lower the update time to get smooth plotting of the Helicopter. If it is plotted at 10 times per second, it will be very jerky.

this->updatePeriod = 1.0 / (node->GetDouble("updateRate", 10) + 1e-6);
this->updateTime = -updatePeriod;

Thanks in advance.