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

80 crptg1prioc stanley and pp implementation #82

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mesmatyi
Copy link
Collaborator

Add Pure Pursuit and Stanley Controller

Copy link
Member

@gfigneczi1 gfigneczi1 left a comment

Choose a reason for hiding this comment

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

few comments, questions

find_package(autoware_planning_msgs REQUIRED)
find_package(autoware_vehicle_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(pacmod3_msgs REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

why do we need pcamod3 at this stage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

true. not needed

namespace apl
{
struct ControlInput{
std::vector<double> path_x;
Copy link
Member

Choose a reason for hiding this comment

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

please use our way of noting m_ for member variables

Suggested change
std::vector<double> path_x;
std::vector<double> m_path_x;

Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if this struct was never defined before... we are in crp::apl namespace, where ControlInputs/Output struct types may have been defined already... wouldn't this cause any troubles?
btw, for all controllers the same base class definition shall be done as we did for planners, right @AnonymDavid ?

Copy link
Member

Choose a reason for hiding this comment

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

For controllers we don't have any interfaces defined yet. But yes it should have a base class and interfaces defined in crp_APL/interfaces. Should this be another task since the other controllers are missing these too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ye, make it another task, pls @gfigneczi1

};
} // namespace apl
}
#endif // CRP_APL_CTRL_VEHICLE_LAT_COMPENSATORY_HPP
Copy link
Member

Choose a reason for hiding this comment

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

formality, but still...

Suggested change
#endif // CRP_APL_CTRL_VEHICLE_LAT_COMPENSATORY_HPP
#endif // CRP_APL_CTRL_VEHICLE_LAT_PURE_P_HPP

// calculate the steering angle
m_output.steeringAngleTarget = 0.0f;

float alpha = atan2(m_input.path_y[target_index], m_input.path_x[target_index]);
Copy link
Member

Choose a reason for hiding this comment

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

target_index shall be checked, if greater than zero (if trajectory is too small, or the look ahead distance is too high, than it remains 0 per line 60... probably it shall be set to last point by default? supposing the path contains any points


float alpha = atan2(m_input.path_y[target_index], m_input.path_x[target_index]);

m_output.steeringAngleTarget = atan2(2.0f * m_params.wheelbase * sin(alpha) / distance_to_index, 1);
Copy link
Member

Choose a reason for hiding this comment

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

simple atan?


// control algorithm
if(m_input.path_x.size() > 0 && m_input.path_y.size() > 0)
pure_p_control();
Copy link
Member

Choose a reason for hiding this comment

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

else zero steering angle target? otherwise system keeps the last value which is not the safe behavior

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

else i would just drop the msg (not publish anything), for ex. when the steering wheel is at 20 deg and all of a sudden comes back 0, is not the best behavior in my op...

Copy link
Member

Choose a reason for hiding this comment

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

same here

{
m_input.path_x.clear();
m_input.path_y.clear();
m_input.path_theta.clear();
Copy link
Member

Choose a reason for hiding this comment

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

path theta is not filled

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not realy needed in the controller

Copy link
Member

@AnonymDavid AnonymDavid left a comment

Choose a reason for hiding this comment

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

Some questions and a possible error.

Copy link
Member

Choose a reason for hiding this comment

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

For controllers we don't have any interfaces defined yet. But yes it should have a base class and interfaces defined in crp_APL/interfaces. Should this be another task since the other controllers are missing these too?


float alpha = atan2(m_input.path_y[target_index], m_input.path_x[target_index]);

m_output.steeringAngleTarget = atan2(2.0f * m_params.wheelbase * sin(alpha) / distance_to_index, 1);
Copy link
Member

Choose a reason for hiding this comment

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

If ego speed (m_input.vxEgo) is 0 than distance_to_index would be 0 too and this would give a zero division error, no? In that case there should be a check for that.

executable="ctrl_vehicle_control_lat_stanley",
parameters=[
{"/ctrl/k_gain": 0.5},
{"/ctrl/wheelbase": 2.7},
Copy link
Member

Choose a reason for hiding this comment

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

This should be a parameter. Probably in an other task we should sync vehicle params as global (as in crp repo) parameters in every package.

Copy link
Collaborator Author

@mesmatyi mesmatyi Dec 12, 2024

Choose a reason for hiding this comment

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

yes should make another task for it

@mesmatyi
Copy link
Collaborator Author

@AnonymDavid and @gfigneczi1 resolved most of the issues

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.

[CRP][TG1][PrioC] Stanley and PP implementation
3 participants