How to change the physical properties of the robot and plane to apply Domain Randomization ?- Drake

30 views Asked by At

I’m working with a quadruped robot to learn locomotion behavior with DRL using Ros2 and Drake in c++, and I want to apply domain randomization in my learning.

I would like some advice from the community to How I can change the physical properties of the robot (like mass, inertia, joint friction) and plane properties dynamically during the training.

Thank you.

1

There are 1 answers

0
Hongkai Dai On

One approach is that you can set the parameter in the context for each simulation. Here is a quick code for doing that

plant = MultibodyPlant(...)
simulator = Simulator(plant)
plant.GetBodyByName("my_body").SetMass(simulator.get_mutable_context(), new_mass)
simulator.AdvanceTo(T)

Notice calling SetMass function, which takes the context as an input. You can call SetSpatialInertiaInBodyFrame and SetDamping methods, both take context as an input.