Plugin crashes
Posted: 10 Jun 2021, 00:57
I have been trying to use a plugin installed in Coppelia, but whenever I
use a method , the program crashes.
I cannot see any error message, the program just closes.
The plugin is this one:
https://github.com/roboticafacil/coppeliasim_gridmap
simGridMap.updateMapLaser(laserScan, pose) CoppeliaSim crashes.
OS: Windows 10
Coppelia Sim Edu, Version 4.1.0. (rev. 1) 64 bits (serialization version
22)
Qt Version 5.15.0, MSVC2019
The map windows is correctly created in black, but whenever I want to
update the map, it crashes. I have also tried to update with dummy error
like simGridMap.updateMapLaser({0,1}, {})
There is no error message shown. Only if I run from a console the error
that appears is Segmentation Fault
I'm following the instructions of the following youtube video:
[youtube]https://www.youtube.com/watch?v=fV0ZoDa1FaQ[/youtube]
I'm using the Pioneer robot given in the CoppeliaSim library, I have only
modify the sensors. They were ultrasonic and I changed them to be laser
ones so I could use the updateMapLaser method.
I leave here some code for giving more context
`
`
Thanks and Regards
use a method , the program crashes.
I cannot see any error message, the program just closes.
The plugin is this one:
https://github.com/roboticafacil/coppeliasim_gridmap
simGridMap.updateMapLaser(laserScan, pose) CoppeliaSim crashes.
OS: Windows 10
Coppelia Sim Edu, Version 4.1.0. (rev. 1) 64 bits (serialization version
22)
Qt Version 5.15.0, MSVC2019
The map windows is correctly created in black, but whenever I want to
update the map, it crashes. I have also tried to update with dummy error
like simGridMap.updateMapLaser({0,1}, {})
There is no error message shown. Only if I run from a console the error
that appears is Segmentation Fault
I'm following the instructions of the following youtube video:
[youtube]https://www.youtube.com/watch?v=fV0ZoDa1FaQ[/youtube]
I'm using the Pioneer robot given in the CoppeliaSim library, I have only
modify the sensors. They were ultrasonic and I changed them to be laser
ones so I could use the updateMapLaser method.
I leave here some code for giving more context
`
Code: Select all
function sysCall_init()
usensors={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
for i=1,16,1 do
usensors[i]=sim.getObjectHandle("Pioneer_p3dx_ultrasonicSensor"..i)
end
motorLeft=sim.getObjectHandle("Pioneer_p3dx_leftMotor")
motorRight=sim.getObjectHandle("Pioneer_p3dx_rightMotor")
wheel_radius=0.975e-01
b = 0.1655
-- Odometria
odometry=sim.getObjectHandle('odometry')
position=sim.getObjectPosition(odometry,-1)
orientation=sim.getObjectOrientation(odometry,-1)
pose={position[1],position[2], orientation[3]}
math.randomseed(os.time())
-- Mapa
cell_size = 0.1
map_size= 50
p_max = 0.9
p_min = 0.1
laser_max_range= 5
laser_prec = 0.1
laser_sigma = 0.1
laser_plambda =0.8
laser_weight_hit =0.7
laser_weight_unexpected = 0.3
gridMapParams = {cell_size,map_size, p_max, p_min, laser_max_range,
laser_prec, laser_sigma,
laser_plambda,laser_weight_hit,laser_weight_unexpected}
result = simGridMap.init(gridMapParams, true)
simGridMap.updateMapLaser({0,1,0,2}, {1,1,0})
--Pose robot
--robot_pose = sim.getObjectHandle('robot_pose')
noDetectionDist=0.5
maxDetectionDist=0.2
detect={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
braitenbergL={-0.2,-0.4,-0.6,-0.8,-1,-1.2,-1.4,-1.6,
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}
braitenbergR={-1.6,-1.4,-1.2,-1,-0.8,-0.6,-0.4,-0.2,
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}
v0=2
end`
`
Code: Select all
function sysCall_sensing()
odometry=sim.getObjectHandle('odometry')
position=sim.getObjectPosition(odometry,-1)
orientation=sim.getObjectOrientation(odometry,-1)
pose={position[1],position[2], orientation[3]}
pose=updateOdometry(pose)
for i=1,16,1 do
result,distance, detected_point=sim.readProximitySensor(usensors[i])
position=sim.getObjectPosition(usensors[i],-1)
orientation=sim.getObjectOrientation(usensors[i],-1)
pose={position[1],position[2], orientation[3]}
if(detected_point ~= nil) then
laserScan = {detected_point[3],0}
print("Punto", pose, laserScan)
simGridMap.updateMapLaser(laserScan, pose)
end
end
end`
Thanks and Regards