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

Allow v0 to be zero #1283

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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