generated from hariharan382/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.py
65 lines (48 loc) · 1.66 KB
/
home.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
from math import sin, cos
import math
import rospy
from std_msgs.msg import Int32
import time
def talker():
rospy.init_node('homing', anonymous=True)
LF1 = rospy.Publisher('LF1_angle_topic1', Int32, queue_size=10)
LF2 = rospy.Publisher('LF2_angle_topic2', Int32, queue_size=10)
LF3 = rospy.Publisher('LF3_angle_topic3', Int32, queue_size=10)
LB1 = rospy.Publisher('LB1_angle_topic1', Int32, queue_size=10)
LB2 = rospy.Publisher('LB2_angle_topic2', Int32, queue_size=10)
LB3 = rospy.Publisher('LB3_angle_topic3', Int32, queue_size=10)
RF1 = rospy.Publisher('RF1_angle_topic1', Int32, queue_size=10)
RF2 = rospy.Publisher('RF2_angle_topic2', Int32, queue_size=10)
RF3 = rospy.Publisher('RF3_angle_topic3', Int32, queue_size=10)
RB1 = rospy.Publisher('RB1_angle_topic', Int32, queue_size=10)
RB2 = rospy.Publisher('RB2_angle_topic2', Int32, queue_size=10)
RB3 = rospy.Publisher('RB3_angle_topic3', Int32, queue_size=10)
def left(x,y,z):
LF1.publish(x)
if Y=45:
while(True):
LF1.publish(0)
LF3.publish(45)
LF2.publish(130)
#----------------------------
LB1.publish(0)
LB2.publish(130)
LB3.publish(45)
#-------------------------
RF1.publish(180)
RF3.publish(130)
RF2.publish(45)
#------------------------
RB1.publish(180)
RB2.publish(45)
RB3.publish(130)
rate = rospy.Rate(0.5)
rate.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass