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

Fix platooning_control #2417

Merged
merged 5 commits into from
Jul 26, 2024
Merged

Fix platooning_control #2417

merged 5 commits into from
Jul 26, 2024

Conversation

adev4a
Copy link
Contributor

@adev4a adev4a commented Jul 18, 2024

PR Details

This PR adds a fix to the platooning_control node which was recently ported to ros2.

Fixes a bug in delta time calculation for trajectory speed and updates the duration to be in nanoseconds.
Fixes the control topic in the trajectory_executor node to reference updated name of platooning_control package.

Description

Related GitHub Issue

Related Jira Key

https://usdot-carma.atlassian.net/browse/CAR-6012

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.

@@ -359,7 +359,7 @@ namespace platooning_control
double dx1 = trajectory_points[trajectory_points.size()-1].x - trajectory_points[0].x;
double dy1 = trajectory_points[trajectory_points.size()-1].y - trajectory_points[0].y;
double d1 = sqrt(dx1*dx1 + dy1*dy1);
double t1 = rclcpp::Time((trajectory_points[trajectory_points.size()-1].target_time)).seconds() - rclcpp::Time(trajectory_points[0].target_time).nanoseconds();
double t1 = rclcpp::Time((trajectory_points[trajectory_points.size()-1].target_time)).seconds() - rclcpp::Time(trajectory_points[0].target_time).seconds();
Copy link
Contributor

Choose a reason for hiding this comment

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

changing from nanosec to sec, has any impact somewhere else?
I dont remember if it does

Copy link
Contributor Author

@adev4a adev4a Jul 19, 2024

Choose a reason for hiding this comment

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

I kept this in seconds since were using seconds precision in the earlier implementation and the speed is being calculcated as m/s

double t1 = (trajectory_points[trajectory_points.size()-1].target_time.toSec() - trajectory_points[0].target_time.toSec());

But using nanoseconds instead is probably better to do since rounding of mps can have greater impact on mph speed. Updated

@adev4a
Copy link
Contributor Author

adev4a commented Jul 19, 2024

This PR also needs https://github.com/usdot-fhwa-stol/carma-vehicle-calibration/pull/127, which updates parameters for pure pursuit

Update: The PR above was closed - as logic to handle multiple activated plugins will be added as a separate story.

saina-ramyar
saina-ramyar previously approved these changes Jul 19, 2024
carma_guidance_plugins/src/control_plugin.cpp Outdated Show resolved Hide resolved
carma_guidance_plugins/src/control_plugin.cpp Outdated Show resolved Hide resolved
platooning_control/src/platooning_control.cpp Outdated Show resolved Hide resolved
@JonSmet
Copy link
Contributor

JonSmet commented Jul 25, 2024

Now that the scope of changes has been adjusted for this PR (i.e. not introducing a command timeout), can we please update the PR description, and also mention the two specific fixes that are included in this changeset (changing the control topic for platooning_control and fixing the seconds vs. nanoseconds bug)?

Copy link

sonarcloud bot commented Jul 25, 2024

@adev4a adev4a changed the title Fix platoon_control_ros2 Fix platooning_control Jul 26, 2024
@adev4a adev4a merged commit 33a3d47 into develop Jul 26, 2024
4 checks passed
@adev4a adev4a deleted the car_6012_fix_platooning_control_port branch July 29, 2024 15:48
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.

None yet

3 participants