SlideShare a Scribd company logo
1 of 22
Download to read offline
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

More Related Content

Viewers also liked

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
 

Viewers also liked (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?
 

Similar to 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
 

Similar to 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
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

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