CSCI Introduction to Robotics Lab 1: Reactive Behaviors and State Machines Solution

$30.00 $24.00

The goals of this lab are to understand Basic reactive behaviors such as attraction and avoidance How to compose multiple behaviors into more complex ones The notion of state and basic ways of implementation You need: A functional Sparkiduino development environment Sparki robot Line-following map Overview A very simple way to program a robot is…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

The goals of this lab are to understand

  • Basic reactive behaviors such as attraction and avoidance

  • How to compose multiple behaviors into more complex ones

  • The notion of state and basic ways of implementation

You need:

  • A functional Sparkiduino development environment

  • Sparki robot

  • Line-following map

Overview

A very simple way to program a robot is to directly tie its sensor input to wheel motion. Examples include obstacle avoidance, for example “turn right if you see an obstacle in front”, light following or avoidance, or line following. One type of these robots is a Braitenberg Vehicle“. It would be quite limiting, however, if robots would exhibit always the same behavior when presented with stimuli. To achieve more complex behaviors, robots need to switch between different operational modes based on the context they’re in. In the first part of this lab, you will play with different standard behaviors. You will then create a simple finite state machine and switch between different behaviors to accomplish a complex task.

Instructions

Each group must develop their own software implementation and turn in individual lab reports. You are encouraged to engage with your lab partners for collaborative problem-solving, but are expected to turn in your own write-ups. If your group does not finish the implementation by the end of the class, you may continue this lab on your own time as a complete group. A limited number of Sparkis will be available to sign out after each lab, and must be returned by the following lecture.

Part 1: Introduction to Arduino/Sparki

Use the instructions on the Sparki website to run and understand a series of basic reactive behaviors:

  1. Wall avoidance

  1. Light following

  1. Line following.

Part 2: Implementation

Implement a state machine-based controller that recreates the following behavior:

The robot rotates in place until it detects an object within 30cm with its ultrasound sensor. The robot then drives to within 7cm of the detected object and captures it in its gripper. Once the object is secured, the robot turns 180 degrees and drives until it detects a line. Once it has found a line, the robot will follow it until reaching the “start” marker, at which point it stops, beeps, and drops the carried object.

HINT 1: If you are stuck on the “C” syntax or the Arduino code peculiarities, look for help in the “Coding” section of the Sparki Website

HINT 2: This code will be more readable if you use a switch” statement. You can use “pound defines” such as “#define STATENAME number” to make your code more readable (e.g., #define START_STATE 1).

HINT 3: Planning your answer for Part 3 – #1 before writing code will make this easier.

Part 3: Lab Report

Create a report that includes/answers the following:

  1. A drawing of your state machine. Make sure all the states and transitions are labeled and that it is faithful to your implementation.

  1. The names of everyone in your lab group.

  1. Were you able to get your program to complete the task? If not, which parts failed? Why?

  1. A statement indicating whether you have worked with the C programming language before, and if so, describe your experience.

  1. A statement indicating your level of prior experience with the Arduino platform, if any.

  1. How much time did you spend programming Part 2 of this lab?

  1. (Optional, confidential, not for credit) A brief description of any problems (either technical or collaborative) encountered while performing this lab (e.g., issues with the clarity of instructions, clarity of documentation, lab colleague’s behavior, etc.).

CSCI Introduction to Robotics Lab 1: Reactive Behaviors and State Machines Solution
$30.00 $24.00