-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
FlightGear simulator support #14539
FlightGear simulator support #14539
Conversation
This is really cool! Although, I do think it makes mores sense that the flightgear_bridge is a repository by itself and that it gets included as a submodule here, similarly to sitl_gazebo and jMavSim. |
Great contribution! |
@TSC21 I think it's really a question of it being worth maintaining as a standalone project or not. |
I think the maintenance effort of something like this is independent if it is on a tree or not. It's more about the commitment to actually maintain it. And that needs to be the same being it on the Firmware tree or not. I just see this being much more organized by being included in its own repo with its own structure and then having it included here as a submodule. I would expect the CI pipeline for it to be relatively easy to setup. |
I love flight gear! |
At first thank you for extremly fast reaction. How does it work:
There are few limitation, problems, and possible improvements:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! Thanks!
My concern is that FlightGear only seems to support a subset of the models, but this case is not handled.
set(debuggers none ide gdb lldb ddd valgrind callgrind) | ||
set(models none shell | ||
if750a iris iris_opt_flow iris_opt_flow_mockup iris_vision iris_rplidar iris_irlock iris_obs_avoid iris_rtps solo typhoon_h480 | ||
plane plane_cam plane_catapult | ||
TF-G1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the rest of the models are using small case and underscores, could we change this? Maybe tfg1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it at least possible to leave it at tf_g1
? Full name of that UAV is ThunderFly TF-G1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about tf-g1
? I suggest it because in other models in list underscore is used to denote the model variant. But the full name of our model is TF-G1 including the hyphen. (There are much more models in development including TF-G2, TF-G3.. etc.) The letter case does not matter for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to tf-g1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaklik are you open that we create a repo under the PX4 org called PX4-FlightGear-Bridge, where you can push the bridge side and then include it here as a submodule? It's being seen as the correct architectural approach.
Okey. We will move the bridge there. But still remains the problem with cmake scripts and simulator LockStep and lists of supported vehicles per simulator. Any Idea? |
We can solve that step by step. As far as I can tell this is WIP. |
Okey, I will prepare this step tomorow. |
This is cool. When this is done, we'll need some docs for environment setup, what is supported, how to use. In the first instance, probably just a page like - http://dev.px4.io/master/en/simulation/gazebo.html but with setup information for different OS. For reference, these are the main touchpoints for different platform setup docs/simulation: |
Ok, my opinion is that the best and easier way how to achieve this is the following: We create a new repo named PX4-FlightGear-Bridge under our organization. You can immediately fork that repository in the PX4 organization. Then we make pull-request or you itself should make a submodule link to your Firmware repository. |
I don't see where that is easier: that will basically result in two more repositories to maintain, one by you and you only, and another (the PX4 fork) to be maintained by you and us. I think it is preferable that this is under an org where the maintenance responsibilities can be shared. Regarding the submodule - that needs to be something part of this PR, so I ask you to do that yourselves. I will create the repo tomorrow and give you both write access to it (if I am able to, otherwise it will have to be someone with admin previlieges in the PX4 org). Then you can push the bridge there, if you agree. |
I see the pro and cons of both ways. For us is mandatory to have multiple users access to the repository because few relatively random developers could experiment on branches in our repo. Therefore we probably could not avoid having a separate copy of that repository under our organization where we have privileges under our control. The main problem which could emerge additionally from the fork of our repository to PX4 organization is the unclear location of the upstream repo for third party contributors. But it should be resolved by submodule path pointing to your fork of the repository under the PX4 organization. I saw you have some repositories included as a submodule in that way. The jMAVSim is one example. |
@kaklik I just took a look at your repo and seems that we might have a licensing issue, since you use GPL license and the PX4 ecosystem overall uses BSD-3clause or compatible. I am not sure we can include it as a submodule that way. |
In last few commits I tried to solve problem with lockstep disabling for flightgear-bridge. I created a new label for px4_sitl board, which is copy of default, but disables lockstep of simulation. I think, that gazebo and jMAVSim can work correctly without any other modification only if lockstep is enabled. Is it correct? (and I fixed build of external project, after migration into module) |
@slimonslimon @kaklik are you planning to update your repo's license or not? I think you are ignoring something that truly signifies a Go or No-Go regarding this PR. |
@TSC21 I'm trying ti solve building and running problems these days. I'm a programmer not a lawyer. I dont know much about licencnces. I think @kaklik will change licence as soon as he have time. |
@kaklik @slimonslimon It is really cool that you are improving the flight gear integration. However, could we freeze this branch and do squash /cleanups so that we can merge this branch? |
@Jaeyoung-Lim, yesterday we spend lot of time, by debuging the FG connection, but the result is, that problems are probably not in bridge but in FG. ( Flight gear is not so good :-( ). I will do the squash of commits at this weekend. |
@kaklik @slimonslimon I have tried the rascal vehicle with flightgear 2019.1.1 on Ubuntu bionic. Not sure if this is something regarding my setup, but here are the problems I have encountered.
Also usability related discussions are being tracked in ThunderFly-aerospace/PX4-FlightGear-Bridge#5 |
We noticed this also, but it seems to be not related to FlightGear connection. It is probably some bug in the PX4 mission solving algorithm. It happens sporadically mainly in situations where the airplane sits on the ground and is oriented directly away from mission beginning takeoff waypoints. The expected behavior is the following:
Yes we now that, you have probably used the Rascal model with a combustion engine. The thrust generated by the propeller in idle RPM is large enough to make airplane moving. It could be solved in case PX4 is able to handle gear brakes. But this is not available as I know. The current solution is the use of model with electric engine. |
Add flightgear_bridge submodule. Add traget px4_sitl_nolockstep with disabled LOCKSTEP simulation. Add flightgear viewer targets and startup scripts Add a few posible vehicles plane (rascal), autogyro (tf-g1), and rover (tf-r1))
705bb2c
to
3199cd2
Compare
@kaklik I have installed the model from the repo you have pointed to - How can I use the electric engine model? |
Combustion engine: Electric motor: The electric motor support is in master since yesterday. So you need to install the latest daily-build of FlightGear. |
@roman-dvorak Okay, where can I get the latest daily-build of flight gear? Please forgive me if these are stupid questions, but as I am not familiar with flightgear, it feels like there are a lot of moving parts. I have been using flightgear 2019.1.1 disributed with Could you document the exact versioning / system that this has been tested in the readme? |
The location where you get the daily build of FG is pointed from the Rascal model readme |
@Jaeyoung-Lim, @kaklik is preparing more detailed documentation for documentation web pages, because it can be maintainted better, than readme in repo (I think). The readme will be updatet soon by @kaklik . There are lots of problems with FlightGear (versions, data-versions, lots of parameters, undocumended feautres, documentation by some posts on wiki, or forum, single thread implemntation from previous century, etc.). We probably will not be able to write down good and complente documentation for flightgear. But We maybe will try wrote some Introduction to flightgear along with documentation of using bridge with PX4. |
@slimonslimon Thanks, I totally agree. We don't need to document flight gear. I think for a start, a "bullet proof" step by step process to get it up and running will be already really good. I seem to keep running in to problems while depending on the readme of the px4-flightgear-bridge. Anyway, I would like to get this in @dagar @TSC21 would it be possible to merge this to move forward? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good and almost ready to merge.
Do you plan to add lockstep support?
Tools/setup/ubuntu.sh
Outdated
@@ -203,6 +203,10 @@ if [[ $INSTALL_SIM == "true" ]]; then | |||
protobuf-compiler \ | |||
; | |||
|
|||
# FlightGear | |||
sudo add-apt-repository -y -u ppa:saiarcot895/flightgear | |||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet install flightgear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jaeyoung-Lim @kaklik this is still unanswered, and I agree, it should be optional / a separate script.
Tools/sitl_run.sh
Outdated
@@ -121,6 +121,13 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then | |||
echo "You need to have gazebo simulator installed!" | |||
exit 1 | |||
fi | |||
elif [ "$program" == "flightgear" ] && [ -z "$no_sim" ]; then | |||
echo "FG setup" | |||
cd "${src_path}/Tools/flightgear_bridge/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation: use tabs (below too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okey.
@@ -146,6 +161,38 @@ foreach(viewer ${viewers}) | |||
endforeach() | |||
endforeach() | |||
|
|||
#add flighgear targets | |||
if( ENABLE_LOCKSTEP_SCHEDULER STREQUAL "no") | |||
set(models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation: tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@bkueng I think, it is not posilbe to setup lockstep simulation with FlightGear by this way (communication over generic protocol), because I dont know how to stop the simulation of FG. So we decided to create _nolockstep target and connect FG targets to it. |
I hope I fixed every 4space->tab. Then we added model into bridge as submodules. It should help to do "fisrt run" as simple as posible. Some notes are in updated README of Bridge. More Detailed documantation is under developement by @kaklik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the good work!
Too bad there's no easy way to do lockstep.
Documentation of FlightGear PX4 support is now available in PX4Devguide |
The PX4 stack seems does not currently support the FlightGear simulator for SITL simulation. The FlightGear has better support for modeling of rotorcraft than the current PX4's mainstream simulator Gazebo.
This pull-request adding the possibility of the use of FlightGear(FG) and was tested on the autogyro TF-G1 simulation model.
It is a stand-alone application, which connect to FG (over UDP generic protocol) and PX4 ( over TCP, Mavlink)
The flight video
The flightgear_bridge has few limitations, which are not fully resolved:
In the future, the bridge can upsample the data by generating noised samples from the last known value it is a terrible way. Question is: What is the lowest acceptable rate of sensors data? We did not find that.
To the simulation could be run by
make px4_sitl_nolockstep flightgear_rascal
for plane ormake px4_sitl_nolockstep flightgear_tf-g1
for autogyro.