Talk:Cheesoid

From Nottinghack Wiki
Revision as of 17:19, 4 October 2011 by Msemtd (talk | contribs) (→‎Brains)
Jump to navigation Jump to search

Interaction Goals

Cheesoid is intended to be a fully autonomous mobile robot that interacts with people and objects in its environment. Human-Robot interaction is a massive subject but I intend to get some rudimentary (and comedic) speech and general input features in place as soon as possible. The environment interactions will develop as I learn more about sensing and mapping. Since the robot will live at Hackspace I have two basic goals for comedy value: -

  • interact with the fridge for cheese status
  • interact with the petrol pump for petrol status

So...

  • it needs to know where they are to go and talk to them
  • the status needs to be stored and needs to be set - Xino at each? Via IRC bot? Some web interface?
  • it need to be able to read the status from the fridge and the petrol pump - what sort of interface? IR remote control?

Petrol status

  • just a number!

Cheese status

  • many cheese types - each with use by date
  • Primula status is "in tube"

Human - Robot Interactions: speech

With the eeePC I have a very capable processor on board and I'm taking full advantage of that: -

  • using espeak for text to speech
  • using sphinx for speech recognition

Text to Speech with espeak

http://espeak.sourceforge.net/

The espeak voices aren't really robotic enough but can be made more so by creating a custom voice

speech recognition with sphinx

http://cmusphinx.sourceforge.net/wiki/tutorialconcepts

The sphinx packages

p    --\ sphinx2-bin                                                                                                                    <none>     0.6-2.1
  Description: speech recognition utilities
    Sphinx 2 is a real-time, speaker-independent speech recognition system.

    This package contains examples and utilities that use Sphinx. It also includes a sample language model that is capable of recognizing simple commands
    like "go forward ten meters" and other commands one might use to tell a robot where to move.
  Priority: optional
  Section: universe/sound
  Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
  Compressed size: 129k
  Uncompressed size: 500k
  Source Package: sphinx2
  --\ Depends (3)
    --- libc6 (>= 2.4)
    --- libsphinx2g0 (>= 0.6) (UNSATISFIED)
    --- sphinx2-hmm-6k (UNSATISFIED)
  --\ Packages which depend on sphinx2-bin (0)
  --\ Versions of sphinx2-bin (1)
p    0.6-2.1

Good examples of the use of sphinx: -

Conversations and dialogue

In order to have a meaningful (preferably amusing and slightly uncanny) interaction with humans there needs to be a dialogue and some involvement of non-verbal communications: perhaps some shared experience, empathy, etc. We can fake a lot of things to push the human participant closer to the goal!

Mobility

  • motors
  • wheels
  • chassis
  • motor power
  • motor control circuitry
  • big battery

Drive motors: I now have my 12V 150RPM gearmotors from China


OK, motors tested with a two motor circuit...

Motor Test sketch (non-PWM)

int motor_left[] = {
  2, 3};
int motor_right[] = {
  7, 8};
const int ledPin = 13;      // LED 
const int switchPin = 10;    // switch input
const int enablePin = 9;    // H-bridge enable pin


// ————————————————————————— Setup
void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(switchPin, INPUT); 
  pinMode(enablePin, OUTPUT);


  // Setup motors
  int i;
  for(i = 0; i < 2; i++){
    pinMode(motor_left[i], OUTPUT);
    pinMode(motor_right[i], OUTPUT);
  }
  check_enable();
  // blink the LED 3 times. This should happen only once.
  // if you see the LED blink three times, it means that the module
  // reset itself,. probably because the motor caused a brownout
  // or a short.
  blink(ledPin, 3, 100);

}


void check_enable(){
  digitalWrite(enablePin, digitalRead(switchPin));
}
// ————————————————————————— Loop
void loop() {

  drive_forward();
  delay(1000);
  motor_stop();
  Serial.println("1");

  drive_backward();
  delay(1000);
  motor_stop();
  Serial.println("2");

  turn_left();
  delay(1000);
  motor_stop();
  Serial.println("3");

  turn_right();
  delay(1000);
  motor_stop();
  Serial.println("4");

  motor_stop();
  delay(1000);
  motor_stop();
  Serial.println("5");
}

// ————————————————————————— Drive

void motor_stop(){
  check_enable();
  digitalWrite(motor_left[0], LOW);
  digitalWrite(motor_left[1], LOW);

  digitalWrite(motor_right[0], LOW);
  digitalWrite(motor_right[1], LOW);
  delay(25);
}

void drive_forward(){
  check_enable();
  digitalWrite(motor_left[0], HIGH);
  digitalWrite(motor_left[1], LOW);

  digitalWrite(motor_right[0], HIGH);
  digitalWrite(motor_right[1], LOW);
}

void drive_backward(){
  check_enable();
  digitalWrite(motor_left[0], LOW);
  digitalWrite(motor_left[1], HIGH);

  digitalWrite(motor_right[0], LOW);
  digitalWrite(motor_right[1], HIGH);
}

void turn_left(){
  check_enable();
  digitalWrite(motor_left[0], LOW);
  digitalWrite(motor_left[1], HIGH);

  digitalWrite(motor_right[0], HIGH);
  digitalWrite(motor_right[1], LOW);
}

void turn_right(){
  check_enable();
  digitalWrite(motor_left[0], HIGH);
  digitalWrite(motor_left[1], LOW);

  digitalWrite(motor_right[0], LOW);
  digitalWrite(motor_right[1], HIGH);
}

/*
    blinks an LED
 */
void blink(int whatPin, int howManyTimes, int milliSecs) {
  int i = 0;
  for ( i = 0; i < howManyTimes; i++) {
    digitalWrite(whatPin, HIGH);
    delay(milliSecs/2);
    digitalWrite(whatPin, LOW);
    delay(milliSecs/2);
  }
}

This sketch is a munge of http://letsmakerobots.com/node/2074 and http://itp.nyu.edu/physcomp/Labs/DCMotorControl

Bodywork

  • battery regulation: http://letsmakerobots.com/node/3880
  • battery mounting - where?
    • chassis strong enough to carry those batteries? !!!!
    • aluminium cross bracing?
    • perhaps move to 2x 6V - keep it flexible
  • cylinder case mods
    • speakers in mouth plate/grill
    • side mount for MCU1 and support boards (temporary?)
    • top for beacon - keep on side for now
    • mounting of cylinder on chassis

Motor shaft couplings being the most annoying thing right now

  • I really need some well made couplings like these

Small hose clips may be the thing.

Brains

The current design makes use of a few processors: the small cheap eeePC 701 4G netbook and a couple of inexpensive (£7) Xino Arduino micros.

MCU1 and MCU2

Xino devices

PIN usage on MCU1

MCU1 PIN usage summary table on Google Docs

  • PWM capable pins on the 328/Xino: 3,5,6,9,10,11
  • Dig out x2 for eyes
  • Dig in for mode switch
  • dig out for beacon (preferably on pin 13)
  • motor enable dig out
  • PWM x4 for motor logic control - can it be reduced?
  • bumper and cliff inputs - use serial mux?
  • others!

MCU1 software

  • TODO motor drive code and motor drive commands from PC

eeePC mods

Hardware and system mods to support "isolated usage".

  • soldered in an external power button cable
    • PWR button sub-assembly with safety keyswitch - mount on side panel
    • TODO LED in "Micro" and other nice illuminated buttons
    • Monostable/bistable startup flasher circuit for "Micro" switch?
  • "pizza box" container
    • power port extension
    • USB extension - USB hub - still powering MCU1 from USB - much drain?
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`

if [ $LID_STATE = "closed" ] ; then
#    /etc/acpi/suspend2ram.sh
        /bin/su user -c "/usr/bin/xrandr --output VGA --mode 800x600 --output LVDS --off"
fi
if [ $LID_STATE = "open" ] ; then
        /bin/su user -c "/usr/bin/xrandr --output LVDS --preferred --output VGA --off"
fi
exit 0

This is not enough: the eeePC will not power on with the lid closed so I had to disable the lid closed sensor by removing the magnet from screen section of the case

# minimal brightness
echo 0 > /sys/devices/platform/eeepc/backlight/eeepc/brightness"
# screen off after 2 minutes
xset dpms 0 0 120

eeePC problems

  • unionfs inode depletion causing "No space left on device" but df shows plenty of space!
  • running out of space due to other errors ~/.Xsession-errors
  • firefox won't start - oh well!

eeePC Software

  • console read and process
  • speech module
    • speech commands from stdin
    • speech thread - busy flag and job queue management
  • motor module
    • motor control input from STDIN
  • sensor module
    • camera module - look at Java interaction with V4L or whatever is in use
    • mic input - and speech recognition
    • GUI interface port and GUI app

Additional

Range Sensors

Rotary Encoders for wheels

  • an easily available "obsolete" ball type PS/2 mouse
  • Microsoft "Mouse Port Compatible Mouse 2.0A"
  • using the serial output from the mouse circuitry
  • encoder usage in daylight
  • mounting encoder wheel to axle