SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Robotics: Designing and Building
     Multi-robot Systems
                     Day 2

UNO Summer 2010 High School
       Workshop
                     Raj Dasupta
                 Associate Professor
           Computer Science Department
           University of Nebraska, Omaha
   College of Information Science and Technology
Plan for Day 2
• Designing autonomous intelligence in
  robots...controller
  –   MyBot: Simple Obstacle Avoidance
  –   Blinking LEDs
  –   Controlling motors
  –   Camera-based object following
  –   Finte State machine: Lawn mower like pattern
  –   Obstacle Avoidance: Code review
  –   Line Follower: Code review
  –   Odometry: Simulation only
  –   Braitenberg: Code review
Designing the Robot’s Controller
• Controller contains the ‘brain’ of the robot



                        Controller

      Read input from                Send output
          sensors                    to actuators
Designing the Robot’s Controller
• Controller contains the ‘brain’ of the robot



                        Controller

      Read input from                Send output
          sensors                    to actuators
Reading the Input from the sensors
 #include <webots/robot.h>
 #include <webots/distance_sensor.h>
 #include <stdio.h>
 #define TIME_STEP 32
 int main() {
  wb_robot_init();
     WbDeviceTag ds = wb_robot_get_device("my_distance_sensor");
     wb_distance_sensor_enable(ds, TIME_STEP);
     while (1) {
       wb_robot_step(TIME_STEP);
       double dist = wb_distance_sensor_get_value(ds);
       printf("sensor value is %fn", dist);
     }
     return 0;
 }
Reading the Input from the sensors
                                                1. Get a handle to
      #include <webots/robot.h>                 the sensor device              This is the “name”
      #include <webots/distance_sensor.h>                                      field of the robot’s
      #include <stdio.h>                                                       sensor from the
      #define TIME_STEP 32                                                     scene tree

      int main() {
       wb_robot_init();
       WbDeviceTag ds = wb_robot_get_device("my_distance_sensor");
       wb_distance_sensor_enable(ds, TIME_STEP);
                                                                               How often to get
        while (1) {                                                            the data from the
          wb_robot_step(TIME_STEP);                                            sensor
          double dist = wb_distance_sensor_get_value(ds);
          printf("sensor value is %fn", dist);
        }
                          3. Get the sensor data...the general format of this step is
        return 0;         wb_<sensor_name>_get_value (sensor_handle)
      }
2. Enable the sensor device...the general format of this step is
wb_<sensor_name>_enable (sensor_handle, poll_time)
Designing the Robot’s Controller
• Controller contains the ‘brain’ of the robot



                        Controller

      Read input from                Send output
          sensors                    to actuators
Sending the output to actuators
#include <webots/robot.h>
#include <webots/servo.h>
#include <math.h>
#define TIME_STEP 32
int main() {
 wb_robot_init();
    WbDeviceTag servo = wb_robot_get_device("my_servo");
    double F = 2.0; // frequency 2 Hz
    double t = 0.0; // elapsed simulation time
    while (1) {
      double pos = sin(t * 2.0 * M_PI * F);
      wb_servo_set_position(servo, pos);
      wb_robot_step(TIME_STEP);
      t += (double)TIME_STEP / 1000.0;
    }
    return 0;
}
Designing the Robot’s Controller
• Controller contains the ‘brain’ of the robot



                        Controller

      Read input from                Send output
          sensors                    to actuators
A simple example
#include <webots/robot.h>
#include <webots/differential_wheels.h>
#include <webots/distance_sensor.h>
#define TIME_STEP 32
int main() {
 wb_robot_init();
    WbDeviceTag left_sensor = wb_robot_get_device("left_sensor");
    WbDeviceTag right_sensor = wb_robot_get_device("right_sensor");
    wb_distance_sensor_enable(left_sensor, TIME_STEP);
    wb_distance_sensor_enable(right_sensor, TIME_STEP);
    while (1) {
     wb_robot_step(TIME_STEP);
        // read sensors
        double left_dist = wb_distance_sensor_get_value(left_sensor);
        double right_dist = wb_distance_sensor_get_value(right_sensor);
        // compute behavior
        double left = compute_left_speed(left_dist, right_dist);
        double right = compute_right_speed(left_dist, right_dist);
        // actuate wheel motors
        wb_differential_wheels_set_speed(left, right);
    }
    return 0;
}
A simple example
#include <webots/robot.h>
#include <webots/differential_wheels.h>
#include <webots/distance_sensor.h>
#define TIME_STEP 32
int main() {
 wb_robot_init();
    WbDeviceTag left_sensor = wb_robot_get_device("left_sensor");
    WbDeviceTag right_sensor = wb_robot_get_device("right_sensor");
    wb_distance_sensor_enable(left_sensor, TIME_STEP);
    wb_distance_sensor_enable(right_sensor, TIME_STEP);
    while (1) {
     wb_robot_step(TIME_STEP);
                                                                           Get input from sensor data
        // read sensors
        double left_dist = wb_distance_sensor_get_value(left_sensor);
        double right_dist = wb_distance_sensor_get_value(right_sensor);
        // compute behavior
        double left = compute_left_speed(left_dist, right_dist);          A very simple controller
        double right = compute_right_speed(left_dist, right_dist);
        // actuate wheel motors
        wb_differential_wheels_set_speed(left, right);
    }                                                                     Send output to actuator
    return 0;
}
A few other points
#include <webots/robot.h>
#include <webots/differential_wheels.h>           Mandatory initialization
#include <webots/distance_sensor.h>               step...only used in C language
#define TIME_STEP 32
int main() {                                                                Keep doing this as long as
 wb_robot_init();
                                                                            the simulation (and the
    WbDeviceTag left_sensor = wb_robot_get_device("left_sensor");           robot) runs
    WbDeviceTag right_sensor = wb_robot_get_device("right_sensor");
    wb_distance_sensor_enable(left_sensor, TIME_STEP);
    wb_distance_sensor_enable(right_sensor, TIME_STEP);
    while (1) {
     wb_robot_step(TIME_STEP);                                                 • How often to get data
        // read sensors                                                        from simulated robot into
        double left_dist = wb_distance_sensor_get_value(left_sensor);          the controller program
        double right_dist = wb_distance_sensor_get_value(right_sensor);
                                                                               • Every controller must
        // compute behavior
        double left = compute_left_speed(left_dist, right_dist);               have it
        double right = compute_right_speed(left_dist, right_dist);
                                                                               • Must be called at regular
        // actuate wheel motors                                                intervals
        wb_differential_wheels_set_speed(left, right);
    }                                                                          • Placed inside main()
    return 0;
}
MyBot Controller
• Simple obstacle avoidance behavior
  – Get IR distance sensor inputs (both L and R)
  – If both of these readings are > 500... its an
    emergency, back up fast
  – If only one of these readings is > 500...turn
    proportionately to the sensor values
  – If both readings are < 500...nothing wrong, keep
    moving straight
• Let’s program this in Webots
E-puck: Spinning
• Start spinning left
• If left wheel speed > 1234, stop
E-puck: LED blinking
• Blink the 8 LEDs of the e-puck one after
  another
  – Turn all LEDs off
  – Count repeatedly from 1...8
     • Turn LED<count> on
• Note that in this example, we are not using
  any sensor inputs...the LEDS just start blinking
  in a circle when we start running the
  simulation
Camera Controller
• Objective: Follow a white ball
• How to do it...
  – Get the image from the camera
  – Calculate the brightest spot on the camera’s
    image...the portion of the image that has the
    highest intensity (white color of ball will have
    highest intensity)
  – Set the direction and speed of the wheels of the
    robot to move towards the brightest spot
State-based controller for object
       following with camera
             Analyze     Do some math
            image to     to calculate the
             find the     direction and
            brightest     speed of the
               spot      wheels to get to
                        the brightest spo
                                            Set wheel
Get image                                    speed to
  from                                          the
 camera                                     calculated
                                              values
State Machine
• Controller is usually implemented as a finite
  state machine


       State i
                                                                 State k

                                    State j
                 Transition (i,j)             Transition (J,k)
A finite state-based controller for
             avoiding obstacles

                                Stop
    One of L or R front                           40 steps complete
    sensors recording
        obstacles

                          40 steps not complete

     Moving                                                Make a
     forward                                               U-turn
                           Angle turned >= 180
                                 degrees



  Both L and R front
sensors not recording
    any obstacles
E-puck Webots Review
•   Obstacle Avoidance: Code review
•   Line Follower: Code review
•   Odometry: Simulation only
•   Braitenberg: Code review
Summary of Day 2 Activities
• Today we learned about the controller of a
  robot
• The controller is the autonomous, intelligent
  part of the robot
• The controller processes the inputs from the
  robot’s sensors and tells the robot’s actuator
  what to do
• We wrote the code for different controllers
  and reviewed some complex controllers
Plan for Day 3
• We will learn how to program some basic
  behaviors on the e-puck robot
  – Zachary will be teaching this section

Contenu connexe

En vedette

Semester of Code: Piloting Virtual Placements for Informatics across Europe
Semester of Code: Piloting Virtual Placements for Informatics across EuropeSemester of Code: Piloting Virtual Placements for Informatics across Europe
Semester of Code: Piloting Virtual Placements for Informatics across EuropeGrial - University of Salamanca
 
Course 1: Create and Prepare Debian7 VM Template
Course 1: Create and Prepare Debian7 VM TemplateCourse 1: Create and Prepare Debian7 VM Template
Course 1: Create and Prepare Debian7 VM TemplateImad Daou
 
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...Programa de prácticas en empresas internacionales para la Facultad de Ciencia...
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...Grial - University of Salamanca
 
Hack for Diversity and Social Justice
Hack for Diversity and Social JusticeHack for Diversity and Social Justice
Hack for Diversity and Social JusticeTyrone Grandison
 
Eee pc 1201n
Eee pc 1201nEee pc 1201n
Eee pc 1201nw2k111984
 
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy Workshop
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy WorkshopWelcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy Workshop
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy WorkshopTyrone Grandison
 
A survey of resources for introducing coding into schools
A survey of resources for introducing coding into schoolsA survey of resources for introducing coding into schools
A survey of resources for introducing coding into schoolsGrial - University of Salamanca
 
Московский workshop ЕАСD
Московский workshop ЕАСDМосковский workshop ЕАСD
Московский workshop ЕАСDElena Sosnovtseva
 
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizaje
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizajeModelado de servicios en contextos web. Aplicación en ecosistemas de aprendizaje
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizajeGrial - University of Salamanca
 
Course 1: Create and Prepare CentOS 6.7 VM Template
Course 1: Create and Prepare CentOS 6.7 VM TemplateCourse 1: Create and Prepare CentOS 6.7 VM Template
Course 1: Create and Prepare CentOS 6.7 VM TemplateImad Daou
 
Are nonusers socially disadvantaged?
Are nonusers socially disadvantaged? Are nonusers socially disadvantaged?
Are nonusers socially disadvantaged? Petr Lupac
 

En vedette (20)

Semester of Code: Piloting Virtual Placements for Informatics across Europe
Semester of Code: Piloting Virtual Placements for Informatics across EuropeSemester of Code: Piloting Virtual Placements for Informatics across Europe
Semester of Code: Piloting Virtual Placements for Informatics across Europe
 
Course 1: Create and Prepare Debian7 VM Template
Course 1: Create and Prepare Debian7 VM TemplateCourse 1: Create and Prepare Debian7 VM Template
Course 1: Create and Prepare Debian7 VM Template
 
Learning services-based technological ecosystems
Learning services-based technological ecosystemsLearning services-based technological ecosystems
Learning services-based technological ecosystems
 
Aléjate de mi
Aléjate de miAléjate de mi
Aléjate de mi
 
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...Programa de prácticas en empresas internacionales para la Facultad de Ciencia...
Programa de prácticas en empresas internacionales para la Facultad de Ciencia...
 
EHISTO - Second Newsletter
EHISTO - Second NewsletterEHISTO - Second Newsletter
EHISTO - Second Newsletter
 
Matematicas 2013
Matematicas 2013Matematicas 2013
Matematicas 2013
 
Research Perfection
Research PerfectionResearch Perfection
Research Perfection
 
The cloud
The cloudThe cloud
The cloud
 
Hack for Diversity and Social Justice
Hack for Diversity and Social JusticeHack for Diversity and Social Justice
Hack for Diversity and Social Justice
 
Eee pc 1201n
Eee pc 1201nEee pc 1201n
Eee pc 1201n
 
SocialNet
SocialNetSocialNet
SocialNet
 
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy Workshop
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy WorkshopWelcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy Workshop
Welcome & Introductory Remarks - IEEE 2014 Web 2.0 Security & Privacy Workshop
 
WP7 - Dissemination
WP7 - DisseminationWP7 - Dissemination
WP7 - Dissemination
 
A survey of resources for introducing coding into schools
A survey of resources for introducing coding into schoolsA survey of resources for introducing coding into schools
A survey of resources for introducing coding into schools
 
Московский workshop ЕАСD
Московский workshop ЕАСDМосковский workshop ЕАСD
Московский workshop ЕАСD
 
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizaje
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizajeModelado de servicios en contextos web. Aplicación en ecosistemas de aprendizaje
Modelado de servicios en contextos web. Aplicación en ecosistemas de aprendizaje
 
Course 1: Create and Prepare CentOS 6.7 VM Template
Course 1: Create and Prepare CentOS 6.7 VM TemplateCourse 1: Create and Prepare CentOS 6.7 VM Template
Course 1: Create and Prepare CentOS 6.7 VM Template
 
Lesson11math
Lesson11mathLesson11math
Lesson11math
 
Are nonusers socially disadvantaged?
Are nonusers socially disadvantaged? Are nonusers socially disadvantaged?
Are nonusers socially disadvantaged?
 

Similaire à Day 2 slides UNO summer 2010 robotics workshop

TP_Webots_7mai2021.pdf
TP_Webots_7mai2021.pdfTP_Webots_7mai2021.pdf
TP_Webots_7mai2021.pdfkiiway01
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Arduino Final Project
Arduino Final ProjectArduino Final Project
Arduino Final ProjectBach Nguyen
 
project_NathanWendt
project_NathanWendtproject_NathanWendt
project_NathanWendtNathan Wendt
 
Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1Nicholas Parisi
 
Obstacle avoiding Robot
Obstacle avoiding RobotObstacle avoiding Robot
Obstacle avoiding RobotRasheed Khan
 
Report - Line Following Robot
Report - Line Following RobotReport - Line Following Robot
Report - Line Following RobotDivay Khatri
 
PC-based mobile robot navigation sytem
PC-based mobile robot navigation sytemPC-based mobile robot navigation sytem
PC-based mobile robot navigation sytemANKIT SURATI
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and roboticsSiddhant Chopra
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxethannguyen1618
 
VIRA_Basics_of_Robot_Level_1.pptx
VIRA_Basics_of_Robot_Level_1.pptxVIRA_Basics_of_Robot_Level_1.pptx
VIRA_Basics_of_Robot_Level_1.pptxSarafrajBeg1
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
 
Vision Based Autonomous Mobile Robot Navigation
Vision Based Autonomous Mobile Robot NavigationVision Based Autonomous Mobile Robot Navigation
Vision Based Autonomous Mobile Robot NavigationNiaz Mohammad
 
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion TutorialOculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion TutorialChris Zaharia
 

Similaire à Day 2 slides UNO summer 2010 robotics workshop (20)

TP_Webots_7mai2021.pdf
TP_Webots_7mai2021.pdfTP_Webots_7mai2021.pdf
TP_Webots_7mai2021.pdf
 
MSI UI Software Design Report
MSI UI Software Design ReportMSI UI Software Design Report
MSI UI Software Design Report
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Resume
ResumeResume
Resume
 
Arduino Final Project
Arduino Final ProjectArduino Final Project
Arduino Final Project
 
project_NathanWendt
project_NathanWendtproject_NathanWendt
project_NathanWendt
 
Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1
 
Obstacle avoiding Robot
Obstacle avoiding RobotObstacle avoiding Robot
Obstacle avoiding Robot
 
Report - Line Following Robot
Report - Line Following RobotReport - Line Following Robot
Report - Line Following Robot
 
Me 405 final report
Me 405 final reportMe 405 final report
Me 405 final report
 
chapter 4
chapter 4chapter 4
chapter 4
 
Automotive report
Automotive report Automotive report
Automotive report
 
PC-based mobile robot navigation sytem
PC-based mobile robot navigation sytemPC-based mobile robot navigation sytem
PC-based mobile robot navigation sytem
 
Pic18 f4520 and robotics
Pic18 f4520 and roboticsPic18 f4520 and robotics
Pic18 f4520 and robotics
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
VIRA_Basics_of_Robot_Level_1.pptx
VIRA_Basics_of_Robot_Level_1.pptxVIRA_Basics_of_Robot_Level_1.pptx
VIRA_Basics_of_Robot_Level_1.pptx
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Vision Based Autonomous Mobile Robot Navigation
Vision Based Autonomous Mobile Robot NavigationVision Based Autonomous Mobile Robot Navigation
Vision Based Autonomous Mobile Robot Navigation
 
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion TutorialOculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion Tutorial
 

Dernier

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 

Dernier (20)

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 

Day 2 slides UNO summer 2010 robotics workshop

  • 1. Robotics: Designing and Building Multi-robot Systems Day 2 UNO Summer 2010 High School Workshop Raj Dasupta Associate Professor Computer Science Department University of Nebraska, Omaha College of Information Science and Technology
  • 2. Plan for Day 2 • Designing autonomous intelligence in robots...controller – MyBot: Simple Obstacle Avoidance – Blinking LEDs – Controlling motors – Camera-based object following – Finte State machine: Lawn mower like pattern – Obstacle Avoidance: Code review – Line Follower: Code review – Odometry: Simulation only – Braitenberg: Code review
  • 3. Designing the Robot’s Controller • Controller contains the ‘brain’ of the robot Controller Read input from Send output sensors to actuators
  • 4. Designing the Robot’s Controller • Controller contains the ‘brain’ of the robot Controller Read input from Send output sensors to actuators
  • 5. Reading the Input from the sensors #include <webots/robot.h> #include <webots/distance_sensor.h> #include <stdio.h> #define TIME_STEP 32 int main() { wb_robot_init(); WbDeviceTag ds = wb_robot_get_device("my_distance_sensor"); wb_distance_sensor_enable(ds, TIME_STEP); while (1) { wb_robot_step(TIME_STEP); double dist = wb_distance_sensor_get_value(ds); printf("sensor value is %fn", dist); } return 0; }
  • 6. Reading the Input from the sensors 1. Get a handle to #include <webots/robot.h> the sensor device This is the “name” #include <webots/distance_sensor.h> field of the robot’s #include <stdio.h> sensor from the #define TIME_STEP 32 scene tree int main() { wb_robot_init(); WbDeviceTag ds = wb_robot_get_device("my_distance_sensor"); wb_distance_sensor_enable(ds, TIME_STEP); How often to get while (1) { the data from the wb_robot_step(TIME_STEP); sensor double dist = wb_distance_sensor_get_value(ds); printf("sensor value is %fn", dist); } 3. Get the sensor data...the general format of this step is return 0; wb_<sensor_name>_get_value (sensor_handle) } 2. Enable the sensor device...the general format of this step is wb_<sensor_name>_enable (sensor_handle, poll_time)
  • 7. Designing the Robot’s Controller • Controller contains the ‘brain’ of the robot Controller Read input from Send output sensors to actuators
  • 8. Sending the output to actuators #include <webots/robot.h> #include <webots/servo.h> #include <math.h> #define TIME_STEP 32 int main() { wb_robot_init(); WbDeviceTag servo = wb_robot_get_device("my_servo"); double F = 2.0; // frequency 2 Hz double t = 0.0; // elapsed simulation time while (1) { double pos = sin(t * 2.0 * M_PI * F); wb_servo_set_position(servo, pos); wb_robot_step(TIME_STEP); t += (double)TIME_STEP / 1000.0; } return 0; }
  • 9. Designing the Robot’s Controller • Controller contains the ‘brain’ of the robot Controller Read input from Send output sensors to actuators
  • 10. A simple example #include <webots/robot.h> #include <webots/differential_wheels.h> #include <webots/distance_sensor.h> #define TIME_STEP 32 int main() { wb_robot_init(); WbDeviceTag left_sensor = wb_robot_get_device("left_sensor"); WbDeviceTag right_sensor = wb_robot_get_device("right_sensor"); wb_distance_sensor_enable(left_sensor, TIME_STEP); wb_distance_sensor_enable(right_sensor, TIME_STEP); while (1) { wb_robot_step(TIME_STEP); // read sensors double left_dist = wb_distance_sensor_get_value(left_sensor); double right_dist = wb_distance_sensor_get_value(right_sensor); // compute behavior double left = compute_left_speed(left_dist, right_dist); double right = compute_right_speed(left_dist, right_dist); // actuate wheel motors wb_differential_wheels_set_speed(left, right); } return 0; }
  • 11. A simple example #include <webots/robot.h> #include <webots/differential_wheels.h> #include <webots/distance_sensor.h> #define TIME_STEP 32 int main() { wb_robot_init(); WbDeviceTag left_sensor = wb_robot_get_device("left_sensor"); WbDeviceTag right_sensor = wb_robot_get_device("right_sensor"); wb_distance_sensor_enable(left_sensor, TIME_STEP); wb_distance_sensor_enable(right_sensor, TIME_STEP); while (1) { wb_robot_step(TIME_STEP); Get input from sensor data // read sensors double left_dist = wb_distance_sensor_get_value(left_sensor); double right_dist = wb_distance_sensor_get_value(right_sensor); // compute behavior double left = compute_left_speed(left_dist, right_dist); A very simple controller double right = compute_right_speed(left_dist, right_dist); // actuate wheel motors wb_differential_wheels_set_speed(left, right); } Send output to actuator return 0; }
  • 12. A few other points #include <webots/robot.h> #include <webots/differential_wheels.h> Mandatory initialization #include <webots/distance_sensor.h> step...only used in C language #define TIME_STEP 32 int main() { Keep doing this as long as wb_robot_init(); the simulation (and the WbDeviceTag left_sensor = wb_robot_get_device("left_sensor"); robot) runs WbDeviceTag right_sensor = wb_robot_get_device("right_sensor"); wb_distance_sensor_enable(left_sensor, TIME_STEP); wb_distance_sensor_enable(right_sensor, TIME_STEP); while (1) { wb_robot_step(TIME_STEP); • How often to get data // read sensors from simulated robot into double left_dist = wb_distance_sensor_get_value(left_sensor); the controller program double right_dist = wb_distance_sensor_get_value(right_sensor); • Every controller must // compute behavior double left = compute_left_speed(left_dist, right_dist); have it double right = compute_right_speed(left_dist, right_dist); • Must be called at regular // actuate wheel motors intervals wb_differential_wheels_set_speed(left, right); } • Placed inside main() return 0; }
  • 13. MyBot Controller • Simple obstacle avoidance behavior – Get IR distance sensor inputs (both L and R) – If both of these readings are > 500... its an emergency, back up fast – If only one of these readings is > 500...turn proportionately to the sensor values – If both readings are < 500...nothing wrong, keep moving straight • Let’s program this in Webots
  • 14. E-puck: Spinning • Start spinning left • If left wheel speed > 1234, stop
  • 15. E-puck: LED blinking • Blink the 8 LEDs of the e-puck one after another – Turn all LEDs off – Count repeatedly from 1...8 • Turn LED<count> on • Note that in this example, we are not using any sensor inputs...the LEDS just start blinking in a circle when we start running the simulation
  • 16. Camera Controller • Objective: Follow a white ball • How to do it... – Get the image from the camera – Calculate the brightest spot on the camera’s image...the portion of the image that has the highest intensity (white color of ball will have highest intensity) – Set the direction and speed of the wheels of the robot to move towards the brightest spot
  • 17. State-based controller for object following with camera Analyze Do some math image to to calculate the find the direction and brightest speed of the spot wheels to get to the brightest spo Set wheel Get image speed to from the camera calculated values
  • 18. State Machine • Controller is usually implemented as a finite state machine State i State k State j Transition (i,j) Transition (J,k)
  • 19. A finite state-based controller for avoiding obstacles Stop One of L or R front 40 steps complete sensors recording obstacles 40 steps not complete Moving Make a forward U-turn Angle turned >= 180 degrees Both L and R front sensors not recording any obstacles
  • 20. E-puck Webots Review • Obstacle Avoidance: Code review • Line Follower: Code review • Odometry: Simulation only • Braitenberg: Code review
  • 21. Summary of Day 2 Activities • Today we learned about the controller of a robot • The controller is the autonomous, intelligent part of the robot • The controller processes the inputs from the robot’s sensors and tells the robot’s actuator what to do • We wrote the code for different controllers and reviewed some complex controllers
  • 22. Plan for Day 3 • We will learn how to program some basic behaviors on the e-puck robot – Zachary will be teaching this section