Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an error between the actual value and the set value when setting the position of the robot with the supervisor in webots 2023b. #6594

Open
rookielittlep opened this issue Jul 29, 2024 · 1 comment

Comments

@rookielittlep
Copy link

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

  1. Using the getFromDef function to get the robot node
  2. then using getField ("translation") to get the translation field
  3. setting the position with setSFVec3f, and getting the position of the robot with getPosition
  4. the results obtained are inconsistent. And the movement of the next frame is also inconsistent.

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
image

env
Windows 11, webots2023b

@rookielittlep
Copy link
Author

Set the acceleration of gravity to 0 and restart webots to solve this problem. I don't know the specific reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant