def publish(jointpos): msg = seven() msg.a = jointpos[0] msg.b = jointpos[1] msg.c = jointpos[2] msg.d = jointpos[3] msg.e = jointpos[4] msg.f = jointpos[5] msg.g = jointpos[6] pub.publish(msg)
def talker(): pub = rospy.Publisher('gazebo/downscale_jointp', seven, queue_size=100) rospy.init_node('talker', anonymous=True) rate = rospy.Rate(1000) # 1Khz msg = seven() while not rospy.is_shutdown(): msg.a = 0.0 msg.b = 1.5707 msg.c = 0.0 msg.d = 0.0 msg.e = 0.0 msg.f = 0.0 msg.g = 0.0 rospy.loginfo(msg) pub.publish(msg) rate.sleep()
def listener(): rospy.init_node('drl_downscale', anonymous=True) rospy.Subscriber('downscale_actp', seven, callback) # rospy.spin() # sleep for one second while not rospy.is_shutdown(): # do whatever you want here msg = seven() msg.a = 0 msg.b = -0.1 msg.c = 0 msg.d = 0 msg.e = 0 msg.f = 0 msg.g = 0 pub.publish(msg) rospy.sleep(0.01) # sleep for one second