How to use route_marker method in localstack

Best Python code snippet using localstack_python

visualise_map2.py

Source:visualise_map2.py Github

copy

Full Screen

...51 self.route_marker = MarkerArray()52 self.route_marker.markers=[]53 idn=054 for i in range(1,len(msg.nodes)):55 self.route_marker.markers.append(self.get_route_marker(msg.nodes[i-1], msg.nodes[i], idn))56 idn+=157 self.routevis_pub.publish(self.route_marker)58 59 60 def clear_route(self):61 self.route_marker = MarkerArray()62 self.route_marker.markers=[]63 marker = Marker()64 marker.action = marker.DELETEALL65 self.route_marker.markers.append(marker)66 self.routevis_pub.publish(self.route_marker) 67 rospy.sleep(0.5)68 def get_route_marker(self, origin, end, idn):69 marker = Marker()70 marker.id = idn71 marker.header.frame_id = 'topo_map'72 marker.type = marker.ARROW73 V1=Point()74 V2=Point()75 origin_node = get_node(self.topological_map['nodes'], origin)76 end_node = get_node(self.topological_map['nodes'], end)77 V1=self.node2pose(origin_node['pose']).position78 V1.z += 0.2579 V2=self.node2pose(end_node['pose']).position80 V2.z += 0.2581 marker.pose.orientation.w= 1.082 marker.scale.x = 0.2...

Full Screen

Full Screen

odometry_visual.py

Source:odometry_visual.py Github

copy

Full Screen

1#!/usr/bin/env python2import numpy as np3import rospy4from nav_msgs.msg import Odometry5from geometry_msgs.msg import Point6from visualization_msgs.msg import Marker7from std_srvs.srv import Trigger, TriggerResponse, TriggerRequest8from std_msgs.msg import Int329point_list_follow = []10point_list_lead = []11def cb_odom_follow(msg):12 position = msg.pose.pose.position13 point_list_follow.append(position)14def cb_odom_lead(msg):15 position = msg.pose.pose.position16 point_list_lead.append(position)17def draw(event):18 draw_route()19 if len(point_list_follow) != 0:20 draw_odom_folow()21 if len(point_list_lead) != 0:22 draw_odom_lead() 23def draw_route():24 route_marker = Marker()25 route_marker.header.frame_id = "odom"26 route_marker.header.stamp = rospy.Time.now()27 route_marker.action = route_marker.ADD28 route_marker.type = route_marker.LINE_STRIP29 # maker scale30 route_marker.scale.x = 0.231 route_marker.scale.y = 0.232 route_marker.scale.z = 0.233 # marker color34 route_marker.color.a = 1.035 route_marker.color.r = 0.036 route_marker.color.g = 0.037 route_marker.color.b = 1.038 # marker orientaiton39 route_marker.pose.orientation.x = 0.040 route_marker.pose.orientation.y = 0.041 route_marker.pose.orientation.z = 0.042 route_marker.pose.orientation.w = 1.043 # marker position44 route_marker.pose.position.x = 0.045 route_marker.pose.position.y = 0.046 route_marker.pose.position.z = 0.047 route_marker.lifetime = rospy.Duration()48 for point in route_list:49 x = point[0]50 y = point[1]51 pt = Point(x, y, 0)52 route_marker.points.append(pt)53 pub_route_line.publish(route_marker)54def draw_odom_folow():55 56 line_marker = Marker()57 line_marker.header.frame_id = "odom"58 line_marker.header.stamp = rospy.Time.now()59 line_marker.action = line_marker.ADD60 line_marker.type = line_marker.LINE_STRIP61 # maker scale62 line_marker.scale.x = 0.1563 line_marker.scale.y = 0.1564 line_marker.scale.z = 0.1565 # marker color66 line_marker.color.a = 0.867 line_marker.color.r = 1.068 line_marker.color.g = 0.069 line_marker.color.b = 0.070 # marker orientaiton71 line_marker.pose.orientation.x = 0.072 line_marker.pose.orientation.y = 0.073 line_marker.pose.orientation.z = 0.074 line_marker.pose.orientation.w = 1.075 # marker position76 line_marker.pose.position.x = 0.077 line_marker.pose.position.y = 0.078 line_marker.pose.position.z = 0.079 80 for point in point_list_follow:81 x = point.x82 y = point.y83 pt = Point(x, y, 0)84 line_marker.points.append(pt)85 pub_odom_line_follow.publish(line_marker)86def draw_odom_lead():87 88 line_marker = Marker()89 line_marker.header.frame_id = "odom"90 line_marker.header.stamp = rospy.Time.now()91 line_marker.action = line_marker.ADD92 line_marker.type = line_marker.LINE_STRIP93 # maker scale94 line_marker.scale.x = 0.1895 line_marker.scale.y = 0.1896 line_marker.scale.z = 0.1897 # marker color98 line_marker.color.a = 1.099 line_marker.color.r = 0.0100 line_marker.color.g = 0.0101 line_marker.color.b = 0.0102 # marker orientaiton103 line_marker.pose.orientation.x = 0.0104 line_marker.pose.orientation.y = 0.0105 line_marker.pose.orientation.z = 0.0106 line_marker.pose.orientation.w = 1.0107 # marker position108 line_marker.pose.position.x = 0.0109 line_marker.pose.position.y = 0.0110 line_marker.pose.position.z = 0.0111 112 for point in point_list_lead:113 x = point.x114 y = point.y115 pt = Point(x, y, 0)116 line_marker.points.append(pt)117 pub_odom_line_lead.publish(line_marker)118def cb_srv_clear(req):119 del point_list_follow[:]120 del point_list_lead[:]121 print("Clear point")122 value = Int32()123 value = 0124 pub_clear.publish(value)125 return TriggerResponse()126if __name__ == "__main__":127 rospy.init_node("odometry_plot",anonymous=False)128 srv_clear = rospy.Service('~clear', Trigger, cb_srv_clear)129 130 #Circle131 #route_list = [(11,9),(5,6),(1,2),(-2,-4),(-2,-10),(1,-16),(5,-20),(11,-23),(17,-23),(23,-20),(27,-16),(30,-10),(30,-4),(27,2),(23,6),(17,9),(11,9)]132 # Square133 route_list = [(0, 7), (0, -21), (28, -21), (28, 7), (0, 7)]134 # Eight135 #route_list = [(7,-14),(7,0),(21,0),(21,-14),(35,-14),(35,0),(21,0),(21,-14),(7,-14)]136 #rospy.Subscriber("/MONICA/localization_gps_imu/odometry", Odometry, cb_odom_follow, queue_size=1)137 #rospy.Subscriber("/BRIAN/localization_gps_imu/odometry", Odometry, cb_odom_lead, queue_size=1)138 rospy.Subscriber("/MONICA/p3d_odom", Odometry, cb_odom_follow, queue_size=1)139 rospy.Subscriber("/BRIAN/p3d_odom", Odometry, cb_odom_lead, queue_size=1)140 pub_route_line = rospy.Publisher("/route_linelist", Marker, queue_size=1)141 pub_odom_line_follow = rospy.Publisher("/odom_linelist_follow", Marker, queue_size=1)142 pub_odom_line_lead = rospy.Publisher("/odom_linelist_lead", Marker, queue_size=1)143 pub_clear = rospy.Publisher("/clear", Int32, queue_size=1)144 145 rospy.Timer(rospy.Duration(1.0), draw)...

