GithubHelp home page GithubHelp logo

Comments (4)

JacopoPan avatar JacopoPan commented on July 18, 2024

Hey @kevin-thankyou-lin,

DynAviary expects an action is thrust and torques so it wouldn't work with script fly.py where actions are RPMs returned by a PID controller.

Is #37 what you are trying to achieve? If so, yes you should try option --physics dyn but with the original CtrlAviary class (that bypasses the use of PyBullet's applyExternalForce for a simple dynamics update written in Python).However, I'm not sure on your reasoning about p.setRealTimeSimulation(1), are you sure that is what you are looking for?

By default, the physics server will not step the simulation, unless you explicitly send a 'stepSimulation' command. This way you can maintain control determinism of the simulation. It is possible to run the simulation in real-time by letting the physics server automatically step the simulation according to its real-time-clock (RTC) using the setRealTimeSimulation command. If you enable the real-time simulation, you don't need to call 'stepSimulation'.
Note that setRealTimeSimulation has no effect in DIRECT mode: in DIRECT mode the physics server and client happen in the same thread and you trigger every command. In GUI mode and in Virtual Reality mode, and TCP/UDP mode, the physics server runs in a separate thread from the client (PyBullet), and setRealTimeSimulation allows the physicsserver thread to add additional calls to stepSimulation.

from gym-pybullet-drones.

kevin-thankyou-lin avatar kevin-thankyou-lin commented on July 18, 2024

Hi @JacopoPan, thanks for the fast response!

Gotcha

Yes, #37, I'm planning to run in simulation and then on hardware. Gotcha, --physics dyn work and subverts the need for applyForces, but when I set p.setRealTimeSimulation(1), on around line 140 of fly.py (and remove these lines from BaseAviary)

    #### Obtain the PyBullet Client ID from the environment ####
    PYB_CLIENT = env.getPyBulletClient()
    p.setGravity(0, 0, -9.8, physicsClientId=PYB_CLIENT)
    p.setRealTimeSimulation(1, physicsClientId=PYB_CLIENT)
    p.setTimeStep(1/ARGS.simulation_freq_hz, physicsClientId=PYB_CLIENT)

the drones just drop to the ground i.e. different behavior from p.setRealTimeSimulation(0, physicsClientId=PYB_CLIENT).

Would you know how to fix this?

Thanks for your help, again!

from gym-pybullet-drones.

JacopoPan avatar JacopoPan commented on July 18, 2024

--physics dyn really subverts PyBullet entirely other than using it for the GUI and/or rendering.
I don't necessarily see why you think p.setRealTimeSimulation(1) would help moving towards hardware.
What type of policy are you trying to implement or learn? The CtrlAviary in fly.py is intended for a low level attitude/position controller that would need to be ported to C to run on a real Crazyflie.

from gym-pybullet-drones.

kevin-thankyou-lin avatar kevin-thankyou-lin commented on July 18, 2024

Okay, that's fair. True, I was just thinking I could use the real time sim as a heuristic, but that's true about porting to C. I'm not quite focusing on end to end policy learning (if that were the case, yeah, I wouldn't need a PID controller). I'm more decoupling control from perception so that's why I need a PID controller.

Thank you!

from gym-pybullet-drones.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.