- Ubuntu 20.04
- ROS1
- CoppeliaSim simulation (Education version 4.4.0)
- Ubuntu command line
- C++ and Lua languages programming
- Basic ROS1
- catkin
- creat package
- topic and message
- Basic CoppeliaSim simulation
- Create object and joint
- Create joint
- Move and rotate an object
- Create a "catkin workspace" >> see example
- Download the code from the repository and catkin_make to compile
- Add "source /devel/setup.bash" to .bashrc >> see example
In the provided files, we have two simulation system
This system contains only medaextra-fixed_CPG.ttt, this system is used to observe the leg trajectory data from a real insect and extract it to robot motor commands. Then, the motor commands are used to be a target in RBF network, and we can obtain RBF weights to transfer CPG signals to motor signals. We can run this simulation file without using ROS1. See the figure for more explanation.
This system uses the remaining files to run the system. We use ROS1 for interfacing (sending motor commands, receiving feedback signals, etc) with the simulation. You can run this system by following the steps below.
- Change the file path to match my own machine!!!
- Open a terminal and run "roscore"
- Open CoppeliaSim >> [see example](https://forum.coppeliarobotics.com/viewtopic.php?t=9148\)
- In the simulation, Open the scene from the downloaded folder “medaextra_ver2.ttt”
- You will see the stick insect robot, then run
▶️ 
In this tutorial, it will be shown how to upload a CSV file to CoppeliaSim (VREP). A script will be used to read the CSV file and create a trajectory for the robot/object that you intend to move.
- CoppeliaSim (VREP) installed.
- CSV file with the trajectory to be followed.
- CoppeliaSim scene with the robot/object that will follow the trajectory.
The CSV file must have the following format:
For example:
This is the only format that CoppeliaSim accept for the paths. The first row must contain the names of the columns, and the following rows must contain the values of the trajectory. By using third part programs like excel or google sheets, you can create the CSV file and save it in .csv format.
In CoppeliaSim scene, you will need to add a dummy object. This object will be the one that will follow the
trajectory. (it can be any kind of object, even a primitive shape like cuboids) After adding the dummy object,

you will need to add this script by right clicking on the dummy object and selecting Add -> Associated
child script -> Non-threaded.

Then, you will need to copy this script to the dummy object script.
function sysCall_init()
-- Check current path of your script file
local currentPath = sim.getStringParam(sim.stringparam_scene_path)
print(currentPath)
-- Create an array to store the data
local csvPath = {}
-- Open your csv file : relate to your current path
local file = io.open(currentPath .. "/path&to&your&file.csv", "r")
print("open")
if file then
print("file")
-- Read and store each line of data in the array
for line in file:lines() do
for value in line:gmatch("([^,]+)") do
table.insert(csvPath, tonumber(value))
end
end
-- Close the file
file:close()
-- Now 'csvPath' contains your CSV data in a Lua array
-- You can use 'csvPath' for further processing in your simulation
else
print("Failed to open the file")
end
print(csvPath)
-- This is a simple path you can use this stead of csvPath
local simPath = {
0.1,0.1,0.1,0,0,0,1,
0.2,0.2,0.2,0,0,0,1,
0.3,0.3,0.3,0,0,0,1,
0.4,0.4,0.3,0,0,0,1,
0.5,0.5,0.2,0,0,0,1,
0.4,0.4,0.1,0,0,0,1,
0.3,0.3,0.1,0,0,0,1,
0.2,0.2,0.2,0,0,0,1,
0.1,0.1,0.3,0,0,0,1}
-- Create path
sim.createPath(csvPath,16)
endIn the script, you will need to change the path to your CSV file. You can do this by changing the following line:
local file = io.open(currentPath .. "/path&to&your&file.csv", "r")Now, to exploit the script you will need to run the simulation. After running the simulation, the script will read the CSV file and create the trajectory. To see the trajectory, you will need to select the dummy object and then select the path that was created by the script.
WHEN THE SIMULATION IS STILL RUNNING is possible to copy the path object, stop the simulation and paste the path object in the scene. This way you will be able to see the trajectory without running the simulation
Gian Paolo Currá (contact: gicur22@student.sdu.dk) and Thirawat Chuthong (contact: thirawat.c_s21[at]vistec.ac.th)










