2

I managed to run examples in command prompt after running mavproxy.py and loading droneapi. But when I double click on on my script, it throws me "'local_connect' is not defined", it runs in terminal as was told above, but I cannot run it only with double click. So my question is: Is there any way to run script using droneapi only with double click?

using Windows 8.1

Thanks in advance

Sony Nguyen
  • 103
  • 1
  • 1
  • 4

3 Answers3

1

You'll want to look at the Running an App/Example section of the guide. For now, you can only run a DroneKit script by launching it from inside the MAVProxy terminal. For example, after launching:

$ mavproxy.py --master=127.0.0.1:14550
MANUAL> module load droneapi.module.api
 DroneAPI loaded

You can use the api start command to run a local script:

MANUAL> api start vehicle_state.py
STABILIZE>

 Get all vehicle attribute values:
  Location:  Attitude: Attitude:pitch=-0.00405988190323,yaw=-0.0973932668567,roll=-0.00393210304901
  Velocity: [0.06, -0.07, 0.0]
  GPS: GPSInfo:fix=3,num_sat=10
  groundspeed: 0.0
  airspeed: 0.0
  mount_status: [None, None, None]
  Mode: STABILIZE
  Armed: False
Tim Ryan
  • 96
  • 3
1

I think Sony Nguyen is asking for running the vehicle_state.py outside the Mavproxy command prompt, just like runnning the .py file normally.

I'm also looking for a solution as well.

Thuy
  • 11
  • 1
1

You can only run dronekit from mavproxy at the moment (its structured as a mavproxy module, there are plans to restructure it), however if you simply want to avoid having to load up MavProxy and then running code manually, you can use the cmd flag:

mavproxy.py --cmd="api start app.py"
alexdavey
  • 672
  • 1
  • 9
  • 15