In our project, we are trying to do a live simulation where two robots state space model are written as a code in MATLAB and visualization is done in Gazebo environment. Gazebo and MATLAB will work in cooperation. In Gazebo, we will use image processing to measure the distance between these robots. According to the distance measured, an input will be given to each robot state space system. The output of the state space is send to Gazebo and the new position is visualized again in Gazebo. According to the new position, a new distance data is send again to MATLAB and the required input is given to state space model. This process will continue until we shut down the simulation manually.
I am trying to simulate the state space model using live data coming form Gazebo. However, step() and lsim() functions works only for given array of inputs, at least as I know. Is it possible to simulate State Space model using changing inputs or live data coming from Gazebo? Which function should I use to simulate the system response using live input?