Skip to content

DKPY2 Can't clear waypoints #355

Closed
Closed

Description

@hamishwillee

The following test code returns and error that AttributeError: MPFakeState instance has no attribute 'vehicle' when I try to access Vehicle.commands.clear. Actually downloading of commands and reading home location works fine.

Test code:

from dronekit import connect
import time
import math
from dronekit.lib import VehicleMode, Location, Command
from pymavlink import mavutil


#Set up option parsing to get connection string
import argparse  
parser = argparse.ArgumentParser(description='Print out vehicle state information. Connects to SITL on local PC by default.')
parser.add_argument('--connect', default='127.0.0.1:14550',
                   help="vehicle connection target. Default '127.0.0.1:14550'")
args = parser.parse_args()

# Connect to the Vehicle
print 'Connecting to vehicle on: %s' % args.connect
vehicle = connect(args.connect, await_params=True)

cmds = vehicle.commands
cmds.download()
cmds.wait_valid()

print "About to test clear"
vehicle.commands.clear()
vehicle.flush()
print "Clear succeeded"

Output of test code

About to test clear
Traceback (most recent call last):
  File "E:\deleteme\dronekit-python\examples\mission_basic\test_mission_clear.py", line 29, in <module>
    vehicle.commands.clear()
  File "build\bdist.win-amd64\egg\dronekit\module\api.py", line 95, in clear
AttributeError: MPFakeState instance has no attribute 'vehicle'

This causes the mission_basic.py and flight_replay.py examples to fail in dkpy2.0

Activity

  1. hamishwillee commented on Oct 21, 2015

    @hamishwillee
    ContributorAuthor

    @tcr3dr When you have time, I've marked this as urgent because it breaks two examples.

  2. added a commit that references this issue on Oct 22, 2015
  3. tcr3dr commented on Oct 27, 2015

    @tcr3dr
    Contributor

    See #374 for the fix.

  4. hamishwillee commented on Oct 27, 2015

    @hamishwillee
    ContributorAuthor

    @tcr3dr Thanks - agreed fixed. Unfortunately now we can't upload waypoints - see #376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions