[PI Sprint 24/25 / PD-456] - [Feature] Implement Localization - #34
Open
mbsaloka wants to merge 45 commits into
Open
[PI Sprint 24/25 / PD-456] - [Feature] Implement Localization#34mbsaloka wants to merge 45 commits into
mbsaloka wants to merge 45 commits into
Conversation
FaaizHaikal
requested changes
Jan 11, 2025
FaaizHaikal
requested changes
Feb 22, 2025
Comment on lines
+82
to
+88
| for (int i = 0; i < num_particles; ++i) { | ||
| Particle new_particle; | ||
| new_particle.position = keisan::Point2(xrg(xrd), yrg(yrd)); | ||
| new_particle.orientation = orientation; | ||
| new_particle.weight = 1.0 / num_particles; | ||
|
|
||
| particles.push_back(new_particle); |
Contributor
There was a problem hiding this comment.
Minor improvement, you can resize the particles size first instead of push_back to reduce memory reallocations.
Suggested change
| for (int i = 0; i < num_particles; ++i) { | |
| Particle new_particle; | |
| new_particle.position = keisan::Point2(xrg(xrd), yrg(yrd)); | |
| new_particle.orientation = orientation; | |
| new_particle.weight = 1.0 / num_particles; | |
| particles.push_back(new_particle); | |
| particles.resize(num_particles); | |
| for (int i = 0; i < num_particles; ++i) { | |
| Particle new_particle; | |
| new_particle.position = keisan::Point2(xrg(xrd), yrg(yrd)); | |
| new_particle.orientation = orientation; | |
| new_particle.weight = 1.0 / num_particles; | |
| particles[i] = new_particle; |
Check other loop that can be improved this way also.
Comment on lines
+217
to
+218
| x_rot = dx * cos(particle.orientation.radian()) - dy * sin(particle.orientation.radian()); | ||
| y_rot = dx * sin(particle.orientation.radian()) + dy * cos(particle.orientation.radian()); |
Contributor
There was a problem hiding this comment.
Suggested change
| x_rot = dx * cos(particle.orientation.radian()) - dy * sin(particle.orientation.radian()); | |
| y_rot = dx * sin(particle.orientation.radian()) + dy * cos(particle.orientation.radian()); | |
| x_rot = dx * particle.orientation.cos() - dy * particle.orientation.sin() | |
| y_rot = dx * particle.orientation.sin() + dy * particle.orientation.cos() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Link:
https://ichiro-its.atlassian.net/browse/PD-456?atlOrigin=eyJpIjoiYTNmODg5MjBmNGY0NDQ5NWIzOTQwNTVmMGM3YTkwZDAiLCJwIjoiaiJ9
Description
Implementing MCL algorithm in robot class
Type of Change
How Has This Been Tested?
Checklist:
feature/JIRA-ID-SHORT-DESCRIPTIONif has a JIRA ticketenhancement/SHORT-DESCRIPTIONif has/has no JIRA ticket and contain enhancementhotfix/SHORT-DESCRIPTIONif the change doesn't need to be tested (urgent)