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

Added graph rendering, Actuator force visualization[no sites], Sim reset method(backspace) and window positioning #23

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

Conversation

rohit-kumar-j
Copy link
Contributor

@rohit-kumar-j rohit-kumar-j commented Sep 16, 2022

Graph preview (KEY: G)

Unfortunately, the time at the bottom of the graph was not recorded in the video. It gives a time-based graph
The red line is a random signal(sine in this case)

mujoco_graph_vis.mp4

Actuator Force visualization via graphs

The sites are used to get the location and orientation of the body at the actuator location only.

mujoco_actuator_vis.mp4

... and added examples

@rohanpsingh
Copy link
Owner

Hi @rohit-kumar-j thanks for the PR.
A small question - does the actuator force visualization work even if there are no sites added at each joint in the XML?

@rohit-kumar-j
Copy link
Contributor Author

rohit-kumar-j commented Sep 20, 2022

Not as of now. I was hoping to ask for suggestions for that. We need the position and orientation of the joint at which point we need to render the force arrow.

Asked for the same. However, getting the orientation in njnt x 9 like xmat is not available without a reference site/geom.

@rohit-kumar-j
Copy link
Contributor Author

rohit-kumar-j commented Sep 20, 2022

@rohanpsingh, created force rendering without sites. inputs:

[Tested only for hinge and slide joints]

f_render_list = [
    # fmt: ["jnt_name", "actuator_name", "label_name"]
    ["hinge_1", "pos_servo_1", "force_at_hinge_1"],
    ["hinge_2", "pos_servo_2", "force_at_hinge_2"],
    ["hinge_3", "pos_servo_3", "force_at_hinge_3"],
]

viewer.show_actuator_forces(
        f_render_list=f_render_list,
        show_force_labels=True
        rgba_list=[1, 0.5, 1, 0.5], # common color
        force_scale=0.05,           # common arrow length scale
        arrow_radius=0.05,         # common arrow radius
        show_force_labels=True,   # Needs to be true for showing the labels and the force values
    )
mujoco_actuator_force_rendering_python.mp4

PS: Do not use all the force rendering labels simultaneously if your robot has many actuators. The simulation will run very slow. (You can show the arrows, but not the labels and values)

@rohit-kumar-j rohit-kumar-j changed the title Added basic graph rendering and Actuator force visualization via sites Added basic graph rendering and Actuator force visualization [directly at joints] Sep 24, 2022
@rohit-kumar-j rohit-kumar-j changed the title Added basic graph rendering and Actuator force visualization [directly at joints] Added graph rendering, Actuator force visualization[no sites], Sim reset method(backspace) Sep 25, 2022
@rohit-kumar-j
Copy link
Contributor Author

Added sim reset method with backspace:

mujoco_reload_method.mp4

@rohit-kumar-j rohit-kumar-j changed the title Added graph rendering, Actuator force visualization[no sites], Sim reset method(backspace) Added graph rendering, Actuator force visualization[no sites], Sim reset method(backspace) and window positioning Sep 25, 2022
@rohit-kumar-j
Copy link
Contributor Author

rohit-kumar-j commented Sep 25, 2022

@rohanpsingh, is the default window_positioning (top left of screen) too much in the viewer.__init__() method?

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.

2 participants