drake

Direct Transcription of nonlinear system with cost function dependent on K matrices returned by time-varying LQR

六月ゝ 毕业季﹏ 提交于 2021-02-10 06:43:07
问题 I'm working on implementing a trajectory optimization algorithm named DIRTREL, which is essentially direct transcription with an added cost function. However, the cost function incorporates the K matrices obtained by linearizing the system around the decision variables (x, u) and employing discrete time-varying LQR. My question is how to most efficiently and concisely express this in drake as my current approach describes the system symbolically and results in extremely lengthly symbolic

Best method to add generalized forces to Linearized (or LQR) MultiBodyPlant?

﹥>﹥吖頭↗ 提交于 2021-02-09 11:12:50
问题 I'm trying to add generalized forces on a free-floating system that has been linearized from a MultiBodyPlant. For a fixed base, the generalized forces basically correspond to the joint torques but for a free-floating case, it includes the base torques/forces as well. However, these are not included in the actuation port of the MultiBodyPlant system and hence while providing the actuation port for linearization (or LQR), the base wrenches are not included in the actuation matrix B post

Best method to add generalized forces to Linearized (or LQR) MultiBodyPlant?

蹲街弑〆低调 提交于 2021-02-09 11:12:37
问题 I'm trying to add generalized forces on a free-floating system that has been linearized from a MultiBodyPlant. For a fixed base, the generalized forces basically correspond to the joint torques but for a free-floating case, it includes the base torques/forces as well. However, these are not included in the actuation port of the MultiBodyPlant system and hence while providing the actuation port for linearization (or LQR), the base wrenches are not included in the actuation matrix B post

direct transcription for compass gait

主宰稳场 提交于 2021-01-29 19:32:02
问题 I'd like to set up trajectory optimization for the compass gait system (as hinted in the lecture video, using control authority can expand the region of attraction for stable walking). In trying to use the DirectTranscription class on compass gait, I am running into the following issue: plant = CompassGait() context = plant.CreateDefaultContext() DirectTranscription(plant, context, 21, TimeStep(0.01)) results in the following error: An exception has occurred, use %tb to see the full traceback

Extra body with nans in Context of a MultiBodyPlant causing Error While Simulation

淺唱寂寞╮ 提交于 2021-01-28 02:29:25
问题 After importing an urdf file and creating a MultiBodyPlant I see an extra parameter group with nans when I print the context. The full printed context can be seen here. The parameter group which I cannot explain/understand is this one: 18 numeric parameter groups with 10 parameters nan nan nan nan nan nan nan nan nan nan If I get the plant topology using: pydot.graph_from_dot_data(plant.GetTopologyGraphvizString())[0].write_svg("robot_topology.svg") I see the topology of the plant as I expect

How to use decision variable from MathematicalProgram in a multibody plant (TypeError)

别说谁变了你拦得住时间么 提交于 2021-01-27 20:04:59
问题 I'm trying to add dynamics constraints to my mathematical program. However, I get TypeError as pasted below indicating MBP is unhappy with a continuous variable being an input. Do I need to convert the symbolic variable to numerical values somehow or is there another type of variable I should use? Here's relevant code: def add_decision_variables(prog, n_steps): # dimensions of x and u dim_x = 6 dim_u = 2 x = prog.NewContinuousVariables(rows=n_steps+1, cols=dim_x) # states, x[t] = [q1, q2, q3,

What is the recommended way of constraining floating base quaternion position and angular velocity?

耗尽温柔 提交于 2021-01-27 19:06:01
问题 For objects with floating base, rotation in the generalized position is expressed as a 4D quaternion. However, the rotation in the generalized velocity is still expressed as a 3D spatial rotation vector. Is there a recommended way of constraining them for, e.g. backward euler? prog.AddConstraint(eq(q[t+1], q[t] + h[t] * qd[t+1])) Is it appropriate to convert the angular velocity into quaternion form, e.g. here? Or as John T. Betts puts it in Practical Methods for Optimal Control and

Applying an external force to an object in pydrake

僤鯓⒐⒋嵵緔 提交于 2021-01-27 15:12:26
问题 This questions is strongly related to adding-forces-to-body-post-finalize I would like to be able to apply an external force to simple geometric primitives in pydrake. This is to perform an evaluation of interactions between bodies. My current implementation: builder = DiagramBuilder() plant = builder.AddSystem(MultibodyPlant(0.001)) parser = Parser(plant) cube_instance = parser.AddModelFromFile('cube.urdf', model_name='cube') plant.Finalize() force = builder.AddSystem(ConstantVectorSource(np

how to get a dynamic which we can be applied gradient in the next step (re-open)

落爺英雄遲暮 提交于 2020-11-29 08:41:04
问题 I want to ask a question related to a workflow like this: 1.obtain manipulator equation of multibody plant, 2.re-write it to a form of qdd = f(q,u), 3.calculate next state(x_next), 4.calculate the gradient of x_next w.r.t x and u. I find the most difficult step is to get the inverse of Inertial matrix which support the gradient calculation in next following step. Drake provide many good tools support double, AutoDiffXd, Symbolic, could we use them to get thing done? Thanks! Here is is a

How to debug `InputPort::Eval(): required InputPort[0] is not connected`

半腔热情 提交于 2020-06-29 08:48:41
问题 Background I am trying to simulate a double pendulum mounted on a cart. I used the examples/multibody/cart_pole/cart_pole_simulation.cc as a starting point. I created a new .sdf based on cart_pole.sdf and added for my double pendulum cart. I've verified (visually, through drake-visualizer) that the sdf file appears correct (changing the joint values moves the model as expected) Due to the addition of a new joint, I added the following line to my source file (where mid_joint is the name of the