Mavproxy + mission planner + dronekit with no companion computer - python

I’m trying to connect mavproxy, mission planner and dronekit to my hexa.
i am not using a companion computer my setup is as follows:
i have a pc running windows for mission planner and on that same pc im running a virtual machine with ubuntu 16.04 running dronekit and mavproxy.
first I'm running mavproxy and forking out 2 connections, 1 for mission planner and one for dronekit with the following code:
mavproxy.py --master=/dev/ttyUSB0(I'm telling mavproxy to use the serial which the telemetry dongle is connected to) --baudrate=57600 --out=127.0.0.1:14551(ip address on my virtual ubuntu) --out=10.0.0.7:14550 (IP for my windows machine)
I am able to connect to the drone in mission planner via the UDP at port 14550. and I am able to send commands via mavproxy console such as change modes/arm etc.
my problem is when I execute my connect script from dronekit to connect to the drone I'm getting a timeout error.
the code
from dronekit import connect, VehicleMode, LocationGlobalRelative
import time
import argparse
parser = argparse.ArgumentParser(description = ‘commands’)
parser.add_argument(’–connect’)
args =parser.parse_args()
connection_string = args.connect
vehicle = connect(connection_string ,wait_ready=True)
when I open a new terminal I run the command to launch and connect drone kit
python connect.py --connect 127.0.0.1:14551
once I run this it gets stuck and after 30 seconds I get the following output:
dronekit.TimeoutError: wait_ready experienced a timeout after 30 seconds.
sometimes I get the following output:
gcs failsafe cleared
and then it gets stuck and after 30 seconds:
dronekit.APIException: Timeout in initializing connection.
I searched for about 3 days for solutions and tried everything that is out there pretty much, such as telling dronekit to wait longer than 30 seconds, but still, I get the same error.
I updated dronekit to the latest version, updated pymavlink and pyserial. also downgraded them to check if it will solve this but nothing works.
my main question is: is this error happening because dronekit can only run on a companion computer? and is not built for connecting threw telemetry radio?
if not, what am I doing wrong?
I sincerely am lost and praying that someone can help me.
thanks in advance. I would literally pay someone for a solution.
and again, sorry for the double post.

Related

Random WinError 10060 when trying to connect to websocket

Background - using a windows machine, Windows 10/11, connected to the internet through ethernet cable. Using python's websocket-client module, on pycharm.
Problem - one fine day, out of the blue, I am no longer able to connect to FTX's websocket wss://ftx.com/ws/ on my local windows machine and kept getting the error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I tried on my VPS, a linux machine, with the same exact code and it works fine.
Attempts to fix the problem were:
A full reformat of computer, windows 10 > windows 10, and reinstall python 3.10 and pycharm.
Then upgrading windows 10 > windows 11.
Made sure all drivers are up to date, and also reinstalling them.
Resetting network settings from Windows
Tested the websocket connection with other end point and it worked fine. eg wss://api.gemini.com/v1/marketdata/BTCUSD
None of the above worked.
My websocket connection is in a while loop something like this
while True:
try:
ws.run_forever()
time.sleep(0.2)
except:
pass
So it would keep retrying.
There was a weird behavior when, from windows, I disable, and re-enable the network adapter, the websocket connection would suddenly be successful. And if I were to disable and re-enable the network adapter again; sometimes it would continue to fail, or sometimes the connection would be successful again. Note this is while the code is still executing in the while loop.
And, if I were to stop and re-run the code, it would never work, and the error WinError 10060 would arise.
At this point I am stumped and have no clue how to solve this problem as it was totally random and out of the blue. Looking for help and advise please..!

Linux to Windows in CLI with Python

I recently discovered PyWinRM module which enables me, from a Linux machine, to establish a session with a 2008/2012 Server machine and then send DOS cmds, cmdlets and scripts to be executed remotely, collecting data and working with.
Example of PyWinRm usage:
# Establishing session
s = winrm.Session('server',auth=('user','password'),transport='ntlm')
# Script and run
script="""dir"""
r = s.run_cmd(script)
I have now, to find another solution, because my boss wants me to do the same, but with some 2000 and 2003 Servers machines (yeah, 2000 still exists for the moment in certain corporates).
I looked over the internet and the main reason, I think, is the absence of WinRM in earlier version of Win Server.
Which solutions would you suggest, provided that I can't install anything but python modules ?

flask server on raspberry pi stopped responding

I set up a flask server on my raspberry pi and set up a crontab to start the server on reboot. It was working fine for a while, for the past couple of days it stopped responding even after I rebooted the pi.
It seems like that the server is running because when I ssh in and try to run another server it says that the address is already in use.
Any ideas why my server is not responding anymore?
also, this may or may not be related but when I typed crontab -e I got the following error:
/tmp/crontab.Qqy98c: No space left on device
Creation of temporary crontab file failed - aborting
Address is already in use error indicates that some process is occupying the host/port that your Flask application is trying to use.
To resolve this problem, find out which processes are running on that port, then kill them. For example, if you use the default setting of port 5000, you can do the following in the terminal:
lsof -i:5000
This will show you the process that's running on port 5000 -- Take note of the process id. Let's say it's 12345 for example.
kill 12345
This should free up the address, allowing the Flask application to launch normally.
The error No space left on device Creation of temporary crontab file failed should be somewhat self-explanatory. If you're running so low on file space, you should strongly consider clearing up space. Otherwise, you're bound to run into all kinds of problems.

Python Auto-Start pyGSM Huawei

I have a python script which uses pygsm as the library for sending and receiving sms. However, I wish to put this script on auto-run upon booting up the raspberry pi. But the connecting time of the huawei modem usually takes a while, hence causing the shell script to skip the step. How do I make it so that it would confirm that it is connected to perform the python script?
This is not a python-related question, try a linux forum on boot sequence timeout

Local Chromecast receiver not loading

I am developing a Chromecast app and currently host it locally for development purpose.
It used to work fine when I had an internal ip set as my receiver url (http://192.168.1.167:9000/receiver.html) and hosted a server on my Windows machine using
python -m http.server 9000.
Now my laptop broke and I'm working on a mac mini (also because i was going to develop an iOS sender app for my receiver anyway) so I'm trying to get the receiver hosted on the mac mini.
I'm using the same principe, internal ip of the mac-mini set as receiver url, started a server using
Python -m SimpleHTTPServer 9000.
When I try to connect to my receiver, I can't get it to load.
The Chromecast displays:
Cannot load sources (or some other english equivalent of my dutch error: 'De bronnen kunnen niet geladen worden'.)
I forwarded a port in my router to my receiver and I can reach it from outside my own network (mobile 4g), I can reach it internally, colleagues can reach it, it's just the Chromecast which somehow refuses to load the page and I can't figure out why.
The Android SDK gives me CastStatusCode.CANCELED and iOS SDK GCKErrorCodeCancelled.
I also tried to update Python to the latest version, but it didn't fix it.
The Chromecast loads other apps fine, I can ping to the Chromecast and to my devices. When the Chromecast attempts to load the app, I can briefly load the debugger but it doesn't display anything in either network or console.
I hope someone has had a similair issue or any clue on how I can get the Chromecast to connect to my server again.
Of all the things i tried the last couple of hours, I didn't think of the basic 'Have you tried rebooting it'....
Cause was firmware update...

Categories

Resources