Refactor StepControl and GUI to return change status.
StepControl methods SetSpeed, SetNoiseParameters, and SetPauseState now return a boolean indicating whether the state was actually changed. The GUI functions NoiseGui and StepControlGui also return a boolean reflecting if any parameters were modified. Noise parameters are now directly managed by StepControl rather than being stored in UxState. The StepControlEvent message has been expanded to include all step control parameters. Keyboard event handling has been slightly refactored to better align with event-based updates. PiperOrigin-RevId: 940656342 Change-Id: I3701623a2fdcfc4c084b5db0ae19048669040de4
This commit is contained in:
committed by
Copybara-Service
parent
f4b2f76def
commit
58d6910afa
@@ -14,6 +14,8 @@
|
||||
|
||||
// Python bindings for MuJoCo platform simulation components.
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <mujoco/experimental/platform/sim/step_control.h>
|
||||
#include "structs.h"
|
||||
@@ -70,5 +72,16 @@ PYBIND11_MODULE(sim, m) {
|
||||
.def("get_pause_state", &StepControl::GetPauseState,
|
||||
"Returns the current pause state.")
|
||||
.def("request_single_step", &StepControl::RequestSingleStep,
|
||||
"Request a single step if paused.");
|
||||
"Request a single step if paused.")
|
||||
.def(
|
||||
"get_noise_parameters",
|
||||
[](const StepControl& self) {
|
||||
float noise_scale, noise_rate;
|
||||
self.GetNoiseParameters(noise_scale, noise_rate);
|
||||
return std::make_tuple(noise_scale, noise_rate);
|
||||
},
|
||||
"Returns the noise parameters.")
|
||||
.def("set_noise_parameters", &StepControl::SetNoiseParameters,
|
||||
py::arg("noise_scale"), py::arg("noise_rate"),
|
||||
"Sets the noise parameters.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user