AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

Possible to add Cameras to the Drone?

Open olivia-skydio opened this issue 8 years ago • 14 comments

Is it possible to add a camera to the drone? What files would you have to change besides FlyingPawn.cpp? Thanks!

olivia-skydio avatar Feb 22 '18 22:02 olivia-skydio

You will have to modify the BP_FlyingPawn blueprint with the added camera and parameters, and then inside FlyingPawn.cpp, add your reference to it, making sure to add it to the camera list.

zergler avatar Feb 23 '18 02:02 zergler

@zergler thanks for the reply back! So I'm currently doing that right now but when I try and do ImageRequest for that camera then my UnrealEngine crashes. Any ideas of things I could be missing?

olivia-skydio avatar Feb 23 '18 19:02 olivia-skydio

Hmm I'm not sure. You could launch UE4Editor inside gdb and then run r /path/to/airsim/Unreal/Environments/Blocks/Blocks.uproject to get a stack track. That might point out the problem.

zergler avatar Feb 23 '18 19:02 zergler

I have done this previously, you'll also need to make changes in FlyingPawn.h, VehicleWrapper.cpp. I followed the code starting from multiRotorAPI simGetImage method. I can outline the specific changes that I made if that isn't enough

DavidLSmyth avatar Feb 23 '18 22:02 DavidLSmyth

@DavidLSmyth thanks for the response! I made changes in FlyingPawn.h to add my camera. What other changes in VehicleWrapper.cpp would I need to add? Thanks so much!

olivia-skydio avatar Feb 23 '18 22:02 olivia-skydio

Just got it working I think! Thanks for the help @zergler! @DavidLSmyth I didn't end up changing anything in VehicleWrapper.cpp was still curious what you changed?

olivia-skydio avatar Feb 23 '18 22:02 olivia-skydio

Just curious, why you need additional cameras. We already have 5 cameras on the drone...

sytelus avatar Feb 27 '18 14:02 sytelus

Hi @sytelus , not the OP but might have an answer to your question. Since my team and I would like to duplicate camera rig configurations from real vehicles (we have many) and test new ones, it helps to be able to specify the exact number, position and orientation of each camera, which I'm currently attempting to do similar to the methods discussed on this thread. Even though my use is for the car, I'd imagine there's a similar reason for wanting this option on a drone.

nnayeer avatar Feb 27 '18 17:02 nnayeer

For now you might be able to just change values here: https://github.com/Microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Source/Car/CarPawn.cpp#L123

In long run we want to be able to specify this through json settings.

sytelus avatar Mar 02 '18 16:03 sytelus

@DavidLSmyth, Can you go over the changes or attach files to the comment so I can personally go through the changes? I need multiple stereo cameras on the multirotor. Thank you.

nalinraut avatar Feb 05 '19 19:02 nalinraut

@nalinraut do you mean you need multiple cameras for stereo vision? I don't think unreal provides stereo cameras. The changes were merged for the multirotor, see above

DavidLSmyth avatar Feb 05 '19 19:02 DavidLSmyth

@DavidLSmyth If I am not wrong, I can use the left and right camera as a stereo pair using the simGetImages API. Thank you!

nalinraut avatar Feb 05 '19 20:02 nalinraut

@olivia-skydio Did you only make changes to FlyingPawn.h or are there more changes to other scripts? Thank you!

nalinraut avatar Feb 11 '19 22:02 nalinraut

hey @nalinraut, see my comment here https://github.com/Microsoft/AirSim/issues/1770#issuecomment-462949223

madratman avatar Feb 12 '19 21:02 madratman