Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/carla carma state integration #49

Merged
merged 26 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ route_selected = False
plugins_activated = False

def check_route_status(route_event_msg):
global route_selected
if route_event_msg.event == 1:
print("Route Selected")
route_selected = True
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved

def check_plugin_status(plugin_msg):
global plugins_activated
if plugin_msg.activated == True:
print("Plugins Activated")
#NOTE: May have to add logic to parse through every individual plugin and determine their status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def plugin_status_cb(plugin_msg):

#Search through list of registered plugins. If it exists, return the requested plugin
def check_plugin_registration(plugin):
global plugin_list
if plugin in plugin_list.plugins:
return True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ import rospy
from geometry_msgs.msg import PoseStamped, Pose
from cav_msgs.msg import RouteState
from cav_msgs.msg import Route
from cav_msgs.msg import RouteEvent, GuidanceState
from cav_msgs.msg import RouteEvent
from cav_srvs.srv import GetAvailableRoutes
from cav_srvs.srv import SetActiveRoute

state_pub = rospy.Publisher('/guidance/state', GuidanceState)
selected_route = rospy.get_param('selected_route')
local_pos = PoseStamped()

Expand Down Expand Up @@ -92,15 +91,14 @@ def set_route(id):
else:
#Call succeeded: Setting Route
print('call set active route success!')
#Change Guidance from READY to ACTIVE
#set_guidance_active()



except:
print("Fail")

def pose_cb(pose_msg):
global local_pos
local_pos.header = pose_msg.pose
local_pos.pose = pose_msg.pose

Expand All @@ -122,23 +120,25 @@ def initialize():

#Ensure that localization is complete before checking route information
localized_sub = rospy.Subscriber('/localization/current_pose', PoseStamped, pose_cb)
if local_pos.pose.position.x != 0 and local_pos.pose.position.y != 0:
if available_routes == None:
print("No routes available.")
else:
"""Check if the selected route is one of the available routes. If it isn't,then print error statement"""
if check_selected_route(available_routes) == True:
route = selected_route
set_route(route.route_id)

while rospy.is_shutdown() != True:
kjrush marked this conversation as resolved.
Show resolved Hide resolved
if local_pos.pose.position.x != 0 and local_pos.pose.position.y != 0:
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved
if available_routes == None:
print("No routes available.")
else:
print("Error: Invalid selected route")
rospy.spin()
"""Check if the selected route is one of the available routes. If it isn't,then print error statement"""
if check_selected_route(available_routes) == True:
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved
route = selected_route
set_route(route.route_id)
break

else:
print("Error: Invalid selected route")
rospy.spin()
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved


else:
print("Localization Incomplete")
rospy.spin()
else:
print("Localization Incomplete")
rospy.spin()
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == '__main__':
Expand Down