Run a simulation - AD-EYE/AD-EYE_Core GitHub Wiki

Linux computer

Start the manager node:

roslaunch adeye manager_simulation.launch

Simulation computer

After finishing the scenario in PreScan, the model has to be built:

Images/PreScan_Build.png

Then, Simulink has to be launched from the PreScan Gui:

Images/PreScan_Simulink.png

Once Simulink finishes loading, the path needs to be the folder containing the experiment:

Images/Simulink_Folder.png

In that folder, a Simulink file with the same name as the experiment can be found: Images/Simulink_Experiment.png

After opening the Simulink model, the model has to be rebuilt to reflect the changes made: Images/Simulink_Compilation.png

Before starting the simulation, the connection with the ROS master must be established using the following command in Matlab:

rosinit('Name_of_the_host_computer')

You can use the name of the computer like so:

rosinit('adeye07u')

Stopping the simulation

To stop the simulation first click on the stop button and wait for Simulink state (indicated in the bottom left corner) to get back to ready. Then do ctrl-c in the terminal on the Ubuntu side. If done the other way, the Simulink terminate phase will take longer.

Posible error 1: Message length in Simulink

Some of the messages sent in Simulink exceed the maximum array size and have to be manually modified the first time that the simulation is going to be executed in a computer or when the length of the message changes (for example, by changing the resolution of the lidar).

The easiest way to find the messages that have to be modified is to execute the simulation and look at the error messages. In the following image, it is possible to see that the "Data" variable inside the "sensor_msgs/Image" message has a wrong length.

Images/Message_length_1.png

The message length can be modified in tools > Robotic Operating Sistem > Manage array sizes.

Images/Message_length_2.png

To modify the parameters, untick use default limits for this message types:

Images/Message_length_3.png

The parameters that need to be changed are:

Message type Array property Maximum length
sensor_msgs/Image Data 2073600
sensor_msgs/Image Encoding 4
std_msgs/Float32MultiArray Data 57600

Posible error 2: Error in the intensity block from the point cloud

Sometimes, when the configuration of the point cloud sensor is modified, the block to output the intensity of the beans is generated in Simulink even if the output of the intensity was not selected in PreScan. In that case, the simulation will give an error. The way to solve this problem is to select again the intensity output in PreScan.

Posible error 3: Simulink stays stuck on initializing

Simulink often takes time to initialize the experiment when pressing the run button. However, it sometimes stays completely stuck on that step (you can consider it stuck after waiting roughly 3 min). If that happens, go back to Prescan and rebuild the Prescan experiment. Then, reopen the Simulink file and regenerate the compilation sheet.

If the problem is still not fixed then something is wrong with the experiment folder, it need to be reset to the latest working version from git.