diff --git a/ros_arduino_firmware/manifest.xml b/ros_arduino_firmware/manifest.xml index d601871..245bdf3 100644 --- a/ros_arduino_firmware/manifest.xml +++ b/ros_arduino_firmware/manifest.xml @@ -1,7 +1,7 @@ - ros_arduino_firmware + ROS Arduino Firmware Patrick Goebel diff --git a/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/MegaRobogaiaPololu.ino b/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/MegaRobogaiaPololu.ino index ccbae63..0f66429 100644 --- a/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/MegaRobogaiaPololu.ino +++ b/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/MegaRobogaiaPololu.ino @@ -208,8 +208,6 @@ int runCommand() { #ifdef USE_SERVOS case SERVO_WRITE: servos[arg1].write(arg2); - Serial.print(arg1); - Serial.print(arg2); Serial.println("OK"); break; case SERVO_READ: diff --git a/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/servos.h b/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/servos.h index 4a0d92d..6100723 100644 --- a/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/servos.h +++ b/ros_arduino_firmware/src/libraries/MegaRobogaiaPololu/servos.h @@ -1,11 +1,11 @@ /* Define the attachment of any servos here. - The example shows two servos attached on pins 3 and 6. + The example shows two servos attached on pins 3 and 5. */ #define N_SERVOS 2 Servo servos [N_SERVOS]; -byte servoPins [N_SERVOS] = {3, 6}; +byte servoPins [N_SERVOS] = {3, 5}; diff --git a/ros_arduino_msgs/manifest.xml b/ros_arduino_msgs/manifest.xml index dd70516..62ebb0b 100644 --- a/ros_arduino_msgs/manifest.xml +++ b/ros_arduino_msgs/manifest.xml @@ -1,7 +1,7 @@ - ros_arduino_msgs + ROS Arduino Messages Patrick Goebel diff --git a/ros_arduino_python/manifest.xml b/ros_arduino_python/manifest.xml index f12f132..1d04908 100644 --- a/ros_arduino_python/manifest.xml +++ b/ros_arduino_python/manifest.xml @@ -1,7 +1,7 @@ - ros_arduino_python + ROS Arduino Python Patrick Goebel diff --git a/ros_arduino_python/src/arduino_driver.py b/ros_arduino_python/src/arduino_driver.py index 1228437..c5f0e43 100755 --- a/ros_arduino_python/src/arduino_driver.py +++ b/ros_arduino_python/src/arduino_driver.py @@ -22,14 +22,17 @@ """ import thread -from math import pi as PI +from math import pi as PI, degrees, radians import os import time import sys from serial.serialutil import SerialException from serial import Serial -class Arduino: +SERVO_MAX = 180 +SERVO_MIN = 0 + +class Arduino: ''' Configuration Parameters ''' N_ANALOG_PORTS = 6 @@ -309,13 +312,15 @@ class Arduino: def servo_write(self, id, pos): ''' Usage: servo_write(id, pos) + Position is given in radians and converted to degrees before sending ''' - return self.execute_ack('s %d %d' %(id, pos)) + return self.execute_ack('s %d %d' %(id, min(SERVO_MAX, max(SERVO_MIN, degrees(pos))))) def servo_read(self, id): ''' Usage: servo_read(id) + The returned position is converted from degrees to radians ''' - return self.execute('t %d' %id) + return radians(self.execute('t %d' %id)) def ping(self, pin): ''' The srf05/Ping command queries an SRF05/Ping sonar sensor diff --git a/ros_arduino_python/src/arduino_driver.pyc b/ros_arduino_python/src/arduino_driver.pyc index 65e6182..5c14558 100644 Binary files a/ros_arduino_python/src/arduino_driver.pyc and b/ros_arduino_python/src/arduino_driver.pyc differ diff --git a/ros_arduino_python/src/arduino_sensors.py b/ros_arduino_python/src/arduino_sensors.py index ced0fa0..b3c6b24 100755 --- a/ros_arduino_python/src/arduino_sensors.py +++ b/ros_arduino_python/src/arduino_sensors.py @@ -72,7 +72,7 @@ class Sensor(object): else: self.msg.value = self.value - # At a timestamp and publish the message + # Add a timestamp and publish the message self.msg.header.stamp = rospy.Time.now() self.pub.publish(self.msg) diff --git a/ros_arduino_python/src/arduino_sensors.pyc b/ros_arduino_python/src/arduino_sensors.pyc index 5cdbfe2..079bd6d 100644 Binary files a/ros_arduino_python/src/arduino_sensors.pyc and b/ros_arduino_python/src/arduino_sensors.pyc differ diff --git a/stack.xml b/stack.xml index e31df54..f4c5a70 100644 --- a/stack.xml +++ b/stack.xml @@ -1,5 +1,5 @@ - ros_arduino_bridge + ROS Arduino Bridge Maintained by Patrick Goebel BSD