Instructions
You will need:- The V-REP simulator
- The PyGame package
- The PyQuadStick package
- The PyQuadSim package
- Administrator (root) privileges on your computer
- Ability to program in Python, if you want to do more than fly with the defaults
Modifying the simulator
To modify the simulator, you should understand how it works. As this diagram shows, the simulator uses a client/server mechanism, in which the V-REP Lua script is the client, sending the current simulation values (location and orientation of the MAV) to a server written in Python. The Python script converts the simluation values to pseudo-sensor readings (GPS, IMU) and passes the readings, along with the current demands from the controller, to a Quadcopter object. The Quadcopter object passes the controller demands and sensor readings through a set of PID controllers to stabilize the MAV and hold its position, computing appropriate thrust values for each motor (propeller). The Quadcopter object returns these four thrust values to the server script, which converts them into three-dimensional force and torque values for each propeller, and returns the forces and torques to the Lua client script.Three simple ways to experiment with the simualtor would be:
- Use the V-REP model browser (Tools / Model browser) to add obstacles like walls to the environment.
- In fmu.py, modify the PID parameters (K_p, K_d) based on a tutorial like this this one
- In pyquadsim_server.py, change GPS_NOISE_METERS to a very small nonzero value (say, .01) to see the effects of an imperfect GPS signal.
Known issues
- This package will not work with previous (pre 3.1.3) releases of V-REP. I don't have time to support backward-compatibility.
- When you modify the code and run the simulator, the Quadstick window may report an error indicating a problem in unpacking some of the data (typically, image data). Hitting ESC and re-running the simulator usually makes this problem go away.
Personnel
Bipeen Acharya, Fred Gisa, and Simon D. Levy. Please contact Simon with any questions or suggestions.Copyright and licensing
Copyright and licensing information (Gnu LGPL) can be found in the header of each source file. V-REP licensing information can be found here.Acknowledgments
This work was supported in part by a Commonwealth Research Commercialization Fund grant from the Center for Innovative Technology (CRCF #MF14F-011-MS) and a Lenfest summer research grant from Washington and Lee University.
[1]
If you put the PyQuadSim folder elsewhere (not recommended), you'll need to edit the V-REP script to reflect this:
launch V-REP and open the
pyquadsim.ttt script from the pyquadsim folder. Go to the Tools menu, select Scripts,
and double-click on Child script (associated with Quadricopter). Edit the value of the
PYQUADSIM_HOME variable to reflect where you put the folder (remember to use double-backslashes
on Windows!) and save the scene
(File / Save scene).
0 comentarios:
Publicar un comentario