3

How do I command Arducopter to enter guided_nogps mode? I am planning to operate in a gps denied environment, and although other posts indicate this is possible with guided-nogps, I cannot see how to set that mode. Using Dronekit (python) vehicle.mode = VehicleMode("Guided_NoGPS") returns an error indicating there is no such mode.

Mavlink also refuses to acknowledge the mode.

My setup is a Pixhawk running Arducopter with a Raspberry Pi companion. Firmware is v3.5 dev, and v3.4 on the DroneKit-SITL (I compiled my own v3.4 binary for this).

Everything else is working great (e.g. controlling via set_attitude_target thanks to this post How to set copters Attitude via DroneKit -- SET_ATTITUDE_TARGET not working ) - I just need to be able to go indoors!

Also - I did notice in this post prior to the release of Arducopter v3.4 Controlling movement without GPS that an optical flow sensor might be required. Did that requirement come to pass?

Thanks again!

All advice welcome.

Thanks Squilter for your help. I created a function to change the flightmode (20):

def set_mode(flightmode):
# create the MAV_CMD_DO_SET_MODE command
msg = vehicle.message_factory.command_long_encode(
    0, 0,    # target system, target component
    mavutil.mavlink.MAV_CMD_DO_SET_MODE, #command
    0, #confirmation
    flightmode,
    0, 0, 0, 0, 0, 0 )
# send command to vehicle
vehicle.send_mavlink(msg)

The message is correctly received but was not successful (result 3 returned). One thing I wasn't sure about was parameter 2, which the spec indicates is platform specific. I put 0 as I wasn't sure what to do with it for Arducopter.

Again, any suggestions welcome and many thanks!

Community
  • 1
  • 1
M Isted
  • 31
  • 1
  • 4
  • This is an unfortunate inconsistency with mavlink devices. Some devices change their mode with a `MAV_CMD_DO_SET_MODE` packed into a `command_long` . For ArduCopter, however, you must send a `SET_MODE` message. – squilter Dec 01 '16 at 20:05

2 Answers2

1

Try setting the mode to 20. This is the internal representation of the mode. It looks like dronekit-python does not know this yet.

Optical flow is required for normal guided mode, not guided_nogps. However, guided_nogps does not allow sending velocity or position requests, only angles.

squilter
  • 400
  • 1
  • 6
  • Thanks for this. I have tried setting the mode to 20. The console is giving the correct command_ack code, but the result is 3, which I believe means it was not successful. Here is my function: – M Isted Nov 30 '16 at 22:40
  • I'll add my function above. – M Isted Nov 30 '16 at 22:42
0

I know that this question is a little old but I have found the answer. Update your installs of MAVProxy and PyMAVLink.

pip install -U pymavlink mavproxy

DroneKit will automatically install older versions of them without the new modes available. You want PyMAVLink >= 2.2.4 and MAVProxy >= 1.6.1.