Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Autopilot component #97

Open
3 of 4 tasks
podhrmic opened this issue Jul 22, 2024 · 10 comments
Open
3 of 4 tasks

[FEATURE] Autopilot component #97

podhrmic opened this issue Jul 22, 2024 · 10 comments
Assignees
Labels
application software application software components SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications.
Milestone

Comments

@podhrmic
Copy link
Collaborator

podhrmic commented Jul 22, 2024

Summary

The autopilot component executes the mission and is the Flight controller for the platform. The autopilot runs as a Linux process (so called SITL target).

Acceptance Criteria

Develop an autopilot component, and integrate it with the rest of the OpenSUT. Specifically:

  • Build the Ardupilot Plane SITL target (docs here)
    • locally and in the CI (consider caching the resulting binary)
  • The ardupilot binary needs to be run separately from the supporting infrastructure, as we cannot use the provided SITL scripts
    • QGC runs either in a docker, or natively
    • the JSBSim simulation environment can run in a separate docker container or on the base platform, such that the senors data are provided
    • the appropriate TCP/UDP ports need to be exposed in the containers and connected together (use docker compose?)
  • @spernsteiner a separate mavlink channel needs to be open for communication with the rest of the OpenSUT
    • this can be handled either by modifying the SITL target to have this secondary telemetry
    • or by routing the telemetry through a filter that can re-route / inject additional messages (maybe with MavProxy)
  • demonstrate that a user can start the autopilot, QGC and upload a flight plan and execute the mission.
@podhrmic podhrmic added application software application software components SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications. labels Jul 22, 2024
@podhrmic podhrmic added this to the MVP 3 milestone Jul 22, 2024
@podhrmic
Copy link
Collaborator Author

podhrmic commented Sep 6, 2024

@spernsteiner you can use docker image ardupilot/ardupilot-dev-chibios-clang to build Ardupilot SITL plane or copter targets

@spernsteiner spernsteiner mentioned this issue Sep 10, 2024
7 tasks
@spernsteiner
Copy link
Contributor

QGC runs either in a docker, or natively

Is it important that we test with QGroundControl specifically? MAVProxy has some basic ground station functionality built in, sufficient for uploading a flight plan and monitoring the vehicle's progress.

the JSBSim simulation environment can run in a separate docker container or on the base platform

Is it important that we use JSBSim instead of ArduPilot's built-in simulation model?

a separate mavlink channel needs to be open for communication with the rest of the OpenSUT

What sort of MAVLink clients to we expect to add in the future? Are there any particular types of telemetry they'll need to receive, or particular commands they may need to send to the autopilot component?

@podhrmic
Copy link
Collaborator Author

Is it important that we test with QGroundControl specifically? MAVProxy has some basic ground station functionality built in, sufficient for uploading a flight plan and monitoring the vehicle's progress.

MavProxy can be used as well, for our purposes there is not much difference.

Is it important that we use JSBSim instead of ArduPilot's built-in simulation model?

I think it is easier to use JSBSim to separate the simulator from the autopilot (see the diagram here), because we don't want the simulation model to be a part of the VM, but run in the base platform/external computer instead. JSBSim also integrates nicely with FlighGear for rendering (nice visuals), and we can swap the flight models later (more flexibility). So unless there is a significant blocker, I would prefer JSBSim over the built-in model.

What sort of MAVLink clients to we expect to add in the future? Are there any particular types of telemetry they'll need to receive, or particular commands they may need to send to the autopilot component?

Most likely it will be a system logger, recording some basic telemetry from the autopilot (takeoff, landing etc). Probably no autopilot commands at this point (but we should have the option to support all common messages)

@spernsteiner
Copy link
Contributor

we don't want the simulation model to be a part of the VM, but run in the base platform/external computer instead

Having separate JSBSim would also make it easier to get engine temperature/pressure data (or any other measurements) to feed to MPS.

Currently I'm working on separating JSBSim from arduplane so they can be run on different (virtual) machines. arduplane's JSBSim integration is set up to spawn JSBSim as a child process of arduplane, and I think it may also be making some assumptions about having near-zero latency on the arduplane<->JSBSim connection due to connecting to localhost.

@spernsteiner
Copy link
Contributor

With GaloisInc/verse-ardupilot#1 and #111, I've gotten arduplane in the guest VM to use a JSBSim instance on the base system as the simulator. This works (MAVProxy shows the plane flying the example mission as expected), but the simulation is very slow - I would estimate 5x-10x slowdown compared to native speed. The built-in --model plane simulator doesn't show this slowdown, so my guess is that it's due to the high overhead of VM I/O operations when sending data to or from the simulator. I'm planning to experiment with the simulation rate and network settings to see if I can get it to run at a more reasonable speed.

@spernsteiner
Copy link
Contributor

After adjusting the simulation rate and some arduplane parameters, the autopilot and simulator now run at close to full speed in the VM setup. It seems like some of the autopilot parameters are tuned to the old update rate, so it has trouble controlling the plane in this configuration, but after tweaking NAVL1_PERIOD, it seems to fly and completes the example mission without going too far off course.

Next, I'm planning to write some scripts to run the complete autopilot/simulator VM setup.

@spernsteiner
Copy link
Contributor

With #110 and #111 merged, I'm now working on scripts to make it easy to run the autopilot in the OpenSUT configuration. The first piece of this is #112; the rest is in progress on the 97-jsbsim-scripts branch. The vm_runner configs for running the autopilot are mostly done, but I still need to finish the scripts for running JSBSim and MAVProxy on the base system.

@podhrmic podhrmic self-assigned this Nov 8, 2024
@podhrmic
Copy link
Collaborator Author

podhrmic commented Nov 8, 2024

@podhrmic review the autopilot, depends on #96

@spernsteiner
Copy link
Contributor

I checked off "Build the Ardupilot Plane SITL target" (done in #110) and "The ardupilot binary needs to be run separately from the supporting infrastructure" (done in #111 and #122).

I also tried connecting MAVProxy to the secondary port that Ardupilot opens by default (port 5762, instead of the default 5760). It showed all the same position and status information as when MAVProxy is connected to the main port, so it seems to be receiving telemetry. Based on these results, I checked off "a separate mavlink channel needs to be open for communication with the rest of the OpenSUT".

@podhrmic
Copy link
Collaborator Author

podhrmic commented Nov 8, 2024

Great. I have the base image built, so hopefully I can check off the last box soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application software application software components SoW TA2.1.1.A Develop the Open SUT primarily using existing components and specifications.
Projects
None yet
Development

No branches or pull requests

2 participants