Full Screen

Full Screen

busroutegeneralmapview.py

Source:busroutegeneralmapview.py Github

copy

Full Screen

1from apikey_ import lta_account_key2from kivy_garden.mapview import MapView3from kivy.app import App4from busroutegeneral_folder.busroutegeneralmarker import ThisBusRouteMarker, OppositeBusRouteMarker5from busservice_folder.busservicemarker import BusServiceMarker6 7#Authentication parameters8headers = {'AccountKey' : lta_account_key, 'accept' : 'application/json'} #this is by default9 10#API parameters11uri = 'http://datamall2.mytransport.sg/' #Resource URL12 13class BusRouteGeneralMapView(MapView):14 def acceptroutedata(self):15 thisroutebusstopdata = App.get_running_app().this_route_busstop_data_general16 oppositeroutebusstopdata = App.get_running_app().opposite_route_busstop_data_general17 # print("thisroutebusstopdata", thisroutebusstopdata)18 # thisroutebusstopdata [['976', 'SMRT', 1, 1, '44009', '0', '0530', '0030', '0530', '0030', '0530', '0030', 'Choa Chu Kang Int', 1.38586897797184, 103.74578895932125], ['976', 'SMRT', 1, 2, '44461', '0.7', '0532', '0033', '0532', '0033', '0532', '0033', 'Blk 352', 1.3825705560115, 103.7430047219692],19 # print("oppositeroutebusstopdata", oppositeroutebusstopdata)20 # oppositeroutebusstopdata [['976', 'SMRT', 2, 1, '45009', '0', '0550', '0050', '0550', '0050', '0550', '0050', 'BT PANJANG INT', 1.37812611932206, 103.763286611367], ['976', 'SMRT', 2, 2, '44201', '0.6', '0552', '0052', '0552', '0052', '0552', '0052', 'Aft Petir Stn', 1.37732275970527, 103.7672668951858], ['976', 'SMRT', 2, 3, '44211', '0.9', '0554', '0054', '0554', '0054', '0554', '0054', 'Blk 127', 1.37610015820197, 103.76921822286211],21 22 try:23 for busstop in thisroutebusstopdata:24 self.add_bus_route_this(busstop)25 except:26 pass27 28 try:29 for busstop in oppositeroutebusstopdata:30 self.add_bus_route_opposite(busstop)31 except:32 pass33 34 def add_bus_route_this(self, busstop):35 # Create the BusRouteMarker36 try:37 lat, lon = busstop[13], busstop[14]38 route_marker = ThisBusRouteMarker(lat=lat, lon=lon, source = "icons/route1.png")39 route_marker.bus_route_data = busstop40 self.add_widget(route_marker)41 except Exception as e:42 print("Error", e)43 pass44 45 def add_bus_route_opposite(self, busstop):46 # Create the BusRouteMarker47 try:48 lat, lon = busstop[13], busstop[14]49 route_marker = OppositeBusRouteMarker(lat=lat, lon=lon, source = "icons/route2.png")50 route_marker.bus_route_data = busstop51 self.add_widget(route_marker)52 except Exception as e:53 print("Error", e)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful