root / testing / motors_test / motors_test.py @ c7b564bb
History | View | Annotate | Download (536 Bytes)
1 | c7b564bb | Tom Mullins | #!/usr/bin/python
|
---|---|---|---|
2 | |||
3 | import roslib; roslib.load_manifest('motors_test') |
||
4 | import rospy |
||
5 | from motors.msg import set_motors |
||
6 | |||
7 | if __name__ == '__main__': |
||
8 | rospy.init_node('motors_test')
|
||
9 | |||
10 | pub = rospy.Publisher('/set_motors', set_motors)
|
||
11 | msg = set_motors(fl_set=True, fl_speed=0) |
||
12 | fl_ds = 5
|
||
13 | |||
14 | while not rospy.is_shutdown(): |
||
15 | |||
16 | msg.fl_speed += fl_ds |
||
17 | |||
18 | if msg.fl_speed >= 100: |
||
19 | fl_ds = -5
|
||
20 | msg.fl_speed = 100
|
||
21 | elif msg.fl_speed <= -100: |
||
22 | fl_ds = 5
|
||
23 | msg.fl_speed = -100
|
||
24 | |||
25 | pub.publish(msg) |
||
26 | |||
27 | rospy.sleep(0.05) |