Skip to content

Commit bf6f864

Browse files
authored
Merge pull request #1509 from tier4/RJD-1505/fix_slope_acceleration_sign
2 parents abba703 + c8bc37f commit bf6f864

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

simulation/simple_sensor_simulator/src/vehicle_simulation/ego_entity_simulation.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -318,26 +318,7 @@ void EgoEntitySimulation::update(
318318
case VehicleModelType::DELAY_STEER_MAP_ACC_GEARED:
319319
case VehicleModelType::IDEAL_STEER_ACC:
320320
case VehicleModelType::IDEAL_STEER_ACC_GEARED:
321-
/*
322-
TODO FIX THIS!!!
323-
324-
THIS IS MAYBE INCORRECT.
325-
326-
SHOULD BE
327-
gear_sign * acceleration + acceleration_by_slope
328-
OR
329-
signed_acceleration + acceleration_by_slope
330-
331-
Currently, acceleration is obtained as an unsigned value
332-
(`acceleration`) and a signed value (`gear_sign`), but this is for
333-
historical reasons and there is no longer any reason to do so.
334-
335-
Therefore, when resolving this TODO comment, the assignee should
336-
remove `gear_sign` from the tuple returned by
337-
`AutowareUniverse::getVehicleCommand`, and at the same time change
338-
`acceleration` to a signed value.
339-
*/
340-
input(0) = gear_sign * (acceleration + acceleration_by_slope);
321+
input(0) = gear_sign * acceleration + acceleration_by_slope;
341322
input(1) = tire_angle;
342323
break;
343324

@@ -365,7 +346,7 @@ void EgoEntitySimulation::update(
365346

366347
auto EgoEntitySimulation::calculateAccelerationBySlope() const -> double
367348
{
368-
if (consider_acceleration_by_road_slope_) {
349+
if (consider_acceleration_by_road_slope_ && status_.isInLanelet()) {
369350
constexpr double gravity_acceleration = -9.81;
370351
/// @todo why there is a need to recalculate orientation using getLaneletPose?
371352
/// status_.getMapPose().orientation already contains the orientation

simulation/traffic_simulator/include/traffic_simulator/data_type/entity_status.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class CanonicalizedEntityStatus
6666
auto setLinearJerk(double) -> void;
6767

6868
auto isInLanelet() const noexcept -> bool;
69-
auto getLaneletId() const noexcept -> lanelet::Id;
70-
auto getLaneletIds() const noexcept -> lanelet::Ids;
71-
auto getLaneletPose() const noexcept -> const LaneletPose &;
69+
auto getLaneletId() const -> lanelet::Id;
70+
auto getLaneletIds() const -> lanelet::Ids;
71+
auto getLaneletPose() const -> const LaneletPose &;
7272
auto getCanonicalizedLaneletPose() const noexcept
7373
-> const std::optional<CanonicalizedLaneletPose> &;
7474
auto getName() const noexcept -> const std::string & { return entity_status_.name; }

simulation/traffic_simulator/src/data_type/entity_status.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ auto CanonicalizedEntityStatus::getAltitude() const -> double
125125
: entity_status_.pose.position.z;
126126
}
127127

128-
auto CanonicalizedEntityStatus::getLaneletPose() const noexcept -> const LaneletPose &
128+
auto CanonicalizedEntityStatus::getLaneletPose() const -> const LaneletPose &
129129
{
130130
if (canonicalized_lanelet_pose_) {
131131
return canonicalized_lanelet_pose_->getLaneletPose();
@@ -134,12 +134,12 @@ auto CanonicalizedEntityStatus::getLaneletPose() const noexcept -> const Lanelet
134134
}
135135
}
136136

137-
auto CanonicalizedEntityStatus::getLaneletId() const noexcept -> lanelet::Id
137+
auto CanonicalizedEntityStatus::getLaneletId() const -> lanelet::Id
138138
{
139139
return getLaneletPose().lanelet_id;
140140
}
141141

142-
auto CanonicalizedEntityStatus::getLaneletIds() const noexcept -> lanelet::Ids
142+
auto CanonicalizedEntityStatus::getLaneletIds() const -> lanelet::Ids
143143
{
144144
return isInLanelet() ? lanelet::Ids{getLaneletId()} : lanelet::Ids{};
145145
}

0 commit comments

Comments
 (0)