Describe the Bug
In webots 2023b, programming in C ++, Use the supervisor's function to set the position of the robot, but the actual position is inconsistent with the desired position.
Steps to Reproduce
Using the getFromDef function to get the robot node
then using getField ("translation") to get the translation field
setting the position with setSFVec3f, and getting the position of the robot with getPosition
the results obtained are inconsistent. And the movement of the next frame is also inconsistent.
Describe the Bug In webots 2023b, programming in C ++, Use the supervisor's function to set the position of the robot, but the actual position is inconsistent with the desired position.
Steps to Reproduce
This is the relevant code
Node* ROBOT = robot->getFromDef("ROBOT"); Field* ROBOTComPos = ROBOT ->getField("translation"); ROBOTComPos ->setSFVec3f(newpos); cout << "des pos:" << *newpos << " " << *(newpos + 1) << " " << *(newpos + 2) << endl; pos = ROBOT->getPosition(); cout <<"real pos" << *pos << " " << *(pos + 1) << " " << *(pos + 2) << endl;
Expected behavior Because a supervisor is used, the set position should be the same as the actual position, but the result is different.
Screenshots
env Windows 11, webots2023b