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

Conversation

lewisid
Copy link
Contributor

@lewisid lewisid commented Feb 18, 2022

PR Details

Description

In order to ensure CARMA operation is synchronized with CARLA state, three files have been added to handle the route selection, plugin activation, and guidance activation functionality in the CARLA_to_CARMA integration node. These files allow for the initialization of their respective states without the need for user intervention via carma-web-ui. CARMA engages when CARLA is ready to run the experiment and when the user has indicated that CARMA should be engaged.

Related Issue

#50

Motivation and Context

Normal CARMA Platform operation requires user input to the CARMA Web-UI to initialize the plugins, route, and localization. In a simulation setting with many virtual vehicles this is cumbersome and inefficient, and prevents the creation of easily repeatable and re-runnable scenarios. A more direct integration between the CARMA Platform and CARLA simulation state should be developed.

How Has This Been Tested?

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
    CARMA Contributing Guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@lewisid lewisid self-assigned this Feb 18, 2022
elif check_required_plugins(plugin_msg.name) == TRUE:
plugin.activated = TRUE

plugin_list.plugins.append(plugin)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list will also grow infinitely as updates come in though right since old updates are never removed from the list?

@lewisid lewisid requested a review from kjrush March 3, 2022 17:01
carla-carma-integration/carla_carma_bridge/CMakeLists.txt Outdated Show resolved Hide resolved
carla-carma-integration/carla_carma_bridge/package.xml Outdated Show resolved Hide resolved


#Check if the plugin is included in the list of required plugins
def check_selected_plugins(name):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function is equivalent to name in selected_plugins if you want to simplify things a bit.

else:
return False

"""TODO: Listen to a topic indicating that CARLA Sim has started before seting guidance to active
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any progress on this todo? I think maybe the /clock topic might be a decent place to start but I'd double check that with @chengyuan0124

def initialize():
available_routes = get_available_routes()
if available_routes == None:
rospy.spin()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to infinite loop the node right? If there's no routes (for example, maybe they haven't finished loading yet) then we'll hit this line and never get to check for any routes again. I'd recommend re-working this logic.

if check_selected_route(available_routes) == True:
route = selected_route
else:
route = available_routes.availableRoutes[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this we'd probably be better of throwing an exception or logging an error (or publishing system FATAL?) since the user's intent (run this route) can't be executed.

print("Incoming plugin is not included in list of registered plugins")
elif check_selected_plugins(plugin_msg.name) == True:
plugin_msg.activated = True
activation = activation_srv(plugin_msg.name, plugin_msg.activated)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably only be calling this once instead of every time we get a public status message. Not sure how you'd want to track that, but calling it every time we get one of these messages is a lot of unneeded calls. Maybe only call it if the status message we received indicates that the plugin is not activated?

#Service Call Request
resp = service(0, id)
if resp.errorStatus != NO_ERROR.value:
errorDescription = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update on this?

@lewisid lewisid merged commit 8cf2502 into develop Mar 16, 2022
@kjrush kjrush deleted the feature/carla-carma_state_integration branch May 17, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants