I am trying to connect to my blueROV2 running BlueOS with the Navigator upgrade. I was previously able to connect to the Pixhawk on the BlueROV2 before upgrading to the Navigator, but I am having trouble figuring out which UDP port to try and access.
I am using the add_any_connection() method in mavsdk and I have tried many different udp ip and ports and cannot consistently get it to find a system that I can use mavsdk on.
This is what I currently have for endpoints. I am running this code off the raspberry pi on the blueROV2 itself. Do I need to setup another endpoint or am I just misunderstanding what ip/port to use based on the ones in the picture?
If there is a simpler way to access mavlink messages through mavsdk on the raspberry pi instead of using udp, please let me know. My desire to use the raspberry pi to run my controls code stems from trying to remove as many connections as possible between me and the sensors themselves. I experienced data drop out consistently when I tried to connect to my pixhawk via serial and use mavsdk on my last robot setup
Hi @cmarq -
The Navigator paradigm is much different than the Pixhawk, as ArduRover/ArduSub actually runs in a Docker container on the Pi, with the Navigator shield only providing IMU and outputs.
If your computer has been configured to have a static IP of 192.168.2.1, then you should have a connection in QGroundControl and be able to open mavsdk (I’m not familiar with this tool.)
If you’re using a different static IP then what we recommend, you’d need to add that as a client UDP mavlink endpoint.
So mavsdk is a way to interact with the system running Ardupilot (or a subset of it). Previously, I connected a jetson nano to the Telem2 port of the pixhawk and was able to use MAVSDK to read mavlink messages and send actuator commands over the serial link.
Since moving to a raspberry pi/navigator setup, I want to reimplement this type functionality so I can provide my own custom controls code. I originally was thinking that I may use the navigator-lib library to get the sensor inputs and do all the work myself, but I cannot find a way to get my waterlinked-dvl data through the navigator api. If you have information or help on that, I could try just removing ardupilot the workflow and use the navigator api directly. Do you think this is more reasonable that trying to communicate with ardupilot?
If you feel ardupilot is still the best option (i would not have to write my own estimation code), then what would be the most reasonable ip/port to try and connect? Does ardupilot running in the docker container have a setup client where I could connect from the raspberry pi itself? I am not as familiar with the limitations of docker containers
Hi @cmarq -
If you’re trying to control actuators, a lua script may be the best approach?
Waterlinked-DVL data shoud be available on the Mavlink2Rest interface, see if you can find anything under the list of data found under Available Services in BlueOS.
You can connect from code running on the Pi to the Ardupilot instance with a Mavlink Endpoint configured for local access, as is done with pymavlink.
It would be easier to provide guidance with a better idea of what you’re trying to accomplish in your application!
The goal of the application is to override the control of the blueROV2 by putting it in manual control mode, getting the state information from ardupilot, calculating control inputs in my custom code and sending the control inputs to the actuators in real-time to follow a desired trajectory. This is for research and testing of an optimal control algorithm.
I am essentially looking for the best way to make this happen. I am not sure a lua script would give the real-time functionality I’m looking for (correct me if I’m wrong). If the data is under the mavlink2Rest interface, do you think it would be a better approach to poll the data from there? My worry would be the lag in acquiring data from mavlink2rest and then sending control commands back
I can try using udpout//:0.0.0.0:9000 as in pymavlink. I have not tried that one yet
If I could add the ability to read the waterlinked-dvl to the navligator lib interface, that might allow me to get all my sensor data in one place and write my custom code there. Is that possible at all?
Hi @cmarq -
DVL data in Navigator Web Assistant is not going to be possible, I believe.
Is there a reason you can’t use ArduSub guided or auto mode to accomplish your goals?
Mavlink2Rest should not introduce any significant lag…
What sort of control commands are you hoping to send?
As far as I’m aware the guided or auto modes are going to calculate the controls using pid control that is embedded within ardusub.
I want to define my own desired states and calculate the control using more advanced algorithms like linear quadratic regulator or model predictive control. We’re already done this with the previous set up (Pixhawk), but still struggled with data dropout