Problem Solving In Computing And Programming

3y ago
16 Views
3 Downloads
3.07 MB
74 Pages
Last View : 24d ago
Last Download : 3m ago
Upload by : Milena Petrie
Transcription

VIPIoT and Robotics Problem Solvingin Visual ProgrammingLaboratory g Chen and Gennaro De LucaSchool of Computing, Informatics, and Decision Systems EngineeringArizona State UniversityPage 1

Table of ContentsChapter 1Introduction to ASU VIPLE . 6Chapter 2Essentials in ASU VIPLE . 82.1Basic Constructs in ASU VIPLE . 8Exercise 1. Hello World in ASU VIPLE .9Exercise 2. Input and Output in ASU VIPLE .9Exercise 3. A Simple Counter in ASU VIPLE .9Exercise 4. Using While-Loop to implement Counter . 102.2Activity and Parameter Passing in ASU VIPLE . 10Exercise 1. Activity and Parameter Passing . 10Exercise 2. Counter as an Activity in ASU VIPLE . 122.3Implementing finite state machine and event-driven programming . 13Exercise 1. Implement a Vending Machine . 13Exercise 2. Implement the Vending Machine Using Events . 14Exercise 3. Garage Door Opener (part 1) . 15Exercise 4. Garage Door Opener (part 2) . 16Exercise 5. Parity Detection . 16Chapter 3Controlling Simulated Robots Using ASU VIPLE . 173.1VIPLE Robot Services . 173.2Implementing Maze Navigation Algorithms in Robotics Simulation . 193.3Maze Navigation Algorithms Using Finite State Machine . 213.4Lab Assignments in Unity Simulator. 23Exercise 1. Drive-by-wire simulation . 23Exercise 2. Understanding the VIPLE Diagram . 25Exercise 3: Implement the VIPLE Diagram in Unity Simulator . 26Exercise 4: The Activities of the Two-Distance-Local-Best Algorithm . 26Exercise 5: The Main Diagram of the Two-Distance-Local-Best Algorithm . 273.5Lab Assignments in Web Simulator . 29Exercise 1: Web Simulator . 29Exercise 2: Configuring VIPLE to Use Web Simulator . 30Exercise 3: Implement Wall-Following Algorithm in Web Simulator: Main Diagram . 31Exercise 4: Implement Wall-Following Algorithm in Web Simulator: Activities . 31Exercise 5: Implement Two-Distance-Local-Best Algorithm in Web Simulator: Main . 33Exercise 6: Implement Two-Distance-Local-Best Algorithm in Web Simulator: Activities . 34Introduction to ASU VPL, Arizona State UniversityPage 2

Chapter 4Programming Intel Robots Using ASU VIPLE. 354.1Constructing and configuring your robot . 35Exercise 1. Build Your Robot . 35Exercise 2. Starting the Program on Edison Robot . 37Exercise 3. Pairing Edison Robot with the host computer . 374.2Sensor testing and remote controlling. 38Exercises 1. Sensor testing and configuration . 38Exercise 2. Drive-Edison Robot-by-wire in ASU VIPLE . 39Exercise 3. Improving the driving experience . 404.3Maze navigation using wall-following algorithm . 41Exercise 1. Robot Wall-following maze navigation (main diagram part 1) . 41Exercise 2. Robot Wall-following maze navigation (main diagram part 2) . 43Exercise 3. Write the Init Activity . 44Exercise 4. Left1 and Right1 Activities . 44Exercise 5. Right90 and Left90 Activities . 45Exercise 6. Backward and Forward Activities . 45Exercise 7. ResetState Activity . 464.4Maze navigation using local best heuristic algorithm. 46Exercise 1. Solving the Maze Using the Two-Distance Algorithm . 46Exercise 2. Controlling Intel Edison Robot in ASU VIPLE . 48Exercises 3. Implementing the Activities Used in the ASU VIPLE Program . 48Exercises 4. Using a simplified finite state machine. 494.5Implementing maze navigation using event-driven programming . 50Exercise 1. Redesign Left90 activity using event-driven programming style. 50Exercise 2. Redesign Left1 and Right90 using event-driven programming style . 51Exercise 3. Redesign the other activities using event-driven programming style . 51Exercise 4. The Main diagram based on the event-driven activities . 514.6Implementing sumo robot . 52Exercise 1. Basic sumo-robot program . 52Exercise 2. Advanced sumo-robot program . 53Chapter 5Controlling EV3 Robots Using ASU VIPLE . 545.1Working with EV3 robots . 54Exercise 1. Finding sensor reading from EV3 Brick . 54Exercise 2. Finding sensor reading by a program . 55Exercise 3. Connecting robot to Computer via Bluetooth or Wi-Fi . 555.2Remote control of EV3 robots . 57Introduction to ASU VPL, Arizona State UniversityPage 3

Exercise 1. Drive-EV3-by-wire in ASU VIPLE . 57Exercise 2. Improving the Driving Experience . 585.3Line-following program in ASU VIPLE . 59Exercise 1. Installing a color sensor . 59Exercise 2. Line-follower . 595.4Sumo Robot Programming . 60Exercise 1: Basic Sumo-Robot Algorithm . 61Exercise 2: Adding a touch sensor to the sumo-robot. 61Exercise 3: Adding the ultrasonic sensor to the sumo-robot. 625.5Wall-following program in ASU VIPLE . 62Exercise 1. EV3 Robot Wall-following maze navigation in ASU VIPLE (main diagram) . 62Exercise 2. Write the Init Activity . 64Exercise 3. Write the Left1 Activity . 64Exercise 4. Write the Right90 Activity . 65Exercise 5. Write the Left90 Activity . 65Exercise 6. Write the Right1 Activity . 65Exercise 7. Write the Backward Activity. 65Exercise 8. Write the ResetState Activity . 66Exercise 9. Write the Forward Activity . 66Exercise 10. Configure Sensors in Wall-following maze navigation in ASU VIPLE . 665.6Wall-following program using event-driven programming style . 67Exercise 1. Redesign Left90 activity using event-driven programming style. 67Exercise 2. Redesign the other activities using event-driven programming style . 68Exercise 3. The Main diagram based on the event-driven activities . 685.7Maze navigation using local best heuristic algorithm. 69Exercise 1. Implementing the Main diagram of the two distance algorithm . 69Exercise 2. Implementing SensorRight90 . 71Exercise 3. Implementing the other activities . 71Microsoft VPL is a milestone in software engineering and robotics from many aspects. It is serviceoriented; it is workflow-based; it is event-driven; it supports parallel computing; and it is a greateducational tool that is simple to learn and yet powerful and expressive.Introduction to ASU VPL, Arizona State UniversityPage 4

Sponsored by two Innovation Excellence awards from Microsoft Research in 2003 and in 2005, Dr.Yinong Chen participated in the earlier discussion of service-oriented robotics at Microsoft. MicrosoftVPL was immediately adopted by Chen in developing the freshman course CSE101 in 2006. The coursegrew from 70 students in 2006 to over 350 students in 2011. The course was extended to all students inIra A. Fulton Schools of Engineering at ASU and was renamed FSE100, which is offered to thousands offreshman engineering students now.Unfortunately, Microsoft stopped developing and supporting VPL recently, which lead to our FSE100course, and many other schools’ courses using VPL, without further support. Particularly, the currentversion of VPL does not support LEGO’s third generation of EV3 robot, while the second generation NXTis out of the market.To keep our course running and also help the other schools, we take the challenge and responsibility todevelop our own visual programming environment, ASU VIPLE, based on the IoT and Robot as a Serviceconcept. The purpose of this project is to provide a free environment supporting the VPL developmentcommunity in education and research. To serve this purpose, ASU VIPLE keeps the great features thatVPL has and provides a similar user interface and functionality, so that the MSRDS and VPL developmentcommunity can use ASU VIPLE with no learning curve. ASU VIPLE does not replace Microsoft VPL.Instead, it extends VPL in its capacity to connect to different physical robots, including EV3 and Intelbased open architecture robots.Robot as a Service and the ASU VIPLE environment are designed and developed by Yinong Chen andGennaro De Luca, with contributions from Calvin Cheng, Megan Plachecki, and Sami Mian. ASU VIPLEdocuments, software, and sample code can be downloaded from the ASU Web Service and Applicationrepository. The direct link is n to ASU VPL, Arizona State UniversityPage 5

Chapter 1Introduction to ASU VIPLEASU VIPLE uses the same computing model as Microsoft VPL. The program is running on a Windowscomputer, a desktop, a laptop, or a tablet. The computer sends commands to control the robotactuators (motors) and receives the sensory data and motor feedback from the robot. The data betweenthe computer and the robot is encoded in a JSON object which is in plain text format. It supports Wi-Fi,Bluetooth and USB connections between the main computer and the robot. ASU VIPLE supports EV3 andany self-developed robots. We have developed different robots based on Intel architecture, the Linuxoperating system, and the Windows operating system.Figure 1.1 compares the basic activities between ASU VIPLE and Microsoft VPL. VIPLE implemented mostbasic activities in VPL and implemented additional While, Break, and End While activities to facilitateloop building, which can reduce the circular paths in VPL diagrams.ASU VIPLE Basic ActivitiesMicrosoft VPLBasic ActivitiesFigure 1.1. Activities and services: ASU VIPLE versus Microsoft VPLAs can be seen that VIPLE has similar programming constructs and ca be used for the same kinds ofapplications using these basic activities.Introduction to ASU VPL, Arizona State UniversityPage 6

The usability of a language largely depends on the availability of library functions or called services.Figure 1.2 shows the ASU VIPLE services and Microsoft VPL services. Microsoft VPL implementedmultiple sets of vendor services, including general service, generic robot services, iRobot services, LEGONXT services, and simulated services. The general services and generic robot services include Log, Textto Speech, SpeechRecognizer, Simple Dialog, Direction Dialog, Timer, etc. VPL many implementedmultiple vendor services, such as LEGO NXT services, iRobot services, HiTechnic services, and simulatedservices.ASU VIPLE EV3 and Generic ServicesMicrosoft VPL Generic, Vendor, and Simulated ServicesFigure 1.2. ASU VIPLE services versus Microsoft VPL servicesIn the current VIPLE version, three sets of services are implemented only. The first set is a list of generalservices, including the Simple Dialog, Key Press Event (Direction Dialog), Text To Speech, Print Line (Log),Timer, and RESTful services. The second set of services is for EV3 robots, which correspond to the NXTservices in Microsoft VPL. The third set of services are used to connect to generic robots, sensors, andmotor services. The general services can be used not only for robots, but also for general purposeapplications. The addition of LEGO EV3 services allows the VPL developers who used NXT robots to usethe new LEGO EV3 robots. The generic robot services allow the developers to use VIPLE to connect to anopen architecture robot. In Microsoft VPL, DSS services developed specifically for MSRDS can be addedinto the VPL service list. In ASU VIPLE, RESTful services can be accessed in VIPLE diagram. As RESTfulservices are widely used in today’s Web application development, the access to RESTful services extendsthe capacity of VIPLE to a wide range of resources. ASU VIPLE does not have simulated serviced at thistime. A simulation environment is being implemented.Many improvements are made in ASU VIPLE. For example, ASU VIPLE use state.varaible consistently. InVPL, local variables (the location of a variable’s use has a direct link to the variable) use variable nameonly, while and global variables use state.variable syntax. It is not easy for inexperienced programmer torecognize the scope of variables and often causes confusion.Introduction to ASU VPL, Arizona State UniversityPage 7

Chapter 2Essentials in ASU VIPLEDownload ASU VIPLE software, sample codes, and tutorial at:http://neptune.fulton.ad.asu.edu/VIPLE/Unzip and open the folder Release, start the ASU VIPLE software from the file:VisualProgrammingEnvironment. Now, you can learn ASU VIPLE by following the tutorial exercises.ASU VIPLE is general purpose programming language and is turning-complete in its capacity. It can beused for any kind of computation tasks. In ASU VIPLE, A program is represented as a diagram ofworkflow, and the components are defined as activities in the diagram. We will learn the languagethrough a series of examples and exercises.2.1 Basic Constructs in ASU VIPLEThere are 10 basic activities that can be used for constructing programs. These activities are brieflyexplained in Figure 2.1, and they will be exercised in the following programming exercises. Activity: for creating components Variable: supports basic types (Int32, Double, String, Boolean, etc.) Calculate: Calculate the value of typical expression that issupported by C , Java Data: Introducing constant values in regular programming language Join: proceeds when all threads arrive; Can be used for parallel dataor threads. Merge: proceeds when one of the data or threads arrives. It can beused for creating the return point of a loop; If: same as regular programming language construct; It allowsmultiple conditions. Switch: same as regular programming language construct; While: start a loop; Break: exits a loop, andEnd While: returns to WhileFigure 2.1. Basic Activities in ASU VIPLEIntroduction to ASU VPL, Arizona State UniversityPage 8

Exercise 1. Hello World in ASU VIPLEASU VIPLE is similar to Microsoft VPL not only in concepts but also in programming. It is our intention tohave Microsoft VPL programmers use ASU VIPLE with little learning. We now show examples of basicprogramming in ASU VIPLE. We start with the Hello World program. Figure 2.2 shows the two versionsof code using VPL and ASU VIPLE. The two diagrams look the same. However, ASU VIPLE has simpl

Introduction to ASU VPL, Arizona State University Page 6 Chapter 1 Introduction to ASU VIPLE ASU VIPLE uses the same computing model as Microsoft VPL. The program is running on a Windows

Related Documents:

3.3 Problem solving strategies 26 3.4 Theory-informed field problem solving 28 3.5 The application domain of design-oriented and theory-informed problem solving 30 3.6 The nature of field problem solving projects 31 3.7 The basic set-up of a field problem solving project 37 3.8 Characteristics o

can use problem solving to teach the skills of mathematics, and how prob-lem solving should be presented to their students. They must understand that problem solving can be thought of in three different ways: 1. Problem solving is a subject for study in and of itself. 2. Problem solving is

Combating Problem Solving that Avoids Physics 27 How Context-rich Problems Help Students Engage in Real Problem Solving 28 The Relationship Between Students' Problem Solving Difficulties and the Design of Context-Rich Problems 31 . are solving problems. Part 4. Personalizing a Problem solving Framework and Problems.

The Problem Solving Inventory (PSI) [8] is a 35-item instrument (3 filler items) that measures the individual's perceptions regarding one's problem-solving abilities and problem-solving style in the everyday life. As such, it measures a person's appraisals of one's problem-solving abilities rather than the person's actual problem .

THREE PERSPECTIVES Problem solving as a goal: Learn about how to problem solve. Problem solving as a process: Extend and learn math concepts through solving selected problems. Problem solving as a tool for applications and modelling: Apply math to real-world or word problems, and use mathematics to model the situations in these problems.

What is Problem Solving? 2(1)(B) The student is expected to use a problem-solving model that incorporates analyzing given information, formulating a plan or strategy, determining a solution, justifying the solution, and evaluating the problem-solving process and the reasonableness of the solution. What is Problem Solving?

Problem Solving Methods There is no perfect method for solving all problems. There is no problem-solving computer to which we could simply describe a given problem and wait for it to provide the solution. Problem solving is a creative act and cannot be completely explained. However, we can still use certain accepted procedures

understanding in problem-solving is needed to improve their problem-solving skill. The previous research showed that map meetings learning including summary lecture, problem-solving session, and the plenary could help the novice students in understanding the physics concept and develop the problem-solving skill [11]. Therefore, this