Comments (35)
I ended up doing something like this, not sure if that would help your case:
# When mavsdk_server, which runs separately, crashes, we need to redo all
# mavsdk subscriptions. To do so, it's easiest just to restart this app
# entirely. We can detect that mavsdk_server has restarted by reading through
# the# aiogrpc.utils logs. Unfortunately, I didn't find a better way to catch
# this case.
class ErrorLogHandler(logging.Handler):
def emit(self, record):
log_entry = self.format(record)
if "grpc exception" in log_entry and "StatusCode.UNAVAILABLE" in log_entry:
print("Triggering restart due to gRPC failure.")
loop = asyncio.get_event_loop()
loop.stop()
aio_logger = logging.getLogger("aiogrpc.utils")
aio_logger.addHandler(ErrorLogHandler())
from mavsdk-python.
Digging further, it seems the error is thrown (raised) internally as wrapping the whole code in a try...except block doesn't catch it.
from mavsdk-python.
I have seen similar annoying exceptions when using it more recently.
Can you run mavsdk_server separate and check whether it doesn't crash or lockup?
from mavsdk-python.
I have seen similar annoying exceptions when using it more recently.
Can you run mavsdk_server separate and check whether it doesn't crash or lockup?
That's what I am doing. I am using windows which means I have to start the server process right before each connection:
async def start_mavsdk_server(connection_url: str, port: int):
cmd = [resource_path('include/mavsdk_server.exe'), "-p", str(port), connection_url]
mavsdk_server_process = Popen(
cmd,
stdout=PIPE,
stderr=PIPE,
universal_newlines=True,
start_new_session=True,
)
return mavsdk_server_process
Still raises the exception
from mavsdk-python.
I ended up doing something like this, not sure if that would help your case:
# When mavsdk_server, which runs separately, crashes, we need to redo all # mavsdk subscriptions. To do so, it's easiest just to restart this app # entirely. We can detect that mavsdk_server has restarted by reading through # the# aiogrpc.utils logs. Unfortunately, I didn't find a better way to catch # this case. class ErrorLogHandler(logging.Handler): def emit(self, record): log_entry = self.format(record) if "grpc exception" in log_entry and "StatusCode.UNAVAILABLE" in log_entry: print("Triggering restart due to gRPC failure.") loop = asyncio.get_event_loop() loop.stop() aio_logger = logging.getLogger("aiogrpc.utils") aio_logger.addHandler(ErrorLogHandler())
Would try adding this to my event generator and seeing if it helps 👍. Does this restart the entire app or just the mavsdk server? Due to the nature of sockets, restarting the entire app would pose an issue due to socket client behaviour.
Would I also need to restart mavsdk server manually after stopping the event loop?
from mavsdk-python.
Related Issues (20)
- goto_location() unsupported error HOT 3
- How to use Param_server and Action_server HOT 5
- health.is_global_position_ok with Ardupilot HOT 18
- handling ActionError HOT 2
- getting mavsdk version HOT 5
- RuntimeError: aclose(): asynchronous generator is already running
- System.connect with time out HOT 3
- Running mavsdk server on Windows HOT 4
- How to manual control
- Unable to start a mission a second time HOT 3
- How to detect offboard command completion HOT 3
- One `mavsdk_server`, multiple drones HOT 2
- install mavsdk on py zero HOT 6
- "import_qgroundcontrol_mission_from_string" function not parsing the altitude correctly HOT 1
- drone.info.get_version() INFORMATION_NOT_RECEIVED_YET HOT 8
- FILE_DOES_NOT_EXIST on calling the drone.ftp.list_directory() to fetch internal directories file HOT 13
- The use of drone.offboard.set_position_ned HOT 9
- Unable to upload rally_items through MAVSDK HOT 10
- Error when uploading mission: INVALID_PARAM1 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mavsdk-python.