Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
Change the rospy.rate.
Cahnge queue_size.
  • Loading branch information
zisi committed Oct 26, 2015
1 parent 57d470d commit 674d6d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Software/ROS/openbionics/scripts/RobotHand.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def __init__(self):
sys.exit(1)
self.MCU.close()

self.rate = rospy.Rate(100)
self.rate = rospy.Rate(200)
self.CommandSub = rospy.Subscriber(
'RobotHandCmd', Command, self.CommandCB)
self.MotorStatePub = rospy.Publisher(
'MotorState', MotorState,
queue_size = 10)
queue_size = 100)
self.RobotHandAckPub = rospy.Publisher(
'RobotHandAck', Acknowledge,
queue_size = 10)
queue_size = 100)

def CommandCB(self, OutData):
self.MCUCommunication(OutData.cmd)
Expand Down
23 changes: 12 additions & 11 deletions Software/ROS/openbionics/scripts/SliderBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
def SliderBox():
SliderBoxCmd = rospy.Publisher(
'RobotHandCmd', Command,
queue_size = 10)
queue_size = 100)
rospy.init_node('SliderBox', anonymous=True)
rate = rospy.Rate(100) # 10hz
rate = rospy.Rate(200)
while not rospy.is_shutdown():
# Send Command to SliderBox and Read the Response
cmd = SliderBoxSerial("gs")
cmd = cmd[:-1].split(';')
if (int(cmd[0]) == 0):
# Send to Robot Hand the Command
cmd = 'ps %s' % cmd[1]
SliderBoxCmd.publish(cmd)
rate.sleep()
# Send Command to SliderBox and Read the Response
cmd = SliderBoxSerial("gs")
cmd = cmd[:-1].split(';')
if (int(cmd[0]) == 0):
# Send to Robot Hand the Command
cmd = 'ps %s' % cmd[1]
SliderBoxCmd.publish(cmd)
rate.sleep()

def SliderBoxSerial(cmd):
# Write data package
Expand All @@ -42,4 +42,5 @@ def SliderBoxSerial(cmd):
try:
SliderBox()
except rospy.ROSInterruptException:
pass
pass

0 comments on commit 674d6d5

Please sign in to comment.