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

wb_supervisor_field_get_* can return stale values after wb_supervisor_simuation_reset() if the simulation time is the same as the preceding call. #6670

Open
brettle opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@brettle
Copy link
Contributor

brettle commented Oct 2, 2024

Describe the Bug
wb_supervisor_field_get_* can return stale values after wb_supervisor_simuation_reset() if the same as the preceding call.

Steps to Reproduce

wb_robot_init();
const int ELAPSED_TIME = 32; // Could be anything
wb_robot_step(ELAPSED_TIME);
double *first_run_translation = wb_supervisor_field_get_sf_vec3f(wb_supervisor_node_get_field(wb_supervisor_node_get_from_def("DEF_OF_SOLID"), "translation"));
wb_supervisor_simuation_reset();
// TODO: Modify something that should change the translation reported
wb_robot_step(ELAPSED_TIME);
double *second_run_translation = wb_supervisor_field_get_sf_vec3f(wb_supervisor_node_get_field(wb_supervisor_node_get_from_def("DEF_OF_SOLID"), "translation"));

Expected behavior
The relevant values in second_run_translation should be different from the values in first_run_translation, but this is not the case, even when they are different in GUI.

System

  • Operating System: Linux Fedora Workstation 40.
  • Graphics Card: Intel® UHD Graphics 630 (CFL GT2)

Additional context
Using wb_supervisor_node_get_position() works and can be used as a workaround in many cases.

I suspect the problem is triggered by this:

if (action == GET && f->count == -1 && f->last_update == wb_robot_get_time()) {
robot_mutex_unlock();
return;
}

last_update should presumably be reset on all fields when wb_supervisor_simuation_reset() is called.

@brettle brettle added the bug Something isn't working label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant