0% found this document useful (0 votes)
158 views

Exp 9

1. The document describes an experiment conducted using the CoppeliaSim robotics simulator to design a collision avoidance robot that can navigate a multi-obstacle environment. 2. CoppeliaSim is a powerful cross-platform robot simulator that provides dynamic simulation engines, sensors, path planning tools, and APIs to control simulated robots from scripts or external applications. 3. The experiment code controls a robot in CoppeliaSim using sensors to detect obstacles and avoid collisions by moving in reverse when obstacles are near.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views

Exp 9

1. The document describes an experiment conducted using the CoppeliaSim robotics simulator to design a collision avoidance robot that can navigate a multi-obstacle environment. 2. CoppeliaSim is a powerful cross-platform robot simulator that provides dynamic simulation engines, sensors, path planning tools, and APIs to control simulated robots from scripts or external applications. 3. The experiment code controls a robot in CoppeliaSim using sensors to detect obstacles and avoid collisions by moving in reverse when obstacles are near.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

University Institute of Engineering

Department of Computer Science & Engineering

DISRUPTIVE TECHNOLOGY – 2
EXPERIMENT-9

Student Name: Peeyush Chaurasia UID: 22BCS16408


Branch: Computer Science & Engineering Section/Group:403-A
Semester: II Date of Performance:05/04/2023
Subject Name: Disruptive Technologies-2
Subject Code: 22ECH-103

1. Aim of the practical:


 Design a collision avoidance robot in multi obstacle based environment.
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 speedChange_callback(ui,id,newVal)

    speed=minMaxSpeed[1]+(minMaxSpeed[2]-minMaxSpeed[1])*newVal/10

end

function sysCall_init()

    -- This is executed exactly once, the first time this script is executed

    bubbleRobBase=sim.getObject('.') -- this is bubbleRob's handle

    leftMotor=sim.getObject("./leftMotor") -- Handle of the left motor

    rightMotor=sim.getObject("./rightMotor") -- Handle of the right motor

    noseSensor=sim.getObject("./sensingNose") -- Handle of the proximity sensor

    minMaxSpeed={50*math.pi/180,300*math.pi/180} -- Min and max speeds for each motor

    backUntilTime=-1 -- Tells whether bubbleRob is in forward or backward mode

    robotCollection=sim.createCollection(0)

    sim.addItemToCollection(robotCollection,sim.handle_tree,bubbleRobBase,0)

    distanceSegment=sim.addDrawingObject(sim.drawing_lines,4,0,-1,1,{0,1,0})

    robotTrace=sim.addDrawingObject(sim.drawing_linestrip+sim.drawing_cyclic,2,0,-1,200,{1,1,0},nil,nil,{1,1,0})

    graph=sim.getObject('./graph')

    distStream=sim.addGraphStream(graph,'bubbleRob clearance','m',0,{1,0,0})

    -- Create the custom UI:

        xml = '<ui title="'..sim.getObjectAlias(bubbleRobBase,1)..' speed" closeable="false" resizeable="false"


activate="false">'..[[

<hslider minimum="0" maximum="100" onchange="speedChange_callback" id="1"/>

2
University Institute of Engineering
Department of Computer Science & Engineering

        <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 result,distData=sim.checkDistance(robotCollection,sim.handle_all)

    if result>0 then

        sim.addDrawingObjectItem(distanceSegment,nil)

        sim.addDrawingObjectItem(distanceSegment,distData)

        sim.setGraphStreamValue(graph,distStream,distData[7])

    end

    local p=sim.getObjectPosition(bubbleRobBase,-1)

    sim.addDrawingObjectItem(robotTrace,p)

end

function sysCall_actuation()

    result=sim.readProximitySensor(noseSensor) -- Read the proximity sensor

    -- If we detected something, we set the backward mode:

    if (result>0) then backUntilTime=sim.getSimulationTime()+4 end

3
University Institute of Engineering
Department of Computer Science & Engineering

    if (backUntilTime<sim.getSimulationTime()) then

        -- When in forward mode, we simply move forward at the desired speed

        sim.setJointTargetVelocity(leftMotor,speed)

        sim.setJointTargetVelocity(rightMotor,speed)

    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 

CODE FOR VISION SENSOR: 

function sysCall_vision(inData)

    simVision.sensorImgToWorkImg(inData.handle) -- copy the vision sensor image to the work image

    simVision.edgeDetectionOnWorkImg(inData.handle,0.2) -- perform edge detection on the work image

    simVision.workImgToSensorImg(inData.handle) -- copy the work image to the vision sensor image buffer

end

function sysCall_init()

end

4
University Institute of Engineering
Department of Computer Science & Engineering

5.Observations, Simulation Screen Shots and Discussion:

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:

1. CoppeliaSim provides a unified framework combining many powerful internal and


external libraries that are often useful for robotics simulations. This includes dynamic
simulation engines, forward/inverse kinematics tools, collision detection libraries,
vision sensor simulations, path planning, GUI development tools, and built-in models
of many common robots.
2. CoppeliaSim is highly extensible. CoppeliaSim developers provide an API that allows
one to write custom plugins that add new features. You can embed Lua scripts directly
into a simulation scene that, for example, process simulated sensor data, run control
algorithms, implement user interfaces, or even send data to a physical robot. They also
provide a remote API that allows one to develop standalone applications in many
programming languages that are able to pass data in and out of a running CoppeliaSim
simulation.
3. CoppeliaSim is cross-platform, mostly open-source, and provides a free educational
license.

7.Additional Creative Inputs (If Any): -


Null

8.Learning outcomes (What I have learnt):


1. We have learned about open-source coppeliasim cross platform.
2. Learnt about robotics development platform environment to model, program and simulate
robots.
2. Learnt about various GUI development tools, dynamic simulation engines, collision
detection libraries and built in models.
University Institute of Engineering
Department of Computer Science & Engineering

Evaluation Grid (To be filled by Faculty):

Sr. Parameters Marks Obtained Maximum


No. Marks
1. Worksheet completion 8
including writing
learning Objective/Outcomes
(To be submitted at the end of
the day)
2. Viva-Voce 10
3. Conduct 8
Signature of Faculty Total Marks 30
(with Date): Obtained:
University Institute of Engineering
Department of Computer Science & Engineering

You might also like