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
Feature/synchronized action #1234
base: master
Are you sure you want to change the base?
Conversation
…4/scenario_simulator_v2 into feature/synchronized_action
…synchronized_action
…synchronized_action
…synchronized_action
Checklist for reviewers ☑️All references to "You" in the following text refer to the code reviewer.
|
auto EntityBase::isArrivedToTargetLaneletPose( | ||
const CanonicalizedLaneletPose & target_lanelet_pose, const double threshold) -> bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto EntityBase::isArrivedToTargetLaneletPose( | |
const CanonicalizedLaneletPose & target_lanelet_pose, const double threshold) -> bool | |
auto EntityBase::isArrivedToTargetLaneletPose( | |
const CanonicalizedLaneletPose & target_lanelet_pose, const double threshold) const -> bool |
@@ -298,6 +298,7 @@ class EntityManager | |||
FORWARD_TO_ENTITY(getDistanceToRightLaneBound, const); | |||
FORWARD_TO_ENTITY(getEntityStatusBeforeUpdate, const); | |||
FORWARD_TO_ENTITY(getEntityType, const); | |||
FORWARD_TO_ENTITY(isArrivedToTargetLaneletPose, ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FORWARD_TO_ENTITY(isArrivedToTargetLaneletPose, ); | |
FORWARD_TO_ENTITY(isArrivedToTargetLaneletPose, const); |
auto EntityBase::isArrivedToTargetLaneletPose( | ||
const CanonicalizedLaneletPose & target_lanelet_pose, const double threshold) -> bool | ||
{ | ||
const auto entity_distance_to_target = getDistanceToTargetLaneletPose(target_lanelet_pose); | ||
|
||
if (entity_distance_to_target <= threshold) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider using reachPosition function.
/** | ||
* @brief Check if the entity has already arrived to the target lanelet. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @brief Check if the entity has already arrived to the target lanelet. | |
*/ | |
/// @brief Check if the entity has already arrived to the target lanelet. |
/** | ||
* @brief This is function for synchronization. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @brief This is function for synchronization. | |
*/ | |
/// @brief This is function for synchronization. |
/** | ||
* @brief Making entity slow down since the speed is too fast | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @brief Making entity slow down since the speed is too fast | |
*/ | |
/// @brief Making entity slow down since the speed is too fast |
if (!ego_distance.has_value()) { | ||
RCLCPP_WARN_ONCE( | ||
rclcpp::get_logger("traffic_simulator"), | ||
"ego has already passed away or has some problem"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message is unclear.
Instead of "something is wrong," please describe the possible causes of the problem and how you are addressing it.
For example, "Please check the results of the scenario run to see if Ego has passed the target point. If not, please contact the developer as there may be an undiscovered bug.
} | ||
const auto ego_velocity = other_status_.find("ego")->second.getTwist().linear.x; | ||
const auto entity_velocity = this->getStatus().getTwist().linear.x; | ||
const auto ego_arrival_time = (ego_velocity != 0) ? ego_distance.value() / ego_velocity : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To determine if it is equal to 0 for a double type, consider the machine epsilon.
|
||
auto entity_velocity_to_synchronize = entity_velocity; | ||
|
||
auto accel_limit_ = accel_limit * 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you multiply 1?
Also, why do you use auto
? not const auto
const auto entity_velocity = this->getStatus().getTwist().linear.x; | ||
const auto ego_arrival_time = (ego_velocity != 0) ? ego_distance.value() / ego_velocity : 0; | ||
|
||
auto entity_velocity_to_synchronize = entity_velocity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why do you use auto? not const auto
Description
Added API to call synchronized action.
Background
For further information look here .
Known Limitations
Currently, the conditions under which synchronized action can be fully achieved are quite limited.