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.
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)
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.
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.
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.
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) .
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.