MATLAB Answers

Have no control of pixhawk when starting up from the sd card

11 views (last 30 days)
mechali omar
mechali omar on 15 Dec 2019
Commented: R on 14 May 2020
Dear all
After loading the Simulink model to the pixhawk using the awsome 'Embedded Coder Support Package for PX4 Autopilots', I couldn't arm the motors and start the flight, I'm sure that there is something missing in the 'rc.txt' file in the SD card, but I do not know how to fix that, looking for your help. I can't start anything. I have no control of the pixhawk. Also some parameters are not loaded.
44444444.PNG
thanks
here is my rc,txt:
#Copyright 2018 The MathWorks, Inc.
# This is the custom rc.txt which loads px4_simulink_app on start-up
usleep 1000
uorb start
usleep 1000
#nshterm /dev/ttyACM0 & #Disable the USB serial console
usleep 1000
tone_alarm start
usleep 3000
px4io start
gps start # #gps start -f Starts GPS driver and Fake a GPS signal (useful for testing)
usleep 1000
sh /etc/init.d/rc.sensors
usleep 1000
#Uncomment the below 2 lines to use LPE estimator
#attitude_estimator_q start
#local_position_estimator start
#Using EKF2 estimator by default as PX4 does build LPE on px4fmu-v2 due to a limited flash.
ekf2 start
usleep 1000
mtd start
usleep 1000
param load /fs/mtd_params
usleep 1000
rgbled start
usleep 1000
fmu mode_pwm # This is required for AUX PWM channels
usleep 1000
#......... arming ....
mavlink start -d /dev/ttyACM0 -m config –x
px4_simulink_app start
nshterm /dev/ttyS6 & #this will make ttyS6 the serial console
mavlink boot_complete
#exit #4-Jan-2019
  1 Comment
R
R on 14 May 2020
you understand that you cant arm it with QGC?
your simulink code replaces the logic(arm sequence and alot more) of the px4 base software
if you want pixhawk to do anything , you do it by writing and then building your logic into the pixhawk
  1. did you try the example : https://www.mathworks.com/help/supportpkg/px4/ref/pwm-getting-started-px4.html '?
  2. did you try the aux ports?
  3. did you provide the pixhawk rail pins and the esc the correct voltage?
  4. try with simple servo
from experience , it works

Sign in to comment.

Answers (3)

Sebastian
Sebastian on 17 Dec 2019
Hi,
try 'px4io safety_off' in the nsh or rc.txt. Maybe its just in save mode...
Best, Sebastian

mechali omar
mechali omar on 17 Dec 2019
Dear Sebastian
Thanks, I'll check that and see.
I really appreciate your suggestion

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!