PyQuadSim: A Multi-platform, open-source quadrotor simulator in Python


PyQuadSim is a Python program that allows you to fly a simulated quadrotor miniature aerial vehicle (MAV) from a variety of controllers (joystick, R/C transmitter, PS3 controller).

You can modify the source code to add new sensors and other features, as well as configuring the simulated environment for different kinds of missions.

PyQuadSim uses the powerful Virtual Robot Experimentation Platform (V-REP), but does not require programming in Lua or writing a plugin in C++.

I thought some of y'all might find this useful:  http://home.wlu.edu/~levys/software/pyquadsim/

Comments welcome!

Views: 6347


3D Robotics
Comment by Chris Anderson on August 31, 2014 at 8:58pm

Thanks for sharing that, Simon. What are some of the advantages over the APM:Copter SITL simulator?

Have you considered supporting Pixhawk for the HIL version?

Comment by Simon D. Levy on August 31, 2014 at 9:50pm

Good questions, Chris!  I'm thinking that it may be an apples-and-oranges comparison:

(1) Our original intent was to build a simulator for indoor missions with SLAM, optical-flow, and the like.  In fact, I chose the outdoor setting from V-REP for the initial release only because it had a nice visual texture to it, and I was too lazy to modify it to simulate the floor of an indoor room ;^)

(2) We wanted a Pure Python package that students and hobbyists could download and run on any OS without having to compile C/C++ code, and could then tweak and extend easily to to learn about PID control and other fundamental stuff.  ("Pure Python" is a bit of a misnomer I guess, because there's a bit of Lua in there, but all PID control and the like is done in Python.)  

(3) We chose V-REP because it gives us the ability to quickly prototype new environments, obstacles, and sensors without having to write a lot of code. 

(4) We wanted the ability to plug-and-play with various controllers (joystick, game controller, R/C, and even keyboard), so people could fly with whatever controller they had lying around.

So, long story short, PyQuadSim is more of a teaching / research tool as compared to a serious simulator like APM:Copter SITL, I'd say.

As for Pixhawk for the HIL version: cool idea!  In fact, I spent most of today working on a little Python program to display MAVLink telemetry from my PX4Flow unit, so it would be pretty straightforward to tap into the telemetry from the Pixhawk on my Iris.


3D Robotics
Comment by Chris Anderson on September 1, 2014 at 6:55am
Great answers - that makes a lot of sense and I'm exactly the kind of user you're targeting (okay at Python, a bit lost with C++).

We're working on both Python based systems and better simulation tools on the dev team. We'd love to have you join the dev list to share this directly with the developers to see if there's an opportunity to collaborate. https://groups.google.com/forum/m/#!overview)
Comment by Simon D. Levy on September 1, 2014 at 10:02am

Sounds good, Chris -- feel free to add me to the dev list.

Comment by Aldo Vargas on September 16, 2014 at 7:26am

Hi Simon!! I'm trying your simulator right now :) seems very nice...

I'm on a mac, and I have a ps3 controller, and I followed your guide, but when starting, it stops very quickly, the console reports:

Simulation started.

Lua call error: [string "SCRIPT Quadricopter"]:35: One of the function's argument type is not correct. (simUnpackFloats)

Simulation stopping...

Lua call error: [string "SCRIPT Quadricopter"]:35: One of the function's argument type is not correct. (simUnpackFloats)

Simulation stopping...

Lua call error: [string "SCRIPT Quadricopter"]:35: One of the function's argument type is not correct. (simUnpackFloats)

Simulation stopping...

Lua call error: [string "SCRIPT Quadricopter"]:35: One of the function's argument type is not correct. (simUnpackFloats)

Simulation stopping...

Simulation stopped.

What am I doing wrong?? 

Cheers!!

Comment by Simon D. Levy on September 16, 2014 at 8:51am

Hi Aldo,

Thanks for trying out the simulator!  I too have found this error on Mac, but only intermittently, so it is difficult to diagnose.  It would help me if you could:

1) Tell me what version of Python you are running: in a terminal window do % python -V

2) Tell me what Mac OS you are running (Apple menu / About this Mac)

3) Zip and email me (simon.d.levy@gmail.com) the folder that you downloaded and modified from github.

Thanks, and I look forward to hearing from you,

Simon

Comment by Simon D. Levy on January 10, 2016 at 3:11pm

Thanks for the comment, Filip.  I fixed the throttle_inc problem (moved it to PyQuadStick PS3 code), but unfortunately I do not have the equipment here to replicate your setup.

Comment by adel on January 23, 2016 at 10:06pm

Hello! 

Thanks for this good work.

I have this problem when I do start simulation: the program appears this letter "Server /home/levys/Desktop/PyQuadSim//pyquadsim_server.py could not be launched. please make sure that it exists and it executable. Then stop and restart the simulation".

I think that V-rep don't able to run pyquadsim_server.py.

How can I solve this error?

I am using Windows 7 32 , python 3.2.5 and pygame 1.9.2a0 win32.

Comment by Simon D. Levy on February 21, 2016 at 1:09pm

Sorry about that, adel!  After hearing from another user, I found the source of the bug and believe it's fixed now.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service