How to force the drone flying with the specific velocity and Eular angle without fast-physics ? #3310
Replies: 19 comments 2 replies
-
|
Hi @misakabribri , this will mainly depend on the flight data you gathered. For example, if its a PX4 mission, you can simply run AirSim in PX4 SITL or HITL mode and upload your mission to be executed. To address the points you mentioned, if I understand what you're trying to do correctly,
|
Beta Was this translation helpful? Give feedback.
-
|
@ahmed-elsaharti I found some API functions in RpcLibClientBase.hpp:
|
Beta Was this translation helpful? Give feedback.
-
|
@misakabribri you could try using simSetVehiclePose to teleport the vehicle along a path but it would still be using multirotor physics. With CV mode you pretty much just have a camera moving around in the scene. Have a look at #2955, my understanding is that the author is working on a fixed wing model there |
Beta Was this translation helpful? Give feedback.
-
|
@ahmed-elsaharti, do you think that using CV mode and using the blueprint drone (that can be added through the ue editor) can be a way of accomplishing this? Then we can move the drone through |
Beta Was this translation helpful? Give feedback.
-
|
@jonyMarino This is a BRILLIANT idea! This could also be used as a hacky solution for #3208 import airsim
client = airsim.VehicleClient()
client.confirmConnection()
pose1 = client.simGetObjectPose("BP_FlyingPawn_5");
pose1.position = pose1.position + airsim.Vector3r(-2, -2, -2)
success = client.simSetObjectPose("BP_FlyingPawn_5", pose1, True); |
Beta Was this translation helpful? Give feedback.
-
|
The preferred way is to use That said, there is currently an open issue with The interesting next step is to go one level beyond setting the vehicle pose, and instead overriding the entire state. Currently, |
Beta Was this translation helpful? Give feedback.
-
|
@saihv I haven't experimented with CV mode so far so I might (will probably) be completely wrong here, but doesn't CV mode not spawn any vehicles? My understanding at this point is that the only vehicle that we can set the pose of in CV mode is the actual camera. right? |
Beta Was this translation helpful? Give feedback.
-
|
Sorry! I made a typo. I meant [non-CV mode (Multirotor) and Teleporting the drone through |
Beta Was this translation helpful? Give feedback.
-
|
@saihv Oh, no worries it makes sense now and I completely agree 👍. I was actually going to test moving the camera around in Non-CV mode to see if it messes up with anything in an attempt to see if I could create a 'fixed position' camera that tracks the drone as is needed for #3208 |
Beta Was this translation helpful? Give feedback.
-
|
@saihv I've tested the CV mode + What I did to test this was to set up a scene with a drone_pawn as an object in there: This is the initial camera pose and object location: I then grabbed the object's location and moved it 4m backwards using pose1 = client.simGetObjectPose("BP_FlyingPawn_5");
pose1.position = pose1.position + airsim.Vector3r(-4, 0, 0)
success = client.simSetObjectPose("BP_FlyingPawn_5", pose1, True);I then moved the camera backwards an equal amount camera_pose = airsim.Pose(airsim.Vector3r(-4, 0, 0), airsim.to_quaternion(0, 0, 0))
client.simSetCameraPose("0", camera_pose)This resulted in only the camera moving within the original frame. Just to make sure that everything is still referenced to that coordinate system i moved the drone backwards again to pose2: which showed that they're both 4m apart with pose1 grabbed/changed before camera movement while pose2 was grabbed/changed after it. which leads me to conclude that the camera movement did not affect the coordinate system the drone/object is referenced to or the rest of the scene objects. Is it safe to assume that this is a viable solution or is my testing method flawed? Edit: forgot to mention that moving the camera manually after and before these works fine too |
Beta Was this translation helpful? Give feedback.
-
|
@ahmed-elsaharti Thanks for the quick test! EDIT: Actually nvm, it does make sense. Because NedTransform::NedTransform() is instantiated at the start with a global transform, it will keep a constant origin reference and it shouldn't matter what happens to the pose of the camera or the computer vision pawn itself during the simulation: because |
Beta Was this translation helpful? Give feedback.
-
|
@saihv I meant the manual WASD camera controls available through the view mode enabled through the Also, would you recommend using this method to programmatically set the orientation of a fixed-location camera trying to |
Beta Was this translation helpful? Give feedback.
-
Yeah I think it should work. I forgot about the |
Beta Was this translation helpful? Give feedback.
-
@saihv I honestly do not blame you. AirSim's got ALOT of functions that are very similarly named. This would be a good segue into the 'API documentation' topic but thats out of the issue's scope anyway 😂.
Yup for the case of #3208 my understanding is that AirSim would be used as a tool to 'visualize/draw' the data. So the drone would be an arbitrary object. |
Beta Was this translation helpful? Give feedback.
-
|
Side note, I am noticing some weird behavior with M in CV mode. WASD + |
Beta Was this translation helpful? Give feedback.
-
|
Woops, i just realized that i meant F-mode rather than M-mode. Sorry about that |
Beta Was this translation helpful? Give feedback.
-
|
Yeah I think as long as F / WASD works it's fine, M is probably decoupling the camera director from the pawn. WASD movement actually displaces the ComputerVisionPawn in the UE world, so that was what I was mainly curious about |
Beta Was this translation helpful? Give feedback.
-
|
If this is used for a fixed wing UE4 model, will the setPose account for the difference between the movement of a copter (like the default FastPhysicsEngine) and that of a plane? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @nikitabeebe! Now the preferable way to accomplish this is using the "ExternalPhysicsEngine" along with setVehiclePose. In that way, you would get the drone's sensors. |
Beta Was this translation helpful? Give feedback.









Uh oh!
There was an error while loading. Please reload this page.
-
OS: Windows 10
IDE: VS 2019;
Unreal: UE 4.24.3
Hello. I already have the fligt data (including positions and Euler angles) gathered from other simulation platforms. I want to use AirSim to 'playback' the flight data (just like a 3D-film) and capture images of the drone.
I guess there are at least two things to do:
but I don't know how to do these things.
Beta Was this translation helpful? Give feedback.
All reactions