How to use dronekit with SITL vagrant VM from Wiki developer

I follow the instructions to get started in DroneKit-Python to configure DroneKit in a virtual machine. To make it easier for myself, I started by setting up SITL with Vagrant . However, I cannot figure out how to run SITL and talk to him from the sample scripts.

What I've done:

  • Ran SITL vagrant script and got the SITL job (a verified connection to the Windows Mission Planner).
  • Tested as described in the section Setting up on Linux "by doing:

    param load ../ Tools / autotest / copter_params.parm

    parameter set ARMING_CHECK 0

NOTE. The MAVProxy prompt does not display the message "STABILIZE>". They ran (which turned out) successfully

  • Then I pressed Ctrl + D to exit the SITL simulation, and vagrant ssh until open my invitation to the virtual machine.
  • I installed the dependencies as described here (after fixing the pip specification):

    sudo apt-get install python-pip python-numpy python-opencv python-serial python-pyparsing python-wxgtk2.8

Then MAVProxy

 sudo pip install MAVProxy 

Then droneapi (note that should have been installed using "sudo")

 sudo pip install droneapi 

Then from the command line (vagrant @ vagrant-ubuntu-trusty-32: / vagrant / ArduCopter $) I got a git clone and went on to the demo:

 git clone http://github.com/diydrones/droneapi-python.git cd droneapi-python/example/small_demo 

I started MavProxy with "mavproxy.py" (the correct type for Linux VM being transferred over USB). Got the following:

 Auto-detected serial ports are: /dev/ttyS31 /dev/ttyS30 ... /dev/ttyS1 /dev/ttyS0 Logging to mav.tlog libdc1394 error: Failed to initialize libdc1394 

Finally, despite the error above, I tried to download and use the module.

 MAV> module load droneapi.module.api MAV> DroneAPI loaded Loaded module droneapi.module.api api start small_demo.py MAV> Exception in APIThread-0: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 322, in run self.fn() File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 593, in <lambda> APIThread(self, lambda: execfile(args[1], g), args[1]) ... 

NOTE "MAV>" is not indicated in "MANUAL"> as indicated in the documents.

Question: "Why did it fail, and what do I need to make it work?" I assume the problem is that SITL is actually not working.

Thanks!

+6
source share
1 answer

Starting with the new ardupilot code check in your host OS.

droneapi-python will be installed, but allows you to get sample scripts:

 ardupilot$ git clone http://github.com/diydrones/droneapi-python.git 

Lift the box of strollers:

 ardupilot$ vagrant up 

Run SITL as described in "Configuring SITL Using Vagrant" :

 ardupilot$ vagrant ssh -c "sim_vehicle.sh -j 2" 

There will be a lot of output, but in the end I see the following:

 + mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 10.0.2.2:14550 --out 127.0.0.1:14550 --out 127.0.0.1:14551 --cmd= Connect tcp:127.0.0.1:5760 source_system=255 Logging to mav.tlog libdc1394 error: Failed to initialize libdc1394 MAV> Init APM:Copter V3.3-dev (e1be8148) Free RAM: 4096 FW Ver: 120 ---------------------------------------- Firmware change: erasing EEPROM... done. 0 0 0 online system 1 STABILIZE> Mode STABILIZE APM: APM:Copter V3.3-dev (e1be8148) APM: Frame: QUAD APM: Calibrating barometer APM: Initialising APM... APM: barometer calibration complete APM: GROUND START Init Gyro** INS ---------------------------------------- G_off: 0.00, 0.00, 0.00 A_off: 0.00, 0.00, 0.00 A_scale: 1.00, 1.00, 1.00 Ready to FLY ublox Received 473 parameters fence breach GPS lock at 0 meters APM: PreArm: RC not calibrated 

Download the droneapi module. See "DroneKit Download" for information on how to do this automatically when you run mavproxy.

 STABILIZE> module load droneapi.module.api STABILIZE> DroneAPI loaded 

Run DroneKit small_demo.py script :

 STABILIZE> api start ../droneapi-python/example/small_demo/small_demo.py 

Output:

 STABILIZE> Mode: VehicleMode:STABILIZE Location: Location:lat=-35.3632609,lon=149.1652299,alt=-0.280000001192,is_relative=False Attitude: Attitude:pitch=-0.0046319803223,yaw=-0.571676075459,roll=-0.00480426847935 Velocity: [0.11, -0.06, -0.06] GPS: GPSInfo:fix=3,num_sat=10 Armed: False groundspeed: 0.0 airspeed: 0.0 Requesting 0 waypoints t=Fri May 1 02:18:50 2015 now=Fri May 1 02:18:50 2015 Home WP: MISSION_ITEM {target_system : 255, target_component : 0, seq : 0, frame : 0, command : 16, current : 0, autocontinue : 1, param1 : 0.0, param2 : 0.0, param3 : 0.0, param4 : 0.0, x : -35.3632621765, y : 149.165237427, z : 584.33001709} Current dest: 0 Disarming... Arming... Overriding a RC channel Current overrides are: {'1': 900, '4': 1000} RC readback: {'1': 1500, '3': 1000, '2': 1500, '5': 1800, '4': 1500, '7': 1000, '6': 1000, '8': 1800} Cancelling override APIThread-0 exiting... Got MAVLink msg: COMMAND_ACK {command : 400, result : 0} APM: PreArm: RC not calibrated Got MAVLink msg: COMMAND_ACK {command : 400, result : 4} Got MAVLink msg: COMMAND_ACK {command : 11, result : 0} AUTO> Mode AUTO 
+1
source

Source: https://habr.com/ru/post/984546/


All Articles