Last active
October 19, 2017 06:49
-
-
Save Veilkrand/6173f409faf5d95a7bb3565fb7c5aff1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment