I'm currently working on a project to generate a stable altitude and automatic control for a quadcopter I'm using arduino as the flight controller Ultrasonic sensor HC-SR04 MPU-6050 However my project expected outcome is to set the quadcopter to fly( altitude hold) to 50 Cm above the ground. My problem is I don't know which one of the sensors I have to use for PID set point can anyone help me with the code or the functions the I need to use ?

  • 1
    Welcome to Robotics, Zaid Jamal Alfityan. You said you don't know which of the sensors you have to use for PID, but you also stated you have an ultrasonic sensor. Could you please clarify your question? Did you mean to say you're not sure how to use/interface with the sensor, or something different? – Chuck Aug 9 at 19:07
  • sorry. my question is " for the PID set point should i use the gyro MPU-6050 or the distance from ultrasonics sensor?" im currently using a code form " brokking.net/ymfc-3d_main.html " for auto level im afraid if i set the distance from ultrasonic sensor as a set point for the PID how the quadcopter going to balance ? – Zaid Jamal Alfityan Aug 9 at 20:08

Typically quadrotor have a nested control approach. That means one P(I)D loop controls the orientation (using IMU readings) and another one the position (using position sensors, e.g. ultrasound for altitude).

The attitude loop is executed faster than the position one and is assumed to ensure that the desired orientation is tracked reasonably well.

The position loop is around the orientation one and provides desired orientation to be tracked based on the desired position.

This is necessary as lateral displacement of the quadrotor can only be achieved by changing the orientation so that total thrust is pointing in the direction of motion.

In your case, you might escape that as you describe only altitude (z-position) control, so you want to control the 3 orientation angle and and the altitude, which mean you can directly do as the quadrotor as 4 inputs. The only drawback is that you might see you quadrotor drifting around if you do not cits position in the horizontal plan.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.