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

Set simulation state from Python API #291

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thowell
Copy link
Collaborator

@thowell thowell commented Feb 13, 2024

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.

@oscarkfpang
Copy link

Hi, this PR will be useful for my work as described in the /issue/343. Any chance to be reviewed and passed?

Copy link
Collaborator

@nimrod-gileadi nimrod-gileadi left a 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
Copy link
Collaborator

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);
Copy link
Collaborator

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.

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

Successfully merging this pull request may close these issues.

3 participants