ArduPilot / ArduPilot/MAVProxy

Land mode command doesn't work

Open
#167 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
595
Forks
773
Avg merge
2d 6h
Merged PRs (30d)
18

Description

Using SITL for some tests. I can set stabilize, loiter, auto,... from mavproxy command line.
When is enter "land" then the copter stay in current mode and refuse to go to land mode.
land is listed in the help while stabilize is not.
'mode LAND' works well from mavproxy command line.

Looking at the code I find for 'land'
in /usr/local/lib/python2.7/dist-packages/MAVProxy/modules/mavproxy_misc.py

```
def cmd_land(self, args):
'''auto land commands'''
if len(args) < 1:
self.master.mav.command_long_send(self.settings.target_system,
0,
mavutil.mavlink.MAV_CMD_DO_LAND_START,
0, 0, 0, 0, 0, 0, 0, 0)
elif args[0] == 'abort':
self.master.mav.command_long_send(self.settings.target_system,
0,
mavutil.mavlink.MAV_CMD_DO_GO_AROUND,
0, 0, 0, 0, 0, 0, 0, 0)
else:
print("Usage: land [abort]")
```

and I find in /usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py

```
def set_mode_flag(self, flag, enable):
'''
Enables/ disables MAV_MODE_FLAG
@param flag The mode flag,
see MAV_MODE_FLAG enum
@param enable Enable the flag, (True/False)
'''
if self.mavlink10():
mode = self.base_mode
if (enable == True):
mode = mode | flag
elif (enable == False):
mode = mode & ~flag
self.mav.command_long_send(self.target_system, self.target_component,
mavlink.MAV_CMD_DO_SET_MODE, 0,
mode,
0, 0, 0, 0, 0, 0)
else:
print("Set mode flag not supported")
```

Probably the difference explain why. Is there anybody who can finalize the investigation and provide the correction ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the problem in SITL, then read mavproxy_misc.py at cmd_land and pymavlink/mavutil.py at set_mode_flag to compare the land command with the working mode LAND command. Done means the land command successfully switches the copter into land mode and the relevant behavior is covered by the available SITL test flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.