User Tools

Site Tools


avatar_furo_source_codes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
avatar_furo_source_codes [2022/06/30 08:56] gleeavatar_furo_source_codes [2022/06/30 08:58] (current) glee
Line 188: Line 188:
   
  print(output_y)  print(output_y)
 +
 +def head_vel_callback(headCTR):
 + head_roll = headCTR.data
 +
 + if head_roll==4:
 + rospy.loginfo("Head downward")
 + GPIO.output(DIG2, GPIO.HIGH)
 + p1.start(0) # set AN2 as HIGH, M2B will turn ON
 + p2.start(30) # set Direction for M2  
 + #delay for 2 second
 +
 + if head_roll==2:
 + rospy.loginfo("Head upward")
 + GPIO.output(DIG2, GPIO.LOW)         
 + p1.start(0)                       
 + p2.start(30)                       
 +                           
 +     
 + if head_roll==5:
 + rospy.loginfo("STOP")
 + p1.start(0)                          # Direction can ignore
 + p2.start(0)                          # Direction can ignore
 +                             #delay for 3 second
  
 def listener(): def listener():
avatar_furo_source_codes.txt · Last modified: 2022/06/30 08:58 by glee