#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import rospy
from std_msgs.msg import String

leftPwr = 0
rightPwr = 0


GPIO.setmode(GPIO.BOARD)

GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)

fw1 = GPIO.PWM(7, 50)
bw1 = GPIO.PWM(11, 50)
fw2 = GPIO.PWM(13, 50)
bw2 = GPIO.PWM(16, 50)

fw1.start(0)
bw1.start(0)
fw2.start(0)
bw2.start(0)


def callback(data):
    rospy.loginfo(rospy.get_caller_id() + "%s", data.data)
    
    if (int(leftPwr) > 0):
        bw1.ChangeDutyCycle(0)
        fw1.ChangeDutyCycle(float(leftPwr))
    else:
        fw1.ChangeDutyCycle(0)
        bw1.ChangeDutyCycle(-1 * float(leftPwr))


    if (int(rightPwr) > 0):
        bw2.ChangeDutyCycle(0)
        fw2.ChangeDutyCycle(float(rightPwr))
    else:
        fw2.ChangeDutyCycle(0)
        bw2.ChangeDutyCycle(-1 * float(rightPwr))
            

    
def listener():
    rospy.init_node('motors', anonymous=True)

    rospy.Subscriber("commands", String, callback)
    
    rospy.spin()
    
if __name__ == '__main__':
    listener()

fw1.stop()
bw1.stop()
fw2.stop()
bw2.stop()

GPIO.cleanup()
@@ -101,34 +101,8 @@
 ng%0A%0A
-leftPwr = 0%0ArightPwr = 0%0A%0A
 %0AGPI
@@ -390,24 +390,25 @@
 (data):%0A    
+#
 rospy.loginf
@@ -413,47 +413,127 @@
 nfo(
-rospy.get_caller_id() + %22%25s%22, data.data
+data.data)%0A    pwrSet = data.data.split(%22+%22)%0A    leftPwr = pwrSet%5B0%5D%0A    rightPwr = pwrSet%5B1%5D%0A    rospy.loginfo(leftPwr
 )%0A  
@@ -551,32 +551,56 @@
 int(leftPwr) %3E 0
+ and int(leftPwr) %3C= 100
 ):%0A        bw1.C
@@ -659,34 +659,57 @@
 leftPwr))%0A    el
-se
+if (int(leftPwr) %3E= -100)
 :%0A        fw1.Ch
@@ -801,16 +801,41 @@
 Pwr) %3E 0
+ and int(rightPwr) %3C= 100
 ):%0A     
@@ -911,18 +911,42 @@
 )%0A    el
-se
+if (int(rightPwr) %3E= -100)
 :%0A      

Update motors.py to change motor output