20 from sensor_msgs.msg
import JointState
21 from std_msgs.msg
import Float64
36 error = target - current
39 delta_output += self.
_i_gain * (error)
51 pub_wrist_current.publish(0.0)
54 joint_state = JointState()
66 start_time = rospy.Time.now().secs
67 target_angle = math.radians(90)
68 while not rospy.is_shutdown():
69 if len(joint_state.position) < 7:
72 wrist_angle = joint_state.position[6]
75 present_time = rospy.Time.now().secs
76 if present_time - start_time > 5:
77 start_time = present_time
80 target_effort = pid_controller.update(wrist_angle, target_angle)
81 pub_wrist_current.publish(target_effort)
85 if __name__ ==
'__main__':
86 rospy.init_node(
"control_effort_wrist")
88 sub_joint_state = rospy.Subscriber(
89 "/sciurus17/controller2/joint_states",
94 pub_wrist_current = rospy.Publisher(
95 "/sciurus17/controller2/left_wrist_controller/command",
99 rospy.on_shutdown(stop)
102 if not rospy.is_shutdown():
104 except rospy.ROSInterruptException: