Skip to content

Commit

Permalink
Allow v0 to be zero
Browse files Browse the repository at this point in the history
  • Loading branch information
schroedtert committed Nov 13, 2023
1 parent 3553cb1 commit dcb7e9c
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 134 deletions.
4 changes: 2 additions & 2 deletions libsimulator/src/CollisionFreeSpeedModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void CollisionFreeSpeedModel::CheckModelConstraint(
const auto v0 = model.v0;
constexpr double v0Min = 0.;
constexpr double v0Max = 10.;
validateConstraint(v0, v0Min, v0Max, "v0", true);
validateConstraint(v0, v0Min, v0Max, "v0");

const auto timeGap = model.timeGap;
constexpr double timeGapMin = 0.1;
Expand All @@ -146,7 +146,7 @@ void CollisionFreeSpeedModel::CheckModelConstraint(
}
}

const auto lineSegments = geometry.LineSegmentsInDistanceTo(r / 2., agent.pos);
const auto lineSegments = geometry.LineSegmentsInDistanceTo(r, agent.pos);
if(std::begin(lineSegments) != std::end(lineSegments)) {
throw SimulationError(
"Model constraint violation: Agent {} too close to geometry boundaries, distance "
Expand Down
2 changes: 1 addition & 1 deletion libsimulator/src/GeneralizedCentrifugalForceModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void GeneralizedCentrifugalForceModel::CheckModelConstraint(
const auto v0 = model.v0;
constexpr double v0Min = 0.;
constexpr double v0Max = 10.;
validateConstraint(v0, v0Min, v0Max, "v0", true);
validateConstraint(v0, v0Min, v0Max, "v0");

const auto Av = model.Av;
constexpr double AvMin = 0.;
Expand Down
4 changes: 2 additions & 2 deletions libsimulator/src/OperationalModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ void validateConstraint(
T valueMin,
T valueMax,
const std::string& name,
bool includeMin = false)
bool excludeMin = false)
{
if(includeMin) {
if(excludeMin) {
if(value <= valueMin || value > valueMax) {
throw SimulationError(
"Model constraint violation: {} {} not in allowed range, "
Expand Down
Loading

0 comments on commit dcb7e9c

Please sign in to comment.