Hi, sorry for my English.
I am currently working on my engineering thesis. In short: I create a path using RRTStar in MATLAB, export the map to Simulink, where the transition is simulated, and save the wheel velocities to a .txt file. Finally, in Coppelia, a PioneerP3DX script reads the velocities.
The problem is that the robot does not reach the target. After many attempts, I managed to get it quite close, but it still doesn’t reach the goal.
Some issues I’ve encountered:
- The wheels didn’t reach the desired speeds quickly enough, so I increased the torque on the joints.
- Different physics engines lead to different results; Newton and ODE get the closest.
- Shortening the Pioneer script helped.
I don’t know what else I can do. Is it even possible, or is Coppelia’s simulation too advanced, making it impossible to follow the path based on the MATLAB-generated .txt file due to physics and accumulated small errors?
Txt files are several thousand lines consisting of one of two values.
Pioneer Script:
sim=require'sim'
local file_left=sim.getStringParameter(sim.stringparam_scene_path)..'/left_wheel_data.txt'
local file_right=sim.getStringParameter(sim.stringparam_scene_path)..'/right_wheel_data.txt'
local lines_left = {}
local lines_right = {}
function sysCall_init()
motorLeft=sim.getObject("../leftMotor")
motorRight=sim.getObject("../rightMotor")
for line in io.lines(file_left) do
table.insert(lines_left, line)
end
for line in io.lines(file_right) do
table.insert(lines_right, line)
end
flag=true
k=2
end
--wL=sim.getObjectFloatParam(motorLeft, sim.jointfloatparam_velocity)
--print(wL)
function sysCall_actuation()
if k<#lines_left then
sim.setJointTargetVelocity(motorLeft,lines_left[k])
sim.setJointTargetVelocity(motorRight,lines_right[k])
end
k=k+1
end
function sysCall_cleanup()
end
Robot following path from Matlab
Re: Robot following path from Matlab
yes, you'll always have small errors in every contact. Similar to real-life, where a robot wheel will never be perfectly round, or have the exact dimensions, or not slip at all....making it impossible to follow the path based on the MATLAB-generated .txt file due to physics and accumulated small errors?
What you can do is compute the next position and orientation of the robot based on the values read from your file, and update the position of the robot by code, instead via the physics engine, i.e. turn the physic engine off, or make the robot non-dynamic.
Cheers
Re: Robot following path from Matlab
I tried increasing instead of lowering dt of simulation and simulink, now it gets very close, but it's not repetetive. Sometimes it's on point sometimes slightly above etc. Is there a way to lower realism of simulation making it less RNG? I started looking into "Simulation settings/Engine properties", but i don't know if there is something that can help mecoppelia wrote: ↑08 Jan 2025, 19:17 yes, you'll always have small errors in every contact. Similar to real-life, where a robot wheel will never be perfectly round, or have the exact dimensions, or not slip at all.
What you can do is compute the next position and orientation of the robot based on the values read from your file, and update the position of the robot by code, instead via the physics engine, i.e. turn the physic engine off, or make the robot non-dynamic.
Cheers