Closed danielewis579 closed 1 year ago
I've updated the defining a controller example to use a cartpole (https://dojo-sim.github.io/Dojo.jl/dev/creating_simulation/define_controller.html)
The updated explanation should explain how to set inputs for individual joints and apply external forces to individual bodies.
In general, you are applying force/torques, unless you specify a different input_scaling
in the Mechanism
constructor, e.g., to apply impulses. For the cartpole, the minimal state is [x,v,theta,omega], where x, v are the positon and velocity of the cart, and theta, omega are the angle and velocity of the pole. Possible inputs are a force (in y-direction) on the cart, or a torque (around the x-axis) on the pole. If you set an input [f,t], the first input is the force on the cart, the second the torque on the pole.
When going over the API I found a section Defining a Controller, at this section there is an example of single pendulum swing-up. This example gives the general idea of how to work with the controller but it’s too simple. what I don’t understand is this:
If my mechanism has multi-body, how do I find and control a specific body/joint? the
get_minimal_state
return a vector which holds all the mechanism state without any separation between the different joints.In the pendulum example the controller out put is a vector of length 2, when the first input is referring to the angular coordinate and the second is for the angular velocity, I don't understand the meaning of applying impulse on this states? when applying the impulse on the angular coordinate state I apply a Torque and when applying impulse on the angular velocity state I apply ... what?
What if I want to apply an external spatial force on a body, as part of the controller, how do I implement it?
If you could provide clearer documentation and some additional example it'll be great.
Thank in ahead and great gob on this package.