dojo-sim / Dojo.jl

A differentiable physics engine for robotics
MIT License
297 stars 26 forks source link

Physical meaning of the inputs of `set_input!` #38

Closed XianyiCheng closed 2 years ago

XianyiCheng commented 2 years ago

I was wondering what is the physical meaning of the inputs in set_input? I was trying to balance the block in block2d and block example with a controller! function. I need to set the input in the gravity direction to be timestep*actual_object_weight in order to balance the object. If I want to exert certain forces/torques on the joints, should I always multiple the actual force/force by timestep to get the input?

Here is the control function I used to balance 'block2d'

function controller!(mechanism, t)
    u = [0.0, -mechanism.bodies[1].mass*mech.gravity[3]*timestep, 0.0]
    set_input!(mechanism, u)
end
simon-lc commented 2 years ago

Good question! This is something we need to make clearer. The input of set_input! is an impulse (i.e. = force * timestep).

XianyiCheng commented 2 years ago

Thanks!