Commanding an indoor drone using an ArduCopter

How are you supposed to command an indoor drone using ardupilot firmware?
The mode GUIDED uses GPS and all the mavlink or mavros commands it accepts are not working with GUIDED_NOGPS the mavros topic /mavros/setpoint_velocity/cmd_vel does not work for GUIDED_NOGPS !!.

How will I control the X, Y, Z velocity and X, Y, Z angular velocity of an indoor drone using Optical flow for it localization what flight mode should i have to use and how i control these velocities?

Hii
You can use the vehicle in “Loiter” MODE itself.
(I am assuming the optical flow is configured correctly.)

And assuming you have set the EKF origin then you can guide the drone in local as well as in global frame with velocities vx ,vy ,vz. actually i am travelling rn and will provide a details conclusion over it soon.
Till then hope this helps.

1 Like

some users try Fake GPS using some system, which I am interested in trying out soon.

1 Like

Thanks for your reply.
One more doubt is will drone accept mavlink velocity commands in loiter mode.
I mean isn’t it supposed to be that loiter mode only works with RC even if we publish the velocity commands it may interfere with RC sticks isn’t it?

Oh thanks for reply,
If the GPS is fake then what parameters and components of drone will give the velocity data.
I mean in guided mode GPS give the velocity data and hence the cmd_vel of mavros works. Even if we add optical flow in guided how to make sure that any calculation the drone is making does not rely on gps since it is fake right?

Are you using optical flow+range finder? If only using optical flow, the state estimator can’t estimate velocity, and therefore you can’t command or control velocity.

Currently I am planning to add PX4Flow optical flow sensor and a rangefinder sensor. But the problem is with velocity cmd is it possible to control this drone now using velocity commands?

I don’t really know what you mean by “now”.
Yes, you can give velocity commands to Ardupilot, but only if Ardupilot can estimate it’s own velocity. In your flight logs, do you see velocity estimates? XKF1.VE and XKF1.VN (Onboard Message Log Messages — Copter documentation)

Another thing I found when reading posts exactly like yours (Navigation with Optical Flow Only - #3 by moobsen):

On mission Planner, you can set the ekf home position using the right button of the mouse.\

I’m not exactly sure if this is still necessary, but the EKF must set a home position before flying in Guided. This happens automatically when flying outside with a GPS, but maybe not if flying with optical flow.

Another post: The copter does not takeoff in Guided mode and EKF_GPS_TYPE = 3 (optical flow) - #3 by dollop

But to reiterate, optical flow does not provide a velocity estimate on its own. You need a rangefinder with your optical flow sensor to estimate (and control) velocity.

maybe I am misunderstanding, and you don’t actually have a functional drone yet, and you’re asking a hypothetical question about if it is possible to command velocity with Ardupilot in an GPS-denied environment using optical flow.

The answer can be simply found by searching : Search results for 'optical flow guided' - ArduPilot Discourse

Thanks for helping.
Actually I have a fully functional drone but before making any customisation on that I am willing to test if everything works fine in Gazebo Simulation Environment.

1 Like

Hi
So i am addressing the problem from the start and
regarding the “GUIDED_NOGPS” as per the documentation it only accept attitude target as per link Guided Mode — Copter documentation defined in this mavlink message Messages (common) · MAVLink Developer Guide.

Solution-1: So you have to calculate the attitude targets to make the drone move to desired location in (I have no idea about this support in mavros)

Solution-2: You can set the "set Home Here → set EKF origin here " as per this link Non-GPS Navigation — Copter documentation to set the global position origin manually and then you can set the drone in “Guided” mode and use mission planner to make the drone “Fly to here” to test (Give it a very short way-point to test) .

Remember : The global heading and local heading may not align so give the way-point in the same direction drone is facing in Mission planner.
Sources :
1-> HOW TO SET EKF ORIGIN : https://www.youtube.com/watch?v=YZm6bmGDB5U
2-> Autonomous flight (Indoor Guided Mode) : https://www.youtube.com/watch?v=Gqja_gBFBuA

The system should work with optical flow as well i havent tested the same in much detail but it should work.

Caution : Do not use the compass indoor (You may experience a rotation in drone due to interference). But you can give it a try be careful. if you have different heading system then its okay.

I havent seen your logs just proving a solution on how you can use guided mode indoor.

1 Like

A company or community uses QR code as map (Aruco marker) with a companion computer to navigate indoor. Some maybe interested to find it out more.

Maybe mavsdk is something worth looking at.