Random Crazy behavior on takeoff

Each time I arm the throttle and takeoff, the drone randomly starts moving into different places without being given any input commands. I tried using rc 3 1500 as an earlier discussion suggested this to maintain altitude. I had the idea it might be because I was using guided mode, but I believe there’s no other way to takeoff besides using guided mode. Is there anything I can do to prevent the turbulent movement of the drone?

Sorry, no .bin flight log, no cookie.

Are you saying you are only using telemtry andGuided mode and there’s no RC transmitter and receiver ?

Sorry I’m quite new to this so I’m not sure exactly where to find it. I do have a log of the console and mavproxy though, if that helps.

Connect tcp:127.0.0.1:5760 source_system=255

Loaded module console

Loaded module map

Running script (C:\Users\bcome\AppData\Local\MAVProxy\mavinit.scr)

Loaded module help

Unknown command ‘graph timespan 30’

Log Directory:

Telemetry log: mav.tlog

MAV> arm throttle

STABILIZE> mode guided

STABILIZE> takeoff 50

STABILIZE> mode stabilize

STABILIZE> arm throttle

STABILIZE> mode guided

STABILIZE> takeoff 50

GUIDED> GUIDED> rc 3 1500

GUIDED> mode circle

GUIDED>

CIRCLE> CIRCLE>

CIRCLE> mode alt_hold

CIRCLE>

ALT_HOLD> ALT_HOLD>

ALT_HOLD> mode poshold

ALT_HOLD>

POSHOLD> POSHOLD>

POSHOLD> mode rtl

POSHOLD>

RTL> RTL>

RTL>

Running script C:\Users\bcome\AppData\Local\MAVProxy\mavinit.scr

-> set moddebug 2

-> module load help

link 1 down

link 1 OK

online system 1

Mode STABILIZE

APM: Initialising APM

APM: Calibrating barometer

APM: ArduCopter V4.0.4-rc2 (93f0c46d)

APM: DESKTOP-N3OGA2A

APM: Frame: QUAD

APM: Barometer 1 calibration complete

Init Gyro***

Ready to FLY APM: GPS 1: detected as u-blox at 115200 baud

APM: EKF2 IMU0 initial yaw alignment complete

APM: EKF2 IMU1 initial yaw alignment complete

APM: EKF2 IMU1 tilt alignment complete

APM: EKF2 IMU0 tilt alignment complete

APM: EKF2 IMU0 origin set

APM: EKF2 IMU1 origin set

APM: Arming motors

Got MAVLink msg: COMMAND_ACK {command : 400, result : 0}

ARMED

APM: NavEKF2: lane switch 1

APM: EKF primary changed:1

APM: EKF variance

APM: Mode change failed: GUIDED requires position

Got MAVLink msg: COMMAND_ACK {command : 11, result : 3}

APM: EKF2 IMU1 is using GPS

APM: EKF2 IMU0 is using GPS

Got MAVLink msg: COMMAND_ACK {command : 22, result : 4}

APM: Disarming motors

APM: EKF primary changed:0

DISARMED

Flight battery 100 percent

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

APM: Arming motors

Got MAVLink msg: COMMAND_ACK {command : 400, result : 0}

ARMED

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

Mode GUIDED

Got MAVLink msg: COMMAND_ACK {command : 22, result : 0}

APM: EKF2 IMU1 in-flight yaw alignment complete

APM: EKF2 IMU0 in-flight yaw alignment complete

height 15

height 25

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

Mode CIRCLE

Flight battery 90 percent

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

Mode ALT_HOLD

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

Mode POSHOLD

Flight battery 70 percent

Got MAVLink msg: COMMAND_ACK {command : 11, result : 0}

Mode RTL

height 15

Flight battery 60 percent

APM: Disarming motors

DISARMED

height 5

Flight battery 50 percent

What I mean is on sitl when I try to get the drone to takeoff(in guided mode) before I can get it to do anything else it starts moving around on its own before I can ask it to do anything else, like circle or poshold.

What’s the value of your ARMING_CHECK parameter?

It’s set to 1 so it can check all parameters

You are not giving enough information to be helped.
All we know is that you are using SITL and that you are using guided mode.

We need to know things like, are you simulating a companion computer for control over the guided flight or are you just trying to use SITL as a flight sim for planned missions, or your typing guided commands in. The desired goal allows for better directed advice and solutions.

What command was sent in guided and how was it done, via a socket or typed command line, etc.

The wiki page HERE has a section called Accesing log files. Its generally considered that you can’t be helped if you don’t provide logs.

Sorry about that, I’ve obtained a flight log now. I’m actually using SITL as a flight sim on a custom drone for which I’ve made a few changes to the existing programs from github, using commands typed in from my keyboard.

https://drive.google.com/drive/folders/1h3jjjHqtP2NMwzKABvFpTI51wd-zo2Kk?usp=sharing

Few things. Those are telemetry style logs and are much harder to analyze than the standard logs. You would be looking for a .bin file or a .log file.

Anyways your roll and pitch look completely unstable. Is the copter even capable of flying? Have you tried to get it airborne in Stabilize? As a custom drone; I would guess based upon what i’ve seen that the platform isnt actually able to fly as specified. SITL simulates the craft including aerodynamics to a degree and it looks like the system is oscillating out of control.

Actually, whenever I put it into stabilize mode after taking it off the ground, it just falls back down to the ground, so probably the physics needs to be changed.
It was actually fine when I used arducopter stable, but I’m using 3.6 now because I needed to make some changes.

Uploading: 00000002.BIN… 00000003.BIN (994 KB)

These are a couple of .bin files from the logs folder

ok I retract my guess with the new log data.
It appears the craft is doing almost exactly what it wants to do in flight.
Did you initiate the RTL commands yourself?

I haven’t done a deep log dive yet but it appears that you are getting an EKF fault and the system initiates an automatic landing. The EKF error could be why the coptor thinks it needs to fly off in one direction at first.
FAILSAFE_EKFINAV-1

I looked at your EKF innovation and both the velocity and position levels spike immediately at takeoff and remain high until landing/impact with the ground. The default safety value is below 0.8 your mean values where 3.44 for position and 4.02 for velocity.
This means the EKF thinks both your position and velocity data are inaccurate to a level where the craft can no longer be safely controlled and thus initiated a vertical pilot controlled landing since it was in guided mode.

Thanks a lot for the help. Taking the log data into account I changed quite a few parameters and tuned the PID a bit as well. It appears the SITL would kick into failsafe mode almost instantly on takeoff so I altered the guided mode code a little bit too. Issues most likely occurred due to the different dimensions of my drone to the default one so it needed lots of variation in parameters.

Yes, when doing a new platform always try to take off in stabilize first. I usually just command a high throttle setting on rc 3 and if it doesnt go straight up then I have a problem with the parameters and setup of the model.