-
Notifications
You must be signed in to change notification settings - Fork 172
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
Set simulation state from Python API #291
base: main
Are you sure you want to change the base?
Conversation
Hi, this PR will be useful for my work as described in the /issue/343. Any chance to be reviewed and passed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you still want to submit this...
@@ -170,6 +170,17 @@ grpc::Status AgentService::SetState(grpc::ServerContext* context, | |||
task->Transition(model, data_); | |||
agent_.SetState(data_); | |||
|
|||
// Set simulation state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be done in ui_agent_service too.
if (request->set_simulation()) { | ||
Agent::StepJob job = [&agent_data = data_]( | ||
Agent* agent, const mjModel* model, mjData* data) { | ||
mju_copy(data->qpos, agent_data->qpos, model->nq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is missing some states. Copy the rest of them: time, act, mocap_pos, mocap_quat, userdata.
Optionally, set the simulation state (
qpos
,qvel
,time
) via the Python API. Useful for visualizing state estimate in GUI during hardware in-the-loop testing.