Skip to content

Commit

Permalink
fix(factors_panel): sort by distance to stop/decel or point where it …
Browse files Browse the repository at this point in the history
…starts moving the steering (#9346)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored Nov 18, 2024
1 parent 34fc143 commit 9b0ba2d
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,15 @@ void VelocitySteeringFactorsPanel::onVelocityFactors(const VelocityFactorArray::
velocity_factors_table_->clearContents();
velocity_factors_table_->setRowCount(msg->factors.size());

for (std::size_t i = 0; i < msg->factors.size(); i++) {
const auto & e = msg->factors.at(i);
auto sorted = *msg;

// sort by distance to the decel/stop point.
std::sort(sorted.factors.begin(), sorted.factors.end(), [](const auto & a, const auto & b) {
return a.distance < b.distance;
});

for (std::size_t i = 0; i < sorted.factors.size(); i++) {
const auto & e = sorted.factors.at(i);

// behavior
{
Expand Down Expand Up @@ -157,8 +164,15 @@ void VelocitySteeringFactorsPanel::onSteeringFactors(const SteeringFactorArray::
steering_factors_table_->clearContents();
steering_factors_table_->setRowCount(msg->factors.size());

for (std::size_t i = 0; i < msg->factors.size(); i++) {
const auto & e = msg->factors.at(i);
auto sorted = *msg;

// sort by distance to the point where it starts moving the steering.
std::sort(sorted.factors.begin(), sorted.factors.end(), [](const auto & a, const auto & b) {
return a.distance.front() < b.distance.front();
});

for (std::size_t i = 0; i < sorted.factors.size(); i++) {
const auto & e = sorted.factors.at(i);

// behavior
{
Expand Down

0 comments on commit 9b0ba2d

Please sign in to comment.