Professional Documents
Culture Documents
DISRUPTIVE TECHNOLOGY – 2
EXPERIMENT-8
2. Tool Used:
Coppeliasim
3. Basic Concept /Command Description:
The robotics simulator CoppeliaSim, with integrated development environment, is based on
a distributed control architecture: each object/model can be individually controlled via an
embedded script, a plugin, ROS / ROS2 nodes, remote API clients, or a custom solution.
This makes CoppeliaSim very versatile and ideal for multi-robot applications. Controllers
can be written in C/C++, Python, Java, Lua, Matlab or Octave.
1
University Institute of Engineering
Department of Computer Science & Engineering
4.Code:
function sysCall_init()
bubbleRobBase=sim.getObject('.')
leftMotor=sim.getObject("./leftMotor")
rightMotor=sim.getObject("./rightMotor")
noseSensor=sim.getObject("./sensingNose")
minMaxSpeed={50*math.pi/180,300*math.pi/180}
floorSensorHandles={-1,-1,-1}
floorSensorHandles[1]=sim.getObject("./leftSensor")
floorSensorHandles[2]=sim.getObject("./middleSensor")
floorSensorHandles[3]=sim.getObject("./rightSensor")
robotTrace=sim.addDrawingObject(sim.drawing_linestrip+sim.drawing_cyclic,2,0,-1,200,{1,1,0},nil,nil,{1,1,0})
</ui>
]]
ui=simUI.create(xml)
speed=(minMaxSpeed[1]+minMaxSpeed[2])*0.5
2
University Institute of Engineering
Department of Computer Science & Engineering
simUI.setSliderValue(ui,1,100*(speed-minMaxSpeed[1])/(minMaxSpeed[2]-minMaxSpeed[1]))
end
function sysCall_sensing()
sim.addDrawingObjectItem(robotTrace,p)
end
function speedChange_callback(ui,id,newVal)
speed=minMaxSpeed[1]+(minMaxSpeed[2]-minMaxSpeed[1])*newVal/100
end
function sysCall_actuation()
result=sim.readProximitySensor(noseSensor)
sensorReading={false,false,false}
result,data=sim.readVisionSensor(floorSensorHandles[i])
end
end
-- compute left and right velocities to follow the detected line:
rightV=speed
3
University Institute of Engineering
Department of Computer Science & Engineering
leftV=speed
leftV=0.03*speed
end
rightV=0.03*speed
end
backUntilTime=sim.getSimulationTime()+2
end
-- When in forward mode, we simply move forward at the desired speed
sim.setJointTargetVelocity(leftMotor,leftV)
sim.setJointTargetVelocity(rightMotor,rightV)
else
sim.setJointTargetVelocity(leftMotor,-speed/2)
sim.setJointTargetVelocity(rightMotor,-speed/8)
end
end
function sysCall_cleanup()
simUI.destroy(ui)
4
University Institute of Engineering
Department of Computer Science & Engineering
end
path=require('path_customization'
function path.shaping(path,pathIsClosed,upVector)
options=options|4
end
sim.setShapeColor(shape,nil,sim.colorcomponent_ambient_diffuse,color)
end
5
University Institute of Engineering
Department of Computer Science & Engineering
University Institute of Engineering
Department of Computer Science & Engineering
6
6. Result and Summary:
CoppeliaSim is a powerful cross-platform robot simulator which has a free educational version.
CoppeliaSim's strength comes from several features: