Tuesday, October 30, 2012

Structure of 'Bot in Python

The goal of the first phase of my 'Bot project is to have the entire platform integrated but operating under control of a web application.   The web application will pass commands to Python code running on the onboard RPi, which in turn will drive the Arduino to manage the 'Bot.  I am close to completing this first phase but for a fair amount of tuning...of the software, the hardware, and the integration of the two!  

The structure of things, however, is fairly well established so this post is intended to provide a high level overview of the python code running on the RPi.

Initialization, a dictionary used for a command and control structure, and the primary processing loop comprise the module Main.py.   The other modules of the 'Bot, mostly called from within the Main.py processing loop, are as follows:
  • Bridge.py - Not in use right now but anticipated to be the home of autonomous logic.
  • Control.py - Gets commands from the PHP web control script, via the ControlDaemon.py, and passes them on for execution.
  • Mapping.py - My thought was that this module would generate a map of a room using the rangefinder.   It currently does a scan but until I figure out how to accurately pin the robot position I am not sure how this will work.
  • Navigation.py - Not in use now but for returning a bearing.  Will ultimately keep track of exactly where the 'bot is and where it is going.
  • Propulsion.py - Controls the treads to move forward, backward, and to turn. 
  • Proximity.py - Detects objects using the four corner infra-red detectors and issues a stop order for propulsion.
  • Py2Ard.py - Called by any module needing to interface with the Arduino.   Discussed here in this blog.
  • Radar.py - Controls the ultrasonic sensors in a collision and speed governing mode while moving forward.  During mapping operations is driven by Mapping.py to scan an rangefind obstacles.
  • Sensor.py - Controls the two servo's that orient the pan and tilt sensor platform on which the radar (rangefinder) and webcam reside.
  • Utility.py - Home for a number of utility functions and supported by UtilityDaemon.py where lower priority processing is conducted.
As mentioned above a PHP script called Robot.php runs in the cloud and is used for manual control of the phase 1 robot.

No comments:

Post a Comment