SvenGronauer / phoenix-drone-simulation

Simulation environments for the CrazyFlie quadrotor: Used for Reinforcement Learning and Sim-to-Real Transfer
MIT License
23 stars 9 forks source link

Cannot run DroneHoverSimpleEnv due to missing urdf files #5

Closed Sapio-S closed 1 year ago

Sapio-S commented 1 year ago

Hi! I am trying to run the demos, but unfortunately encountered some problems.

When I ran python -m phoenix_drone_simulation.train --alg ppo --env DroneHoverBulletEnv-v0, everything looked fine and I got a policy checkpoint (though it did not behave as I expected). However, when I ran python -m phoenix_drone_simulation.train --alg ppo --env DroneHoverSimpleEnv-v0 or python examples/transfer_learning_drone_hover.py, I got the following error. What might be wrong in my settings?

b3Warning[examples/Importers/ImportURDFDemo/UrdfFindMeshFile.h,102]:
/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/assets/cf21x_sys_eq.urdf:29: cannot find './cf2.dae' in any directory in urdf path
b3Error[examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp,121]:
Could not parse visual element for Link:b3Error[examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp,121]:
base_linkb3Error[examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp,121]:
failed to parse linkTraceback (most recent call last):
  File "/home/usr/phoenix-drone-simulation/examples/transfer_learning_drone_hover.py", line 55, in <module>
    main()
  File "/home/usr/phoenix-drone-simulation/examples/transfer_learning_drone_hover.py", line 15, in main
    env_source = gym.make("DroneHoverSimpleEnv-v0")
  File "/home/usr/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 200, in make
    return registry.make(id, **kwargs)
  File "/home/usr/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 105, in make
    env = spec.make(**kwargs)
  File "/home/usr/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 75, in make
    env = cls(**_kwargs)
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/hover.py", line 258, in __init__
    super(DroneHoverSimpleEnv, self).__init__(
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/hover.py", line 49, in __init__
    super(DroneHoverBaseEnv, self).__init__(
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/base.py", line 123, in __init__
    self._setup_simulation(physics=physics)
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/base.py", line 213, in _setup_simulation
    self.drone = CrazyFlieSimpleAgent(bc=self.bc, **self.agent_params)
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/agents.py", line 486, in __init__
    super(CrazyFlieSimpleAgent, self).__init__(
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/agents.py", line 129, in __init__
    super(CrazyFlieAgent, self).__init__(
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/agents.py", line 68, in __init__
    self.body_unique_id = self.load_assets()
  File "/home/usr/phoenix-drone-simulation/phoenix_drone_simulation/envs/agents.py", line 367, in load_assets
    body_unique_id = self.bc.loadURDF(
pybullet.error: Cannot load URDF file.

Also, I would like to try other control modes as well. Can I set the control mode through command line argument? Or, which part of code should I modify to change it from 'PWM' to, say, 'AttitudeRate'?

Looking forward to your reply. Thanks a lot!

Sapio-S commented 1 year ago

Hi, I fixed the issue by changing the 29th line ofphoenix_drone_simulation/envs/assets/cf21x_sys_eq.urdf into <mesh filename="./meshes/cf2.dae" scale=" 1 1 1"/>.