0% found this document useful (0 votes)
103 views6 pages

Dipesh DT

The student designed a two-wheel line following robot in Coppeliasim. Coppeliasim is a robotics simulator that allows controllers to be written in different programming languages and is useful for robotics education and prototyping. The robot uses three vision sensors to detect a path and adjusts the wheel velocities to follow the line, backing up when it loses the path. The student generated a path shape and integrated sensors and control code to enable line following behavior.

Uploaded by

jksnkj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views6 pages

Dipesh DT

The student designed a two-wheel line following robot in Coppeliasim. Coppeliasim is a robotics simulator that allows controllers to be written in different programming languages and is useful for robotics education and prototyping. The robot uses three vision sensors to detect a path and adjusts the wheel velocities to follow the line, backing up when it loses the path. The student generated a path shape and integrated sensors and control code to enable line following behavior.

Uploaded by

jksnkj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Experiment: 9

Student Name : Dipesh Dalmia UID: 22BCS14168


Section/Group: 410-B Date of Performance: 08/05/23
Branch: CSE Subject Name: DT-2
Semester: 2nd Subject Code: 22ECH-103

1. Aim

Design a two-wheel line following robot integrated with sensors.

2. Tool Used

Coppeliasim

3. Basic Concept

• Coppeliasim

The robotics simulator CoppeliaSim (formerly V-REP), with integrated


development environment, is based on a distributed control architecture: each
object/model can be individually controlled via an embedded script, a plugin, a ROS
node, a remote API client, 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.

CoppeliaSim is used for fast algorithm development, factory automation


simulations, fast prototyping and verification, robotics related education, remote
monitoring, safety double-checking, as digital twin, and much more.
4. Procedure:

Step 1 : Get the BubbleRob in main scene.

Step 2 : Delete Vision sensor.

Step 3 : Go to Add →  Path(closed).

Step 4 : (Optional) Edit Points of Path.

Step 4 : Go to Path property →  Generate Extruded Shape.

Step 5 : Go to Add → Vision Sensor(Orthographic ) → Rotation → Around x(deg) :


180

Step 6 : Go to → Position → x = 0.2 , y = 2 , z = 0.018

Step 7 : Copy and Paste Vision Sensor → Go to → Position → z = 0.042

Step 8 : Copy and Paste Vision Sensor → Go to → Position → z = -0.042

Step 9 : Go to sensor property → Resolution → 1/1 → Ignore Depth

Step 10 : Add given code to BubbleRob and Path .

Step 11 : Play the animation.


5. Code

• BubbleRob Code

function sysCall_init()
bubbleRobBase=sim.getObject('.')
leftMotor=sim.getObject("./bubbleRob_leftmotor")
rightMotor=sim.getObject("./bubbleRob_rightmotor")
noseSensor=sim.getObject("./bubbleRob_sensingNose")
minMaxSpeed={50*math.pi/180,300*math.pi/180}
backUntilTime=-1 -- Tells whether bubbleRob is in forward or backward mode
floorSensorHandles={-1,-1,-1}
floorSensorHandles[1]=sim.getObject("./bubbleRob_leftSensor")
floorSensorHandles[2]=sim.getObject("./bubbleRob_middleSensor")
floorSensorHandles[3]=sim.getObject("./bubbleRob_rightSensor")
robotTrace=sim.addDrawingObject(sim.drawing_linestrip+sim.drawing_cyclic,2,0,-1,200,{1,1,0},nil,nil,{1,1,0})
-- Create the custom UI:
xml = '<ui title="'..sim.getObjectAlias(bubbleRobBase,1)..' speed" closeable="false" resizeable="false"
activate="false">'..[[
<hslider minimum="0" maximum="100" on-change="speedChange_callback" id="1"/>
<label text="" style="* {margin-left: 300px;}"/>
</ui>
]]
ui=simUI.create(xml)
speed=(minMaxSpeed[1]+minMaxSpeed[2])*0.5
simUI.setSliderValue(ui,1,100*(speed-minMaxSpeed[1])/(minMaxSpeed[2]-minMaxSpeed[1]))

end

function sysCall_sensing()
local p=sim.getObjectPosition(bubbleRobBase,-1)
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)
if (result>0) then backUntilTime=sim.getSimulationTime()+4 end

-- read the line detection sensors:


sensorReading={false,false,false}
for i=1,3,1 do
result,data=sim.readVisionSensor(floorSensorHandles[i])
if (result>=0) then
sensorReading[i]=(data[11]<0.5) -- data[11] is the average of intensity of the image
end
end

-- compute left and right velocities to follow the detected line:


rightV=speed
leftV=speed
if sensorReading[1] then
leftV=0.03*speed
end
if sensorReading[3] then
rightV=0.03*speed
end
if sensorReading[1] and sensorReading[3] then
backUntilTime=sim.getSimulationTime()+2
end

if (backUntilTime<sim.getSimulationTime()) then
-- When in forward mode, we simply move forward at the desired speed
sim.setJointTargetVelocity(leftMotor,leftV)
sim.setJointTargetVelocity(rightMotor,rightV)
else
-- When in backward mode, we simply backup in a curve at reduced speed
sim.setJointTargetVelocity(leftMotor,-speed/2)
sim.setJointTargetVelocity(rightMotor,-speed/8)
end
end

function sysCall_cleanup()
simUI.destroy(ui)
end

• Path Code

path=require('path_customization')

function path.shaping(path,pathIsClosed,upVector)
local section={-0.02,0.001,0.02,0.001}
local color={0.3,0.3,0.3}
local options=0
if pathIsClosed then
options=options|4
end
local shape=sim.generateShapeFromPath(path,section,options,upVector)
sim.setShapeColor(shape,nil,sim.colorcomponent_ambient_diffuse,color)
return shape
end
6. Results:

Learning outcomes:-
1. We have learnt about Robotic Development.

2. Learn how to use Coppeliasim .

3. Learnt about Designing models .

4. We learnt about positioning and orientation of various models

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy