Comments (10)
@yuchen-x yes, the whole point is that creating those extra environments is computationally wasteful.
The solution is simply, as you say, to re-implement the __init__()
methods to take the appropriate parameters (it's 4 in the base class but a few more in the non-abstract subclasses) instead of reading them from an environment.
This week has been a bit busy so far but that's the same fix I intend to push by the end of it.
from gym-pybullet-drones.
Hi,
I noticed that you had also integrated controllers in BaeMultiagentAviary.py at line 80-83.
If I understand correctly, for example, line 81 will load two (num_drones=2) drones connecting the Pybullet engine,
80: if drone_model in [DroneModel.CF2X, DroneModel.CF2P]:
81: self.ctrl = [DSLPIDControl(CtrlAviary(drone_model=DroneModel.CF2X)) for i in range(num_drones)]
And, then after the super()init call at line 84, there will be another two drones loaded. Thus, there are three pybullet environments being created and four drones loaded in the end, correct?
I noticed the BaseControl class required only 4 arguments from the env:
DRONE_MODEL
GRAVITY
KF
KM
Then, I guess I can modify DSLPIDControl and BaseControl class to receive the above four arguments rather than an env, and then create controllers inside of BaseAviary Class according to the number of drones, right? I am not sure if this is gonna lead to any potential issue, so I'd like to double-check with you.
Thanks!
from gym-pybullet-drones.
Hi @Cakhavan, thanks for pointing this out/reminding me. The error you encountered is relatively minor (I used the attribute before setting it in the superclass constructor instead of the parameter) but there is still a more structural problem in using PID control within the RL classes which I haven't fixed yet: I originally made controllers as classes taking their environment as a parameter; now, embedding one into the other, creates all sorts of circular dependencies (and that's bad).
I'm aware of it but didn't have time to re-structure the code just yet, hopefully by the end of the upcoming week π
from gym-pybullet-drones.
Awesome yeah it seems to be the case. I modified the code slightly to get some quick results:
in BaseSingleAgentAviary.py I commented out lines 86-91 and replaced it with:
self.ctrl = [DSLPIDControl(CtrlAviary(drone_model=DroneModel.CF2X,
num_drones=1,
initial_xyzs=None,
initial_rpys=None,
physics=Physics.PYB,
neighbourhood_radius=10,
freq=240,
aggregate_phy_steps=int(240/48),
gui=False,
record=False,
obstacles=False,
user_debug_gui=Falsegym_pybullet_drones/envs/single_agent_rl/BaseSingleAgentAviary.py
)) for i in range(1)]
Not sure if this helps anything, but at least the code doesnt break and it seems to be doing some learning as well.
Hope this helps in some way!
from gym-pybullet-drones.
Yes, just giving any instance of an aviary (using the same drone model as the desired one) would work.
But I think we can agree it's ugly and wastefulπ
.
It's a usage I hadn't initially planned for and now requires some re-thinking of the control superclass, mostly for the sake of readability .
from gym-pybullet-drones.
I have modified how control classes are initialized, so that only a drone model (and not an environment would be required)
from gym-pybullet-drones.
Excuse me, @JacopoPan, @Cakhavan. I'm a little confused. For now, does "execute singleagent.py with actiontype: pid, env: hoveraviary" mean "use pid to control a single drone for a hover task"? Thanks for your time.
from gym-pybullet-drones.
@shangjiayong yes, a PID position (relative to that of the drone in world frame) controller
from gym-pybullet-drones.
@JacopoPan Thank you for your answer. However, when I use PID as actiontype, the console output contains the calculated reward. It looks like the reinforcement learning method is still working. This makes me a bit confused.
from gym-pybullet-drones.
@shangjiayong
PID action type means that the input to the aviary/environment/pybullet simulation are position references but if you use singleagent.py
you are still using RL, if you want to explicitly command the drone, look at the fly.py
and velocity.py
scripts.
from gym-pybullet-drones.
Related Issues (20)
- What does pycffirmware do HOT 1
- run learn.py
- rgb and GL HOT 2
- path planning algorithms HOT 1
- Ctrl Freq and Simulation Freq Questions HOT 3
- Clarification on Each Dimension's Meaning for ActionType.VEL HOT 3
- Discrete action space implementation based on BaseRLAviary HOT 1
- Visualize drone cameras in explorer HOT 1
- Location of Paper on Dynamics Code HOT 1
- -1 to 1 action space meaning HOT 1
- Pybullet drones
- No module named 'gym_pybullet_drones.envs.VisionAviary'
- Units HOT 1
- High frequency in RPMs when include action buffer in observation space can couse problems in real hardware HOT 2
- Why might my rewards be inversely proportional to the target height in the HoverAviary environment? HOT 2
- Error while running velocity.py and fly.py examples HOT 1
- ray 1.9 error while installing gym-pybullet-drones HOT 1
- Sim2real transfer for betaflight HOT 2
- Request to Migrate from Master to Main Branch for Improved Stability HOT 3
- learn.py: Incompatibility with gym env despite having stable_baselines3 version 2.x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gym-pybullet-drones.