-
Notifications
You must be signed in to change notification settings - Fork 1
/
limpieza.py
executable file
·46 lines (35 loc) · 1 KB
/
limpieza.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
#!/usr/bin/env python3
import rospy
from geometry_msgs.msg import Point
from geometry_msgs.msg import Pose
from geometry_msgs.msg import PoseArray
def get_positions():
posiciones = [[123,456], [789, 987], [654, 321]]
# TODO: agregar funcion de filtro
poses_list = []
for i in posiciones:
pose=Pose()
pose.position.x = float(i[0])
pose.position.y = float(i[1])
poses_list.append(pose)
pose_array = PoseArray()
pose_array.header.frame_id ='1'
pose_array.poses=poses_list
return pose_array
def main():
rospy.init_node("limpieza")
pub = rospy.Publisher('posiciones_sucias', PoseArray, queue_size=10)
rate = rospy.Rate(1)
rospy.loginfo("Publisher created")
called = False
while not rospy.is_shutdown():
if not called:
called = True
pub.publish(get_positions())
rate.sleep()
rospy.spin()
if __name__ == '__main__':
try:
main()
except rospy.ROSInterruptException:
pass