GithubHelp home page GithubHelp logo

prasadnr / webots-quadcopter-python-sitl Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 12.0 3.32 MB

Cross-platform Python based software in the loop simulation for object tracking and general quadcopter simulations using custom pure-Python based custom pure PID (and customisable) flight controller

License: MIT License

Python 100.00%
quadcopter simulation webots python sitl pid cross-platform object-tracking image-processing lane-tracking

webots-quadcopter-python-sitl's People

Contributors

prasadnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webots-quadcopter-python-sitl's Issues

Will there be other "cross-platform" simulator support/custom simulator support?

Currently there are few options which are being considered:

  1. Attempting this problem with Webots if software development time is not that difficult for me.
  2. Having ROS2 and Gazebo working properly (so that it can be easily ported to the hardwares directly).
  3. Attempting custom simulator with appropriate graphics rendering (with 3D polygons).
  4. Some other existing simulator.

Option 1 is about to be discarded as porting the algorithm to hardware requires extra efforts (and also, I had archived this repository as there were issues with the Webots software itself and I had raised appropriate "bugs" for that).

Option 3 can also be discarded as I am not really interested in creating another physics based software simulator just for this.

As of now, ROS2 and Gazebo might not work together properly on all of the operating systems. It does not look like Gazebo ROS2 integration page has been updated in some time. I see (as of now) the following:

http://gazebosim.org/tutorials?tut=ros2_overview

Not all functionality from ROS 1 has been ported to ROS 2 yet. You can check the progress on this issue.
If you're interested in porting official or your own custom plugins, check out the ROS2 migration contribution guide.

So, once I verify that I can use this on both Windows and Ubuntu, I will think about creating this simulator. If not, a lot has changed in software simulations since 2019! So, I might try looking some other simulator up.

In any case, a new repository will be created and this repository might not be updated.

What is the intuition of the math of the aerodynamics?

I am creating this question as several people have asked this question to me.

https://github.com/PrasadNR/Webots-Quadcopter-Python-SITL/blob/master/controllers/mavic2proController/mavic2proController.py#L93-L96

front_left_motor_input = float(params["k_vertical_thrust"]) + vertical_input - roll_input - pitch_input + yaw_input
front_right_motor_input = float(params["k_vertical_thrust"]) + vertical_input + roll_input - pitch_input - yaw_input
rear_left_motor_input = float(params["k_vertical_thrust"]) + vertical_input - roll_input + pitch_input - yaw_input
rear_right_motor_input = float(params["k_vertical_thrust"]) + vertical_input + roll_input + pitch_input + yaw_input

I did not create this equation by myself; these were derived from the C++ equations I saw in Webots software https://github.com/cyberbotics/webots/blob/master/projects/robots/dji/mavic/controllers/mavic2pro/mavic2pro.c#L173-L180 (where I saw these equations without explanations or comments):

const double front_left_motor_input = k_vertical_thrust + vertical_input - roll_input - pitch_input + yaw_input;
const double front_right_motor_input = k_vertical_thrust + vertical_input + roll_input - pitch_input - yaw_input;
const double rear_left_motor_input = k_vertical_thrust + vertical_input - roll_input + pitch_input - yaw_input;
const double rear_right_motor_input = k_vertical_thrust + vertical_input + roll_input + pitch_input + yaw_input;
wb_motor_set_velocity(front_left_motor, front_left_motor_input);
wb_motor_set_velocity(front_right_motor, -front_right_motor_input);
wb_motor_set_velocity(rear_left_motor, -rear_left_motor_input);
wb_motor_set_velocity(rear_right_motor, rear_right_motor_input);

The intuition is like the one below:
k_vertical_thrust is for the quadcopter to just stay in the air without losing altitude. So, just for this discussion, we can assume that the quadcopter just stays in the air even when k_vertical_thrust = 0 (may be by magnetic fields that lets quadcopter "hover" without having to have any air-power). Then, if M1, M2, M3 and M4 are the four motors of the quadcopter, we can conveniently represent the 4 channel input mapped to these four motors' inputs.

Screenshot 2021-08-22 9 24 52 PM

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.