THOMAS THE STATE MACHINE
  • Home
  • Design
    • Mechanical
    • Software
    • Electrical
  • The Team
  • Bill of Materials
  • Gems of Wisdom
  • Gallery

Software

State Charts

Master SM

The MasterSM was the top level state machine in our hierarchy. It managed three things: navigation to a recycling point, navigation from a recycling point to the catching point (to catch balls launched onto our collector) and to handle an edge case wherein we'd get stuck in a loop of collisions. The MasterSM kept track of the recycling centre that was currently being handled (either one of east or west) and the assigned emit frequency to open the door. 
Picture

Go To Recycle

This state machine handled the navigation from any point on the assigned hemisphere of the robot to the assigned recycling centre. This was done by a sequence that first found the line, aligned with it and followed it till collision with the recycling centre wall. By the end of the project, we added states to manage edge cases like going off the line, unexpected collisions, not being able to find the line, etc.
Picture

Go To Catching Point

Since the arena was symmetrical, our team had decided to abstract the recycling and landfill centres as "opposite", "left", "right" and "home" beacons. This way our navigation was independent of whether we were the north our the south team. The conversion from the COMPASS information to our convention was done in the SPI (communication) module itself so that the rest of our system could follow the convention agnostic to which team we were.

Navigation from the left or the right recycling centres was done using closed loop control (two loops: one for RPM control and one for position using encoder ticks). 
Picture

Drive SM

The DriveSM was a state machine that made available drive functions such as stopping, driving forward/reverse, turning left/right with or without a specified distance/angle. We decided to add this as a state machine as it made navigation very simple and abstracted all low-level motor drive functions. DriveSM also managed unexpected collisions.
Picture

Collision SM

The CollisionSM state machine posts events for collisions with the wall as well as with other robots using information from the limit switches (front and back) as well as the tape sensor that senses IR reflected off of the retroreflective tape on other robots. 
Picture

Ball Collector SM

The BallCollectorSM is a simple flat state machine that controls the actuation of the ball collector DC motor for either collection or dispensing balls and the trap door opening and closing based on events passed to it by MasterSM.
Picture

SPI SM

The SPISM is a flat state machine that manages the SPI communication between the TIVA and the COMPASS. It performs team registration and queries for information regarding the recycling centre, recyclable ball colour and the emit frequency.
Picture

Code Listings

analogservice.h
File Size: 0 kb
File Type: h
Download File

ballcollectorsm.h
File Size: 0 kb
File Type: h
Download File

coloursensor.h
File Size: 0 kb
File Type: h
Download File

collisionsm.h
File Size: 0 kb
File Type: h
Download File

driveparameters.h
File Size: 1 kb
File Type: h
Download File

drivesm.h
File Size: 0 kb
File Type: h
Download File

encodermodule.h
File Size: 1 kb
File Type: h
Download File

gotocatchingpoint.h
File Size: 0 kb
File Type: h
Download File

gotorecycle.h
File Size: 0 kb
File Type: h
Download File

irdetectorss.h
File Size: 0 kb
File Type: h
Download File

motordrive.h
File Size: 0 kb
File Type: h
Download File

i2cservice.h
File Size: 1 kb
File Type: h
Download File

iremitter.h
File Size: 0 kb
File Type: h
Download File

limitswitchdb.h
File Size: 0 kb
File Type: h
Download File

linefollowingsm.h
File Size: 0 kb
File Type: h
Download File

mastersm.h
File Size: 0 kb
File Type: h
Download File

navfromleft.h
File Size: 0 kb
File Type: h
Download File

navfromright.h
File Size: 1 kb
File Type: h
Download File

spism.h
File Size: 1 kb
File Type: h
Download File

tapesensorservice.h
File Size: 0 kb
File Type: h
Download File

tcs3472x.h
File Size: 5 kb
File Type: h
Download File

analogservice.c
File Size: 7 kb
File Type: c
Download File

ballcollectorsm.c
File Size: 19 kb
File Type: c
Download File

coloursensor.c
File Size: 10 kb
File Type: c
Download File

collisionsm.c
File Size: 9 kb
File Type: c
Download File

drivesm.c
File Size: 17 kb
File Type: c
Download File

encodermodule.c
File Size: 14 kb
File Type: c
Download File

gotocatchingpoint.c
File Size: 15 kb
File Type: c
Download File

gotorecycle.c
File Size: 43 kb
File Type: c
Download File

irdetectorss.c
File Size: 9 kb
File Type: c
Download File

motordrive.c
File Size: 20 kb
File Type: c
Download File

i2cservice.c
File Size: 25 kb
File Type: c
Download File

iremitter.c
File Size: 5 kb
File Type: c
Download File

limitswitchdb.c
File Size: 6 kb
File Type: c
Download File

linefollowingsm.c
File Size: 7 kb
File Type: c
Download File

mastersm.c
File Size: 26 kb
File Type: c
Download File

navfromleft.c
File Size: 19 kb
File Type: c
Download File

navfromright.c
File Size: 18 kb
File Type: c
Download File

spism.c
File Size: 21 kb
File Type: c
Download File

tapesensorservice.c
File Size: 4 kb
File Type: c
Download File

Powered by Create your own unique website with customizable templates.
  • Home
  • Design
    • Mechanical
    • Software
    • Electrical
  • The Team
  • Bill of Materials
  • Gems of Wisdom
  • Gallery