SITL - how to configure Optical Flow - Rangefinder not finding data

I’m working on my first stand alone SITL implementation to test ground control software I’m developing. I have SITL running on a dedicated Linux/Ubuntu system. (Raspberry Pi - ARM)

SITL is simulating a quad-copter with a Holybro H-Flow and no GPS.

My new software is a learning aid for STEM students. It allows them to build and fly simplified automated mission.

I’ve sorted though a few SITL issues - such as how to completely disable the GPS. And I’ve been guided (advice from AI) on some specialized parameter settings to get the Optical Flow sensor to work. For example setting FLOW_TYPE=10 for “SITL”. And setting RNGFND1_TYPE= 10 for “mavlink”.

It appears I have everything pretty much sorted out, except for a pre-arm message about the rangefinder not getting data.

Below is a recap of the settings I’ve implemented. If anyone has advice or suggestions, I’d appreciate receiving them. Thanks!

Hi @jstroup1986,

We’ve got a file here with the required param changes in SITL to get optical flow working.

I think RNGFND1_TYPE = 1 instead of 10

Thanks @rmackay9

I’m trying to simulate using a Holybro H-flow. This uses CAN for connections to the optical flow sensor and rangefinder.

I’m learning that SITL’s support for CAN is, well, problematic.

And I’ve gotten reports from AI that SITL isn’t really supporting Optical Flow.

I approached this pretty much assuming that SITL could do anything the real firmware could do - but my experience to day indicate this has it’s limitations.

From where I am today, my best bet may be to just move on the Gazebo.

If you know of anyone who’s successfully simulated dronecan optical flow (like the here-flow or H-flow) I’d appreciate the contact. From what I’ve seen to date, this isn’t presently possible.

Thanks!

Hi @jstroup1986,

SITL definitely supports optical flow and we have this wiki page describing the setup.

I think the issue is more about expectations in that maybe you’re expecting that there would be a simulator for a specific device. AP supports so many different sensors it’s not really realistic to hope that we’d have a simulator for each one. Instead we normally have just a single simulated sensor for each type. So you won’t find a Holybro simulated optical flow sensor but there is a generic optical flow sensor available.

Thank you @rmackay9 -

I think there’s a lot of history behind SITL that I’m not aware of yet. Thanks for your patience and support. And I think I didn’t express myself well.

My concern as to do with support for CAN. The documentation noted below suggests that by including the options for CAN support, peripherals using CAN should work.

In my recent experience - this is not true.

ArduPilot of course doesn’t support sensors “by name” - but rather by their connections. As such, any CAN connected optical flow device with both an optical flow sensor and rangefinder would be configured in the ArduPilot parameters in a similar way.

As I dug deeper in to why this wasn’t working for me, I ran into information that suggested that the libraries SITL uses for CAN/DroneCAN are no longer available.

This makes me wonder if in the early days of SITL, CAN was supported - and that support is no longer available.

I appreciate that there is an option to just plug in a generic Optical Flow. But that changes the character of SITL entirely. It means that you can simulate missions - but not vehicles. That’s an important distinction.

So yes - you’re entirely right regarding expectations. And to your point, maybe a clarifying statement regarding SITL’s ability to support equipment configurations would be a helpful addition to the SITL wiki.

It’s possible that there are no simulators that meet my specific needs. I’m going to try Gazebo next, and see if that does.

If it helps, here’s the context of my goals:

I’m duplicating the functionality of a Ryze Tello and the DroneBlocks app - using Cube/Pixhawk and ArduPilot/PX4 equipement. I’m calling my project “drone-lab”.

Drone-lab uses a companion computer (Geniatech xpi-RK3566-zero) that has a uart mavlink connection with the flight controller. It then uses the mavlink-router program to make the mavlink datasteam available on a TCP connection. Then I have a websocket bridge on the SBC that connects that TCP connecton to websockt connection over the SBC’s wi-fi. By usng websocket, I can address the vehicle using html/js applications running in a browser. My application will have similar functionality to the DroneBlocks app.

Another small detail is that I run NGINX on the SBC so that all the user needs is a wi-fi connection to the SBC - to access all the application and connectivity. It works entirely without the internet.

I’d like to be able to simulate this functionality, before working with real quad-copter - which has been my interest in SITL.

I appreciate your support - and I’ll make everything I learn and build available on GitHub once I make some progress.

Hi @jstroup1986,

I’m not personally familiar with the sim_vehicle, “–can-peripherals” argument so I’ll ask @peterbarker to chime in here