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

SITL: Add support for AirSim Simulator #11367

Merged
merged 5 commits into from
Jul 16, 2019
Merged

Conversation

rajat2004
Copy link
Contributor

@rajat2004 rajat2004 commented May 17, 2019

Connector for AirSim based on the ArduCopter Solo API in AirSim: microsoft/AirSim#1387
Described properly with some relevant links in #11324
A WIP, need to figure out some connection issues.

Review Requested @tridge @peterbarker

@OXINARF OXINARF added the GSoC Google Summer of Code label May 17, 2019
@OXINARF OXINARF requested review from tridge and peterbarker May 17, 2019 16:18
@rajat2004
Copy link
Contributor Author

@OXINARF Thanks!

The connection problem is described in detail here - microsoft/AirSim#1965
Briefly - Ardupilot is binding the sockets correctly and Airsim is also connecting to the sockets. Airsim is attempting to send the data but the SITL isn't receiving anything

@tridge
Copy link
Contributor

tridge commented May 20, 2019

@rajat2004 I've cleaned up the commits using an interactive rebase to follow our commit style
See http://ardupilot.org/dev/docs/submitting-patches-back-to-master.html

@rajat2004
Copy link
Contributor Author

@tridge I thought that I would squash up the commits after the connection problems were fixed, but thanks for doing that

@rajat2004
Copy link
Contributor Author

rajat2004 commented May 20, 2019

@lucasdemarchi Sorry, pressed the resolved button by mistake. If possible, could you open it again
The conversion from little-endian was something which I added after seeing a similar thing in SIM_JSBSim

JSBSim sends in little-endian

Even I thought that using little-endian wouldn't be much of a problem, but added that just for making sure.
Should I remove the function?

Also, I didn't understand what you meant by fdm_packet should be a pod. What's a pod actually?

libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.h Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
@rajat2004
Copy link
Contributor Author

rajat2004 commented May 21, 2019

Fixed the connection issues.
Please note that this is in no way functional right now, the SITL isn't even initialising properly. Just that Airsim & Ardupilot are able to communicate
I'll add a readme also for how to build AirSim and use this Ardupilot connector and address the remaining review comments

libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
libraries/SITL/SIM_AirSim.cpp Outdated Show resolved Hide resolved
@rajat2004
Copy link
Contributor Author

Readme added

@rajat2004
Copy link
Contributor Author

Fixed the gyro initialization by using EKF 10. The bad values are probably due to the collision of the drone with the ground in the beginning. Still figuring out the GPS problem

@peterbarker
Copy link
Contributor

peterbarker commented May 22, 2019 via email

@rajat2004
Copy link
Contributor Author

Made some changes, now it doesn't get the random GPS location. But still, there's no sat fix. It's not even detecting the GPS as u-blox which is displayed in the Mavproxy console. Any idea on what is causing this?
The GPS sent by the simulator is consistent (cause the drone won't take off)

I haven't squashed this commit so that it would be easier to review these changes and rewind if required

@rajat2004
Copy link
Contributor Author

Also seeing Time has wrapped messages now. Probably due to incorrect use of the timestamp field.
Or because of the horrible timing between Ardupilot & Airsim right now?

@rajat2004
Copy link
Contributor Author

Yeah, so the problem is with the timestamp, AirSim sends time from 1970 rather than the simulator start

@rajat2004
Copy link
Contributor Author

rajat2004 commented May 28, 2019

Did a bit of hack(similar to the older JSBSim timing), but it's working!!
Getting the GPS lock also, able to arm
While trying to takeoff, the rotors are spinning but it doesn't move, it detects it as crash and then disarms.

But still, progress!
I'll push the changes in a few mins after a bit of cleanup

@rajat2004
Copy link
Contributor Author

Added the sensor conversion changes.
Also added the params file, @tridge Thanks a lot for that!
Right now it's the full list, will change it to only those which have been modified
Readme has also been updated

@rajat2004 rajat2004 force-pushed the sitl-airsim branch 2 times, most recently from 2fb8dc7 to 770c685 Compare July 2, 2019 09:39
@rajat2004
Copy link
Contributor Author

rajat2004 commented Jul 2, 2019

This PR is no longer compatible with the ArduCopterSoloAPI in Airsim, instead, the corresponding Airsim branch is https://github.com/rajat2004/AirSim/tree/pr-arducopter.
All further development will be done on this branch

The earlier Airsim Solo compatible branch is here - https://github.com/rajat2004/ardupilot/tree/airsim-soloapi

Readme has been updated for using the Arducopter vehicle

@rajat2004 rajat2004 force-pushed the sitl-airsim branch 3 times, most recently from f3aa136 to 8a3dd0d Compare July 6, 2019 19:07
@rajat2004
Copy link
Contributor Author

JSON sensor packet parsing has been added, corresponding changes have been made to the Airsim branch

@rajat2004 rajat2004 force-pushed the sitl-airsim branch 4 times, most recently from 1d4f368 to 9468265 Compare July 11, 2019 05:20
@rajat2004
Copy link
Contributor Author

@peterbarker @tridge @khancyr @lucasdemarchi Could you do a fresh review of the PR as it currently stands? All the points raised till now have been addressed

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! This is ready to merge when it passes CI

@rajat2004
Copy link
Contributor Author

@tridge Thanks!
Should we wait for the AirSim PR to get merged first? (however, that might take a long time, and merging this will make it easier to setup and for other developers to work on top of this)

Just wanted to confirm once

@tridge tridge merged commit 825c027 into ArduPilot:master Jul 16, 2019
@tridge
Copy link
Contributor

tridge commented Jul 16, 2019

@rajat2004 no, we should merge here first I think. done!
I know you will be adding more features, but that can be done in a followup PR

@rajat2004
Copy link
Contributor Author

Follow-up PR for adding Lidar is here - #11835
Also, #11821 is a PR for fixing ArduPilot build on MacOS

Please have a look at the above PRs and review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Google Summer of Code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants