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

Current Cone Coloring Improvements #393

Open
wants to merge 49 commits into
base: dev
Choose a base branch
from

Conversation

DiogoProPrayer
Copy link
Contributor

Major improvements when the parameters were modified
Small improvements by the addition of curvature to the cost function: the weight should be small, only to prevent extreme cases with outliers.

DiogoProPrayer and others added 30 commits November 15, 2024 13:11
* added test to available dashboards

* Added test test to send bucket

* canceled previous change and added change to get dashboard layout

* same as 2nd commit

* Added graph 4

* Fixed errors in code structure and added graph 5

* Fixed errors in code structure and added graph 5

* Tried to add random variables

* Same and Debugging

* Debugging

* Revert "Fixed errors in code structure and added graph 5"

This reverts commit 095fe49.

* Revert "Tried to add random variables"

This reverts commit d05a3f0.
added launch files for more disciplines in pacsim
fixed error in control node due to acos not clamped to [-1, 1], resulting in NaN steering
fixed car model not appearing in foxglove
lourenco31 and others added 3 commits February 17, 2025 19:47
* feat: velocity estimation package definition predicting dependencies

* feat: velocity estimation node and adapter declaration & main function

* feat(common_lib): added Velocities structure to common_lib

* feat(custom_interfaces): added Velocities message to custom interfaces

* feat(ve): initial launch file

* feat(ve): parameters factory & updated main and node & declared adapters

* feat(ve): abstract estimator

* feat: ve node has estimator

* feat(ve): imu callback for PacSim

* feat(ve): wss callback for pacsim

* feat(ve): steering angle callback for pacsim

* feat(ve): simulate resolver data assuming gear ratio of 4:1

* feat(ve): ekf structure

* feat(ve): updated CMakeLists

* fix(ve): updated package.xml

* feat(ve): estimator creation logics & launch file adjustment & node runs!

* feat(motion_lib): created motion lib and moved the vehicle dynamics folder from common_lib to it

* fix(se): replaced vehicle dynamics functionality from common lib with motion lib in ekf_state_est

* fix(control): replaced vehicle dynamics functionality with motion_lib in control

* fix(common_lib): removed vehicle dynamics from common lib

* fix(se): fixed error in include and removed compiler warnings

* fix(motion_lib & common_lib): fixed compiling & added particle model & changed directory structure in motion_lib

* fix(control&se): fixed include statements

* fix compiling & made prediction step

* fix(ve): removed unnecessary import and hierarchy

* feat(VE): doxygen comments

* fix(ve): fixed case and weird names

* feat(VE): readme and diagram

* feat(VE): initial prediction step

* feat(observation_lib): created observation library

* fix(ve):_replaced function with observation_lib

* feat(VE): vehicle adapter

* fix(motion_lib&observation_lib): dealing well with division by values close to 0 and using doubles

* fix(adapters):  added vehicle adapter to loader

* feat(ve): all matrixes/vectors using doubles and temporary debug logic

* fix: removed observation lib

* feat(ve): vehicle launch file and publisher to adapter

* fix: fixed vehicle adapter

* fix: comments, diagram, readme, adapters

* fix: action

* added velocity estimation to github action

* fixed error in compilation

* fix: small typos

* small fixes

* fix: created interface for s2v models, changed topic name, created car params struct

* fix: moved publishing velocities logics from adapter to node

* fix: changed uses of bicycle model to use new class

* fix: removed old bicycle model from motion_lib

* fix: made class for particle model

* fix: removed redundancy in jacobian

* fix: added and improved comments, fixed class names, fixed jacobian

* feat: new tests in motion_lib

* feat: completed unit tests

* fix(motion_lib): added description to the tests

---------

Co-authored-by: marhcouto <marhcouto1101@gmail.com>
* hotfix: bunch of bs

* fixed control flickering steering:
caused by the first pathpoint which is inserted when the ld cant find any intersection (helpful when car is at standstill)
fixed by iterating closest point starting at 1 instead of 0

* config done
* tests start

* Straight_line working

* pcd visualization working -Dpath

* all tests + pcds working

* Documentation and cleanup

* compile error fixed

* force included pcd files

* removed result lines

* parameters change

* merge with dev and adjustements

* added easy way to clean the result files

* added ground truths and major refactor

* removed useless files

* small file fix

* fixed correctness

* hotfix

* documentation change

* Update perception_node.cpp

* re-add bugged files

* readded result files to try and solve github tests

* general cleanup

* relaxed some of the tests
@Davide64-dev
Copy link
Contributor

@DiogoProPrayer approved. Please solve conflicts wait for the action to approve.

* feat: velocity estimation package definition predicting dependencies

* feat: velocity estimation node and adapter declaration & main function

* feat(common_lib): added Velocities structure to common_lib

* feat(custom_interfaces): added Velocities message to custom interfaces

* feat(ve): initial launch file

* feat(ve): parameters factory & updated main and node & declared adapters

* feat(ve): abstract estimator

* feat: ve node has estimator

* feat(ve): imu callback for PacSim

* feat(ve): wss callback for pacsim

* feat(ve): steering angle callback for pacsim

* feat(ve): simulate resolver data assuming gear ratio of 4:1

* feat(ve): ekf structure

* feat(ve): updated CMakeLists

* fix(ve): updated package.xml

* feat(ve): estimator creation logics & launch file adjustment & node runs!

* feat(motion_lib): created motion lib and moved the vehicle dynamics folder from common_lib to it

* fix(se): replaced vehicle dynamics functionality from common lib with motion lib in ekf_state_est

* fix(control): replaced vehicle dynamics functionality with motion_lib in control

* fix(common_lib): removed vehicle dynamics from common lib

* fix(se): fixed error in include and removed compiler warnings

* fix(motion_lib & common_lib): fixed compiling & added particle model & changed directory structure in motion_lib

* fix(control&se): fixed include statements

* fix compiling & made prediction step

* fix(ve): removed unnecessary import and hierarchy

* feat(VE): doxygen comments

* fix(ve): fixed case and weird names

* feat(VE): readme and diagram

* feat(slam): base SLAM node compiling

* feat(slam): include base structure and documentation and fixes in base node

* FSF-7573 Graph slam (#392)

* feat(slam): base graph slam structure, missing motion model and completing functions

* feat(motion_lib): constant velocity motion model

* feat(slam): long description...
- finished constant velocity motion model
- changed structures and messages to contain necessary noises and timestamps
- changed node structure and completed missing code
- created data association library (perception sensor shit)
- completed code for adding motion prior (with some holes)
- unit tests for constant velocity motion model

* fix(slam/perception_sensor_lib): corrected parameter names

* fix(slam): added gtsam installation and changed a name

* fix(actions): added slam workflow and corrected two others

* fix(actions): added lib

* fix(slam): changed name of variable

* fix(install): added missing command in GTSAM installation

* fix(slam): added updating the last_pose_update timestamp

* fix(actions): killed slam action, too slow

* FSF-7159 Ekf slam (#384)

* feat(slam): ekf prediction step

* feat(slam): added comments to ekf slam functions

* feat(slam): EKF correction step and state augmentation

* fix(slam): added slam to action and fixed the compilation of ekf_state_est and control

* feat(slam): base graph slam structure, missing motion model and completing functions

* feat(motion_lib): constant velocity motion model

* fix: changed oberservation noise matrix, rotation matrix as auxiliary function

* feat(slam): long description...
- finished constant velocity motion model
- changed structures and messages to contain necessary noises and timestamps
- changed node structure and completed missing code
- created data association library (perception sensor shit)
- completed code for adding motion prior (with some holes)
- unit tests for constant velocity motion model

* feat: asynchronous correction and prediction steps

* feat: new tests

* fix: strange things

---------

Co-authored-by: marhcouto <marhcouto1101@gmail.com>

* fix(slam/motion_lib): fixes after merge of EKF and Davide review

* fix: solved last merge conflicts

* fix(ekf_state_est): fixed the path

---------

Co-authored-by: Lourenço Rodrigues <up202306331@up.pt>
Co-authored-by: lourenco31 <150086800+lourenco31@users.noreply.github.com>
@@ -33,7 +33,7 @@ std::string load_adapter_parameters(PlanningParameters& params) {
params.path_calculation_dist_threshold_ =
adapter_node->declare_parameter("path_calculation_dist_threshold", 7.0);
params.smoothing_spline_order_ =
static_cast<int>(adapter_node->declare_parameter("smoothing_spline_order", 3));
static_cast<int>(adapter_node->declare_parameter("smoothing_spline_order", 4));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check if this makes a difference in execution time. Fitting splines is usually slow. Even if it does increase execution time you don't need to reverse it, but it's better to document that now than to later try to find what's causing high execution time

*/
void place_second_cones(std::unordered_set<Cone, std::hash<Cone>>& uncolored_cones,
const Pose& car_pose, int& n_colored_cones);
Cone find_best_initial_cone_ransac(const std::unordered_set<Cone, std::hash<Cone>>& cones,
Copy link
Contributor

@lourenco31 lourenco31 Feb 19, 2025

Choose a reason for hiding this comment

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

Remove this declaration

if (colored_cones.back() == this->colored_blue_cones_.back()) {
for (auto& colored_cone : this->colored_yellow_cones_) {
if (cone.position.euclidean_distance(colored_cone.position) < 2.5) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this minimum distance a parameter of the node

@@ -102,7 +105,7 @@ class ConeColoring {
* @param colored_to_input_cones_ratio ration of cones which have been colored
* @return double cost
*/
double calculate_cost(const Cone& next_cone, const Cone& last_cone,
double calculate_cost(const Cone& next_cone, const Cone& last_cone, const Cone& second_last_cone,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the "second last" cone is also passed to the function, please refactor this function so that "previous_to_last_vector" is no longer passed as an argument, it is redundant

const TwoDVector& previous_to_last_vector,
const double& colored_to_input_cones_ratio) const {
AngleAndNorms angle_and_norms = common_lib::maths::angle_and_norms(
previous_to_last_vector, Position{next_cone.position.x - last_cone.position.x,
next_cone.position.y - last_cone.position.y});
double distance = angle_and_norms.norm2_;
double angle = angle_and_norms.angle_;
double curvature = get_curvature(next_cone, last_cone, second_last_cone);
double curvature_weight = 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a parameter of the node

double ConeColoring::calculate_cost(const Cone& next_cone, const Cone& last_cone,
const Cone& second_last_cone,
const TwoDVector& previous_to_last_vector,
const double& colored_to_input_cones_ratio) const {
AngleAndNorms angle_and_norms = common_lib::maths::angle_and_norms(
Copy link
Contributor

Choose a reason for hiding this comment

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

You can ignore this for now, but I think this should be refactored

@@ -211,17 +211,48 @@ void ConeColoring::place_second_cones(std::unordered_set<Cone, std::hash<Cone>>&
}
}

double get_curvature(Cone point1, Cone point2, Cone point3) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to common_lib and use Positions instead of Cones as arguments

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
148 New issues

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Davide64-dev
Copy link
Contributor

@DiogoProPrayer don't forget this pls 😭😭😭

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.

7 participants