Skip to content

Commit b4c12e7

Browse files
committed
added publishing for each joint
1 parent 5abd92f commit b4c12e7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/prpy/base/mico.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
import openravepy
3232
from manipulator import Manipulator
33+
from std_msgs.msg import Float64
34+
import rospy
3335

3436
class Mico(Manipulator):
3537
def __init__(self, sim,
@@ -67,6 +69,11 @@ def __init__(self, sim,
6769
self.GetName(), '', self.GetArmIndices(), 0, True)
6870
self.servo_simulator = ServoSimulator(self, rate=20,
6971
watchdog_timeout=0.1)
72+
73+
else:
74+
#if not simulation, create publishers for each joint
75+
self.velocity_topic_names = ['vel_j'+str(i)+'_controller/command' for i in range(1,7)]
76+
self.velocity_publishers = [rospy.Publisher(topic_name, Float64) for topic_name in self.velocity_topic_names]
7077

7178
def CloneBindings(self, parent):
7279
super(Mico, self).CloneBindings(parent)
@@ -99,4 +106,9 @@ def Servo(self, velocities):
99106
self.GetRobot().GetController().Reset(0)
100107
self.servo_simulator.SetVelocity(velocities)
101108
else:
102-
raise NotImplementedError('Servo is not implemented.')
109+
for velocity_publisher,velocity in zip(self.velocity_publishers, velocities):
110+
velocity_publisher.publish(velocity)
111+
#raise NotImplementedError('Servo is not implemented.')
112+
113+
114+

0 commit comments

Comments
 (0)