Code to control QCopter

Discussion in 'Build & Tune' started by mikmas, Feb 3, 2019.

  1. mikmas

    mikmas New Member

    I build my own QCopter but i have a huge problem to write software to control him :). I tried a lot of stabilisation code from various projects, but none works good enough. My friend recommended me ArduPilot, because it’s software works good and smooth in a lot of projects. But repository is HUGE and code have mixed functionality so surgical excition only this part responsible only for calculate engines power to fly correctly is too hard for me.

    TO THE POINT.
    I need function or library where i provide to this pitch and roll angles from gyroscope (and accelerometer parameters if need), yaw, pitch, roll
    and throttle where i want to fly and on output i gets 4 values (e.g. 0-1000) that represents engines power i must set to move (or hover in the air if pitch and roll are 0). Could anyone send me this? Project is blocked about month because of this problem

    Sorry for my bad english
     
  2. wafflejock

    wafflejock Well-Known Member

    Try to explain more generally what you're trying to accomplish and might be able to point you in the right direction. This is a pretty good list of FC firmwares available with some advantages and disadvantages https://blog.dronetrest.com/flight-controller-firmware/

    If I have a better idea of the high level goal might be able to understand what level of control you're looking for and how you want to send the control signals to the quad or if you're trying to go for something on board instead of remote (would advise at least having RC as override/failsafe).
     
    GJH105775 likes this.
  3. mikmas

    mikmas New Member

    I don't know how to explain more precisely what I want to achieve. It must be able to stabilise to hover in the air - it doesn't have to stay in place at all costs. Just not to fall and not to run away in any direction. Just stay like simplest qcopters can. Second is to fly at direction i point. I order him to fly forward? Pitch to few degrees and function should count how to slowly move forward. Not aside, not spin. Everything like in simplest quadcopters. i provide him yaw, pitch,roll,throttle and i get engines power values that force device to stay (if pitch and roll are 0) or fly in pointed direction. Smooth and accurate are adventages. Would be great if calculation function can handle lacks in balance. Tests are made in windless room and low altitudes (~1m, more i will be too scared for first times :D)

    I think ways of control doesn't matter, because actually it's made and works fine. Main computer gets direction and power, which needs to be gain. Only thing i need is to turn word into body and calculate input (Y/P/R/THROTTLE) into device motion by set properly engines power
     
  4. wafflejock

    wafflejock Well-Known Member

    Okay would help to know what quadcopter you're trying to do this with as well. There are ready to fly systems like the tello shown here:



    That make it easy to start sending control signals to a quadcopter and have self leveling by default. All quadcopters can do self level to some degree, but some have extra sensors aside from gyro/accelerometer like ultrasound or infrared or barometer or GPS (or all of the above) to get distance/velocity/acceleration measurements when trying to hold position. Typical cheap quadcopters or even those running betaflight without extra sensors will do a fine job staying in the air but not in a solid locked position hover (without a good pilot, even in ideal conditions like you say no wind etc.) unless they have those extra sensors hookedup and configured.

    PixHawk parts/firmware is probably your best bet for up to date hardware/software that allows remote control from a computer. Sounds like you also want telemetry where the quadcopter reports back to the computer, but this is basic at best for most quadcopters (usually only sending the received signal strength indicator or RSSI). Betaflight mostly assumes you will use on screen display (OSD) for getting all the information from the flight controller sent back to you visually in FPV goggles.

    Just about any flight controller can read signals sent as PWM which even a simple MCU like the Atmel chips on the Arduino can send out (or a raspberry pi or anything else with PWM outputs), so you could always send in control signals that way but there are better solutions like pixhawk or ardupilot or iNav more intended for the purpose of being computer controlled.
     

Share This Page