Update model position in each timestep
Hi
I'm writing a physics solver and want to integrate it into Gazebo. My current implementation is do simulation in my code and update the position of model in each timestep.
I register models with <gravity>false</gravity>
to disable simulation in Gazebo and implement a world plugin. The logic of the code looks like the following.
Factory::Load() {
this->modelPub = this->node->Advertise<msgs::Model>("~/model/modify", 10000);
this->modelPub->WaitForConnection();
this->updateConnection = event::Events::ConnectWorldUpdateEnd(std::bind(&Factory::Step, this));
}
Factory::Step() {
msgs::Model msg;
msg.set_name(modelName);
msgs::Set(msg.mutable_pose(), modelNewPose);
this->modelPub->Publish(msg);
}
The problem now is that I can feel the object moving by stopping and moving and stopping, rather than being silky smooth like a keyframe animation. It's like I'm not updating it fast enough.
I'm not sure if this isn't the correct way to implement it.
Asked by slongle on 2023-04-09 15:33:57 UTC
Comments