Is it possible to simulate State Space model using live inputs coming from Gazebo environment?
조회 수: 3 (최근 30일)
이전 댓글 표시
The Idea:
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.
The problem:
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?
댓글 수: 0
채택된 답변
Jianxin Sun
2021년 5월 11일
Hi,
Have you considered using https://www.mathworks.com/help/simulink/slref/statespace.html from Simulink?
Thanks,
Jianxin
댓글 수: 3
Jianxin Sun
2021년 5월 11일
For the slow communication between ROS and Simulink, are you more concerned about performance or synchronization?
If you need better synchronization, the robotics system toolbox contains blocks that can synchronize execution between Simulink and Gazebo: https://www.mathworks.com/help/robotics/ug/perform-co-simulation-between-simulink-and-gazebo.html, which could help you in this use case.
Otherwise, if you need to simulate a state space model in MATLAB, you probably need to compute the derivatives based on the state space model, current state, and control inputs, then integrate them using ODE solvers over one time step https://www.mathworks.com/help/matlab/math/choose-an-ode-solver.html. lsim() method probably can work over a single time step as well. You can provide the simulation time as [0 dt], provide current state as initial state, and provide constant control inputs over the time interval.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 ROS Log Files and Transformations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!