RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.25k stars 1.25k forks source link

[examples/quadrotor] QuadrotorPlant dynamics are incorrect. #17246

Closed RussTedrake closed 2 years ago

RussTedrake commented 2 years ago

The unit test in quadrotor_dynamics_test.cc has the line:

  EXPECT_TRUE(ge_pose.rotation().IsNearlyEqualTo(ge_pose.rotation(), 1e-10));

Unsurprisingly, this passes. But if you change it to the intended

  EXPECT_TRUE(ge_pose.rotation().IsNearlyEqualTo(mb_pose.rotation(), 1e-10));

Then the test fails.

I found this because I was writing up a (not so) quick example of the 3D dynamics of a quadrotor using Propeller. Which gives different answers. In particular, the dynamics don't match if I have non-zero angular velocity.

The multibody notation in this line is wrong:

const Vector3<T> w_BN_B = rpy.CalcAngularVelocityInChildFromRpyDt(rpyDt);

According to that method's documentation, it should return w_NB_B, not w_BN_B. Unfortunately, I'm timing out now. Can I ask for the dynamics team to resolve it the existing failing test in quadrotor_dynamics_test.cc, please?

cc @sherm1 in case a different assignee is more appropriate.
cc @mpetersen94 , in case it has any bearing on the strange results you've been seeing.

sherm1 commented 2 years ago

Paul @mitiguy can you figure out what's going on here?

mitiguy commented 2 years ago

@sherm1 I am starting to look at it now.

mitiguy commented 2 years ago

Closed by PR #17254