I have been following this article..
What I have done so far:-
- I have connected pixhawk with Rpi and configured everything as told in the article
2)I have installed mavproxy on Rpi - and it works fine as shown below
3)I have successfully install Mavlink-router
4)I have successfully install dronekit on both raspberry pi and windows.
5) I have installed dronekit_sitl on windows
6) I have mission planner on windows
What I have now is :-
ip address of my windows-192.168.0.143
2)ip address of my Rpi-192.168.0.170
3)Here is my mavlink-router/main.conf file
What I have understood until now is that, I can run simulator ( dronekit_sitl) on mission planner windows for my (raspberry pi + pixhawk)—> Please correct me If I am wrong here.
For this I run dronekit-sitl on windows as shown below:-
Now , I ran mavproxy on raspberry pi as shown below
The blue underline in the photo is the ip address of the windows which 192.168.0.143 (port is 14550 - as set on mission planner)
At this stage I have successfully connected mission planner working on windows and (Raspberry pi+pixhawk)
As shown in the photo below:
Left side is the Mission planner and the right side is Putty(connected to raspberry pi via ssh)
Now , I want to do simulation(on mission planner) via python script running in raspberry pi.
In the documentation we have two python Api
from dronekit_sitl import SITL sitl = SITL(path=apm) # load a binary path (optional) sitl.download(system, version, verbose=False) # ...or download system (e.g. "copter") and version (e.g. "3.3") sitl.launch(args, verbose=False, await_ready=False, restart=False) sitl.block_until_ready(verbose=False) # explicitly wait until receiving commands code = sitl.complete(verbose=False) # wait until exit sitl.poll() # returns None or return code sitl.stop() # terminates SITL
import dronekit_sitl sitl = dronekit_sitl.start_default() # basic ArduCopter sim connection_string = sitl.connection_string() . . sitl.stop() # terminates SITL
Now whenever I run the following script on my raspberry pi .
print("Start simulator (SITL)") import dronekit_sitl sitl = dronekit_sitl.start_default() # ==>>>> Error is shown at this line #connection_string = sitl.connection_string() connection_string = "tcp:192.168.0.143:5760" # Import DroneKit-Python from dronekit import connect, VehicleMode # Connect to the Vehicle. print("Connecting to vehicle on: %s" % (connection_string,)) vehicle = connect(connection_string, wait_ready=True) # Get some vehicle attributes (state) print("Get some vehicle attribute values:") print(" GPS: %s" % vehicle.gps_0) print(" Battery: %s" % vehicle.battery) print(" Last Heartbeat: %s" % vehicle.last_heartbeat) print(" Is Armable?: %s" % vehicle.is_armable) print(" System status: %s" % vehicle.system_status.state) print(" Mode: %s" % vehicle.mode.name) # settable # Close vehicle object before exiting script vehicle.close() # Shut down simulator sitl.stop() print("Completed")
The error shown is as follows
At this point I understood that I cannot run SITL on raspberry pi. But then how shall I run SITL on windows on same network?
Please correct me. I want to know how to connect (Rpi+Pixhawk) and use dronekit -sitl with windows.
I am a beginner. Sorry for any mistake .
I have edited the question.