-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Rotor output API #3242
Rotor output API #3242
Conversation
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.
Hi @ahmed-elsaharti, thank you for creating this PR! I have a few comments that describe an alternative to using the global variable in your code. Most of my other comments deal with naming conventions and style guidelines. Please feel free to ask any questions if you'd like extra clarification about any of my comments.
AirLib/include/vehicles/multirotor/api/MultirotorRpcLibAdapators.hpp
Outdated
Show resolved
Hide resolved
Hi @zimmy87, Thank YOU for the EXTREMELY helpful comments! |
Hi @ahmed-elsaharti, 2 of the checks are failing for this PR due to a unrelated break in the Unity build from another PR. The fix for this build break was committed earlier today, can you rebase this PR to pick up the fix and rerun all the checks? |
83e3a6d
to
c8436d1
Compare
@zimmy87 Yup, that PR fixed the Unity build and the checks have passed 👍 |
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 PR looks good for the most part, I just have 1 remaining comment.
Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp
Outdated
Show resolved
Hide resolved
Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp
Outdated
Show resolved
Hide resolved
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.
I agree with most of @rajat2004's comments and think it would be prudent to include them before merging
Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp
Outdated
Show resolved
Hide resolved
Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp
Outdated
Show resolved
Hide resolved
@rajat2004 @zimmy87 Thank you guys for the useful comments! Anyway, the PR should be good to go now that the Github checks have run successfully. Let me know if any other modifications are needed. |
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.
Just some small nitpicks
AirLib/include/vehicles/multirotor/api/MultirotorRpcLibAdapators.hpp
Outdated
Show resolved
Hide resolved
Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp
Outdated
Show resolved
Hide resolved
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 PR looks good to me and once the one remaining feedback concerning populating the rotor states is resolved, I think it will be ready for merging
@zimmy87 the last commit (4d8b3c9) should take care of these changes. Let me know if any other changes are needed 👍 |
Thank you for the contribution @ahmed-elsaharti! |
Thank you for your contribution. Using @sytelus 's method to have the energy/battery consumption, we have only to multiply Thrust * torque_scaler * speed for each rotor and sum then during the simulation time? Do you know the units of these measurements? Thank you so much for your attention. |
Potentially helps with : #672 #2419
About
This PR adds an API that returns each rotor's speed, torque, and thrust.
This is potentially useful for the future development of energy/battery level simulation within AirSim using @sytelus 's method outlined here
The method used here is super crude and uses a global variable that gets updated with the rotor parameters with everyAny testing and/or suggestions on how this could be improved are very welcomeupdateRenderedState
while waiting for thegetRotorStates
API call. This probably is not the most elegant way of doing this.ie:
Also, this is set up to work for quadrotors but scaling the struct up to take up any number of rotors is easy.
How Has This Been Tested?
This was tested with the Blocks environment on UE 4.24 with Simpleflight and PX4 SITL. No issues so far.
Screenshots:
On the python side here's the basic structure:
getRotorStates() (type =
RotorStateAPIRotorStates) contains ->rotors_ rotors (type =rotors (type = list of rotors[0]-rotors[3] dicts) contains -> ['speed'], ['thrust'] and ['torque_scaler'] as floatsRotorSTTVectorRotorVector) contains ->print(client.getRotorStates())
:print(client.getRotorStates().rotors_.rotor[0])
: