#!/usr/bin/env python

import roslib
roslib.load_manifest('cherokey_car')

import rospy
import logging
from pygalileo.arduino import *
from std_msgs.msg import String

class Car(object):
    class Motor(object):
        def __init__(self, direction_pin, speed_pin):
            self.direction_pin = direction_pin
            self.speed_pin = speed_pin

            pinMode(self.direction_pin, OUTPUT)
            pinMode(self.speed_pin, OUTPUT)

            self.stop()

        def run(self, direction, speed):
            analogyWrite(self.speed_pin, speed)
            digitalWrite(self.direction_pin, direction)

        def stop(self):
            digitalWrite(self.direction_pin, LOW)
            digitalWrite(self.speed_pin, LOW)

    def __init__(self):
        self.right_motor = Car.Motor(4, 5)
        self.left_motor = Car.Motor(7, 6)

        self.sub = rospy.Subscriber('car_control', String, self.control_callback)
        rospy.loginfo('Car.__init__')

    def control_callback(self, data):
        self.move_forward(100, 100)
        delay(5000)
        self.stop()

    def stop(self):
        self.right_motor.stop()
        self.left_motor.stop()

    def move_forward(self, left_speed, right_speed):
        self.left_motor.run(HIGH, left_speed)
        self.right_motor.run(HIGH, right_speed)

def main():
    log = logging.getLogger('pygalileo')
    log.setLevel(logging.INFO)

    rospy.init_node('car', log_level=rospy.INFO)

    car = Car()

    rospy.spin()

if __name__ == '__main__':
    main()

@@ -521,15 +521,15 @@
     
-analogy
+digital
 Writ
@@ -546,21 +546,20 @@
 ed_pin, 
-speed
+HIGH
 )%0A      
@@ -746,32 +746,79 @@
 __init__(self):%0A
+        rospy.loginfo('Car.__init__')%0A        %0A
         self.rig
@@ -972,46 +972,8 @@
 ack)
-%0A        rospy.loginfo('Car.__init__')
 %0A%0A  
@@ -1020,25 +1020,216 @@
     
-self.move_forward
+rospy.loginfo('Car.control_callback %25s' %25 data.data)%0A        %0A        actions = %7B%22w%22: self.move_forward, %22s%22: self.move_backward, %22a%22: self.turn_left, %22d%22: self.turn_right%7D%0A        %0A        actions%5Bdata.data%5D
 (100
@@ -1249,17 +1249,17 @@
   delay(
-5
+3
 000)%0A   
@@ -1507,16 +1507,492 @@
 _speed)%0A
+        %0A    def move_backward(self, left_speed, right_speed):%0A        self.left_motor.run(LOW, left_speed)%0A        self.right_motor.run(LOW, right_speed)%0A        %0A    def turn_left(self, left_speed, right_speed):%0A        self.left_motor.run(LOW, left_speed)%0A        self.right_motor.run(HIGH, right_speed)%0A        %0A    def turn_right(self, left_speed, right_speed):%0A        self.left_motor.run(HIGH, left_speed)%0A        self.right_motor.run(LOW, right_speed)        %0A        
 %0Adef mai

Fix cherokey car movement issue to use digitalWrite as workaround