Custom Erle Copter control using Ardupilot libraries

Hello,

Im working in a control theory project with an Erle-copter, i want to use Ardupilot libraries to read the drone information and use that to control de UAV with an Model Predictive Control method; I just need to read Attitude and Position, and control the motors (send PWM to get a desired speed).

Now I’m using AP_AHRS to estimate Attitude, AP_Motors to send PWM values to each motor, and I want to use AP_GPS to read GPS information and then use AP_AHRS_NavEKF or any other library to estimate current position.

There’s a problem reading GPS info, I tried to use GPS_AUTO_test, but didn’t get any prints, it looks like the Serial_Manager is not detecting the uart port, where the GPS is connected in my Erle Brain 3. GPS is correctly connected and I can read the info using “sudo screen /dev/ttyS0”, GPS LEDs are blinking (sattelites detected) as well and when I execute apm.sh to use the default binary installed in the device, the info is displayed correctly in APM Planner 2, so I guess the GPS is working correctly.

I want to ask some things:

  • Using Ardupilot libraries is the better way to do what I’m doing? Is there another software like PX4 to do that?

  • How can I configure /dev/ttyS0 to be the uartB path to use AP_GPS or AP_AHRS_NavEKF?

Thanks in advance and sorry if I made any mistake writing in english,