GazzolaLab / Elastica-RL-control

Code for the cases presented in the paper "Elastica: A compliant mechanics environment for soft robotic control"
MIT License
26 stars 9 forks source link

NameError: name 'FreeRod' is not defined #8

Closed sai-aneesh closed 2 years ago

sai-aneesh commented 2 years ago

Hi all,

I was excited to explore this repo for my research. I was trying to run the case 1 with this command. python3 logging_bio_args.py --algo_name TRPO --total_timesteps 1E6 --SEED 0 --timesteps_per_batch 2048 However, I was getting this error in the set_environment.py file.


********** Iteration 0 ************
Optimizing Policy...
sampling
The option to set damping coefficient (nu) for the rod during rod initialisation is now deprecated. Instead, for adding damping to rods, please derive your simulation class from the add-on Damping mixin class. For reference see the class elastica.dissipation.AnalyticalLinearDamper(), and for usage check examples/axial_stretching.py The option to set damping coefficient (nu) during rod construction will be removed in the future (v0.3.1).
Target position: 0.48091483107752364 0.7711978957802575 -0.4329243253563396
Traceback (most recent call last):
  File "logging_bio_args.py", line 182, in <module>
    model.learn(total_timesteps=int(args.total_timesteps))
  File "/home/aneesh/Elastica-RL-control/venv/lib/python3.7/site-packages/stable_baselines/trpo_mpi/trpo_mpi.py", line 333, in learn
    seg = seg_gen.__next__()
  File "/home/aneesh/Elastica-RL-control/venv/lib/python3.7/site-packages/stable_baselines/common/runners.py", line 89, in traj_segment_generator
    observation = env.reset()
  File "/home/aneesh/Elastica-RL-control/venv/lib/python3.7/site-packages/stable_baselines/bench/monitor.py", line 80, in reset
    return self.env.reset(**kwargs)
  File "/home/aneesh/Elastica-RL-control/Case1/set_environment.py", line 426, in reset
    class WallBoundaryForSphere(FreeRod):
NameError: name 'FreeRod' is not defined

Kindly help me out with this error.

armantekinalp commented 2 years ago

Can you try installing requirements now again? This commit should fix it c6001da . We haven't refactor the code in this repo for the newest features of PyElastica because of that it was giving error.

sai-aneesh commented 2 years ago

Thanks for your quick reply! It works now. In addition to that, I had to add just a few more specifications in the requirements.txt file. Adding them here, in case anyone else faces an issue.

pyelastica == 0.1.0.post5
stable-baselines
tensorflow==1.15
protobuf==3.20.*
mpi4py
gym==0.19.0