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

Common functionality for SUMO CARMA Messenger Vehicle Plugin #226

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

chengyuan0124
Copy link
Contributor

@chengyuan0124 chengyuan0124 commented Sep 25, 2024

PR Details

Description

This PR introduces the implementation of the CARMA-messenger vehicle plugin for CDASim, aligning with the High-level Design for Freight ERV functionality documentation

Related GitHub Issue

Related Jira Key

CXC-87

Motivation and Context

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.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

for msg_veh_id in msg_veh_ids:

if msg_veh_id not in sumo_veh_ids and \
msger_veh_cfg.get_veh_state(msg_veh_id) == 0 and \
Copy link
Contributor

Choose a reason for hiding this comment

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

Having some sort of constant for this 0 would be good. What state is that supposed to represent?

sumo_connector.set_veh_speed(msg_veh_id, msger_veh_cfg.get_veh_speed(msg_veh_id))
sumo_connector.set_veh_lcm(msg_veh_id, msger_veh_cfg.get_veh_lcm(msg_veh_id))
sumo_connector.set_veh_type(msg_veh_id, msger_veh_cfg.get_veh_cfm(msg_veh_id))
msger_veh_cfg.set_veh_state(msg_veh_id, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here re: state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be cleanest to define some sort of enum with these numerical values for states, and then reference that enum instead of the raw integer literal values.

"lcm": veh["lcm"],
"cfm": veh["cfm"]
}
self._veh_state_dict[veh_id] = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to define the states as an Enum type, and then use the state names instead of int literals.

Copy link

sonarcloud bot commented Sep 30, 2024

@kjrush kjrush merged commit aa079b5 into develop Oct 1, 2024
3 checks passed
@kjrush kjrush deleted the feature/carma_messenger_veh_plugin branch October 1, 2024 16:10
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.

2 participants