0

I found a useful demo in github(https://github.com/maggiewu19/compass-gait-simulator). However, the codes didn't work with the newest pydrake. I ran the codes in google colab  and got errors.

Any reply will be appreciated.

Axebobby
  • 31
  • 4
  • It will be much easier for us to help if you were to link to your colab notebook and show the specific errors that you are getting. – Russ Tedrake Jul 23 '20 at 11:06
  • My colab notebook [link] (https://drive.google.com/drive/folders/1vH3ElDGiQK4HMXR56bTyhC6tDe6gIYN_?usp=sharing). I got a lot of errors, such as 'ImportError: cannot import name 'FloatingBaseType' I know it means the pydrake has updated and it is not suitable to use the code written last year. However, I am not familiar with pydrake api. Maybe I will find a solution sooner. It is still not easy for me to figure it out now. – Axebobby Jul 24 '20 at 13:14

1 Answers1

0

I see. This is quite old -- it is using RigidBodyPlant which has been replaced by MultibodyPlant.

Drake has supported quite a long deprecation period on this. You can make most of it work by pulling the old RigidBodyPlant classes from attic, e.g. by changing this

from pydrake.all import (Box,
                         DiagramBuilder,
                         FindResourceOrThrow,
                         Isometry3,
                         SignalLogger,
                         Simulator)
from pydrake.attic.all import (FloatingBaseType, RigidBodyTree, RigidBodyPlant, VisualElement)

Unfortunately, I didn't leave as long of a deprecation period on PlanarRigidBodyVisualizer in the underactuated repo. You will have to pull an old version of underactuated to make that work.

FTR -- we are currently working on a way to make the colab setup's durable, by having a peg revision of drake (and underactuated) in the setup script. For now, you could download the old version of the underactuated repo, or just that specific file that was removed after it's deprecation period.

I can't guarantee you won't hit more errors after that. It would be much better to use the updated compass gait examples from class which are all using MultibodyPlant.

Russ Tedrake
  • 4,703
  • 1
  • 7
  • 10
  • In the updated compass gait examples, I am confused how could I move the camera view along the x axe to avoid the disappearance of the robot when the robot keeping walking. – Axebobby Jul 25 '20 at 08:56
  • And I don't know how to get the right leg information in the simulation, as floating_base_state returns reference to the output port that provides the state in the floating-base coordinates (described via left leg xyz & rpy + hip angle + derivatives) – Axebobby Jul 25 '20 at 09:02