rviz_joint_fixer.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # coding: utf-8
3 
4 import rospy
5 from sensor_msgs.msg import JointState
6 
7 class Dummy:
8  def __init__(self):
9  self.sub = rospy.Subscriber(rospy.get_namespace()+"joint_states", JointState, self.joint_callback, queue_size=10)
10  self.pub = rospy.Publisher(rospy.get_namespace()+"joint_states_source", JointState, queue_size=10)
11  self.r = rospy.Rate(50)
12 
13  def joint_callback(self, msg):
14  js = JointState();
15  if len(msg.position) > 0:
16  js.name.append("joint6")
17  js.position.append(-msg.position[4])
18  self.pub.publish(js)
19  self.r.sleep()
20 
21 if __name__ == "__main__":
22  try:
23  while not rospy.is_shutdown():
24  rospy.init_node("rviz_slave_joint_state")
25  dummy = Dummy()
26  rospy.spin()
27  except rospy.ROSIntteruptException:
28  pass
29 
def joint_callback(self, msg)


raspigibbon_description
Author(s): Daisuke Sato , Shota Hirama
autogenerated on Mon Jun 10 2019 14:27:13