GithubHelp home page GithubHelp logo

Comments (5)

JacopoPan avatar JacopoPan commented on July 18, 2024

Hi @dipaco,

can you help me understand what you want to implement? Could a time-varying force contribution do the trick? The way the robot model is specified in the URDF file/simulation, one could apply external forces on its center of mass or at the site of each motor.

E.g.,

env = CtrlAviary(...)
PYB_CLIENT = env.getPyBulletClient()
p.applyExternalForce(env.DRONE_IDS[0],
                     -1,  # -1 for the base, 0-3 for the motors
                     forceObj=[w_x, w_y, w_z], # a force vector
                     posObj=[0, 0, 0], flags=p.WORLD_FRAME,  physicsClientId= PYB_CLIENT)

Note that external forces are reset at each tilmestep, so you should repeatedly apply one, if that's the intended behaviour.

from gym-pybullet-drones.

dipaco avatar dipaco commented on July 18, 2024

Thank you @JacopoPan for your quick answer. This might work, I need to look into it, but so far it looks pretty much like what I need. Yes, what I meant by f: R^3 x t -> R^3 is a time-varying force that gives me a wind velocity at every position x. I can convert that wind field into a drag force using some knowledge of the geometry of the quadcopter. However, I wasn't sure if it was possible to exert that external force into the quadcopter at simulation time. I will try your example.

Thank you so much.

from gym-pybullet-drones.

JacopoPan avatar JacopoPan commented on July 18, 2024

No prob.
Note that you should call p.applyExternalForce() before every p.stepSimulation().
env.step() might contain multiple p.stepSimulation(), if you created env with argument aggregate_phy_steps > 1.
In that case, you might want to modify BaseAviary directly, to apply the external force just before p.stepSimulation().

from gym-pybullet-drones.

chijiokekechi avatar chijiokekechi commented on July 18, 2024

Hi @JacopoPan, thank you for answering this. Just for clarification, the p.applyExternalForce() adds this force to the total forces acting on the drone. What units are the forces and how do I distinguish this from the drones internal forces (i.e. thrust and the likes)? Thank you very much.

from gym-pybullet-drones.

JacopoPan avatar JacopoPan commented on July 18, 2024

Hi @chijiokekechi,

I would refer you to the PyBullet manual for the use of applyExternalForce (or search for it in BaseAviary.py). The unit is Newton. In the method call, you would specify one of the links composing the robots (4 for the center of the drone).

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.