In preparation for making an autonomous drone for indoors flight, I have been trying to simulate a drone with optical flow, but I fail to take off.
I have set up the simulation as described in the toutorials. I have also set up the optical flow and range finder as described on the wiki. I configured it by editing the default parameters to this (2.4 KB)this (2.4 KB) .
To set the mode, arm it and attempt takeoff, I use the mavros utility commands like this:
This results in the drone correctly arming in guided mode, but when I run the last command, it fails while giving this error message in the SITL console:
Got MAVLink msg: COMMAND_ACK {command : 410, result : 4}
Do you know what command 410 and result 4 mean?
I did not find it in the wiki, but another discuss post said to use EKF3 and these parameters:
I got it working in the end. My problem was that the EKF needs a position, even if we are only using relative movement commands. This can be solved by manually setting the position using e.g.
Can you talk more about how to set gp origin by topic /mavros/global_position/set_gp_origin and confirm that ?
I can only see gp origin message on topic /mavros/global_position/gp_origin once when my copter was armed, and it wasn’t change after I sent set gp origin message on /mavros/global_position/set_gp_origin.
Thank you.
That is a good point. /mavros/global_position/set_gp_origin works well to set the origin, but it not obvious how to check if it is set and ready to arm. When I tried it just now I got a response on /mavros/global_position/gp_origin when trying to arm before it was ready., when it was ready to be armed and when I armed it after it was ready. I.e. 3 responses before first successful arm. I don’t know how /mavros/global_position/gp_origin is supposed to be used, but for me it publishes something when the origin is confirmed and the drone is ready to arm. Since it also publishes at other times, I am not sure how to use it.
I ended up just trying to arm it and see if it would arm to test whether it was ready to fly. This is however an abuse of the safety features and not a good solution.
Sorry for not being more helpful, but I don’t know the solution to this one.