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
2 changes: 2 additions & 0 deletions carla-carma-integration/carla_carma_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ catkin_install_python(PROGRAMS
src/carla_carma_bridge/carla_to_carma_external_objects
src/carla_carma_bridge/carma_carla_route
src/carla_carma_bridge/carma_carla_plugins
src/carla_carma_bridge/carma_carla_guidance

DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python
# Copyright (C) 2021 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

import rospy
from cav_msgs.msg import RouteEvent
from cav_msgs.msg import Plugin

route_selected = False
plugins_activated = False

def check_route_status(route_event_msg):
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):
if plugin_msg.activated == True:
print("Plugins Activated")
#NOTE: May have to add logic to parse through every individual plugin and determine their status
plugins_activated = True
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved

def initialize():
service = rospy.ServiceProxy('/set_active_guidance')
chengyuan0124 marked this conversation as resolved.
Show resolved Hide resolved
route_sub = rospy.Subscriber("/route_event",RouteEvent(), check_route_status)
plugin_sub = rospy.Subscriber("/plugin_discovery", Plugin(), check_plugin_status)
if route_selected == True && plugins_activated == True:
service.call()
else:
rospy.spin()

if __name__ == '__main__':
print("carma_carla_guidance")
initialize()
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ def check_selected_route(available_routes):
if selected_route in available_routes:
kjrush marked this conversation as resolved.
Show resolved Hide resolved
return selected_route

"""TODO: Listen to a topic indicating that CARLA Sim has started before seting guidance to active
def set_guidance_active():
service = rospy.ServiceProxy('/set_active_guidance') """

def initialize():
route_event_sub = rospy.Subscriber('/guidance/route_event', RouteEvent,route_event_callback)
available_routes = get_available_routes()
Expand All @@ -134,13 +130,15 @@ def initialize():
else:
print("Error: Invalid selected route")
rospy.spin()


else:
print("Localization Incomplete")
rospy.spin()


if __name__ == '__main__':
print("")
print("carma_carla_route")
initialize()


Expand Down