Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import math
- import rospy
- from std_msgs.msg import Float64
- def mover():
- pub_j1 = rospy.Publisher('/simple_arm/joint_1_position_controller/command',
- Float64, queue_size=10)
- pub_j2 = rospy.Publisher('/simple_arm/joint_2_position_controller/command',
- Float64, queue_size=10)
- rospy.init_node('arm_mover', anonymous=True)
- rate = rospy.Rate(10)
- start_time = 0
- while not start_time:
- start_time = rospy.Time.now().to_sec()
- while not rospy.is_shutdown():
- elapsed = rospy.Time.now().to_sec() - start_time
- pub_j1.publish(math.sin(2*math.pi*0.1*elapsed)*(math.pi/2))
- pub_j2.publish(math.sin(2*math.pi*0.1*elapsed)*(math.pi/2))
- rate.sleep()
- if __name__ == '__main__':
- try:
- mover()
- except rospy.ROSInterruptException:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement