-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtalker.py
More file actions
executable file
·31 lines (28 loc) · 943 Bytes
/
talker.py
File metadata and controls
executable file
·31 lines (28 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import rospy
from std_msgs.msg import String#, Float64MultiArray
from controller.msg import FloatList, IntList
#import main
def talker():
#float64[4] axes = [main.leftX,main.leftY,main.rightX,main.rightY]
pub_axes = rospy.Publisher('controls', FloatList, queue_size=10)
pub_buttons = rospy.Publisher('buttons', IntList, queue_size=10)
rospy.init_node('controller_base', anonymous=True)
rate = rospy.Rate(10) # 10hz
axes = FloatList()
buttons = IntList()
while not rospy.is_shutdown():
#axes.data = [main.leftX,main.leftY,main.rightX,main.rightY]
axes.data = [1,-1,0,1]
#buttons.data = main.buttonArr1
buttons.data = [1,0,1,0,1]
rospy.loginfo(axes)
pub_axes.publish(axes)
rospy.loginfo(buttons)
pub_buttons.publish(buttons)
rate.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass