Optical flow testing with Gazebo IRIS model and Ardupilot SITL

Hi,

I am trying to simulate Optical flow sensor testing in the Gazebo simulation. To test this scenario, will need IRIS model with the attached Optical flow sensor. After searching I found this https://ardupilot.org/dev/docs/using-sitl-for-ardupilot-testing.html#adding-a-virtual-optical-flow-sensor
I think this method just injects some related random values of the Optical flow sensor to Ardupilot SITL. Correct me if I am wrong.

Is there any way to ArduCopter should get sensor values from the Gazebo environment? Any gazebo plugin that will do so?

Check this link Px4 SITL and gazebo_iris_opt_flow model which simulates the same but model is with Px4 firmware.
https://dev.px4.io/v1.9.0/en/simulation/gazebo.html#quadrotor-with-optical-flow

Thank you

How do you experience “related random values”? I have used the plugin you mentioned to fly with optical flow in gazebo simulator with success. You also need to add the range finder from the description on the same page.

@Henrik

For testing, I moved my vehicle near the home location at altitude 10m. But values of OPTICAL_FLOW.flow_x OPTICAL_FLOW.flow_y never changed. Values were constantly 0.

The mentioned tutorial was with Px4 Firmware. Have you tested it with Ardupilot SITL? If yes, do have any guide or any reference link?

It worked with ardupilot from the link above, and it worked. I could fly in GUIDED mode. Maybe this is the other guide you are looking for?

If you moved the model in gazebo while the copter was disarmed it might be that the optical flow sensor was not running or that the data was not streamed to mavlink. It is a parameter you can set.