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

fix hazmat #3865

Merged
merged 2 commits into from Dec 9, 2022
Merged

fix hazmat #3865

merged 2 commits into from Dec 9, 2022

Conversation

nilsnolde
Copy link
Member

fixes #3861

Will comment in the PR.

Comment on lines +284 to +285
["destination"] = "false",
["delivery"] = "false"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we shouldn't allow trucks on roads with hazmat=destination, as we always allow starting/ending on a hazmat=no road, so for us it actually has no meaning.

src/sif/truckcost.cc Outdated Show resolved Hide resolved
@@ -381,7 +381,7 @@ bool TruckCost::AllowMultiPass() const {
bool TruckCost::ModeSpecificAllowed(const baldr::AccessRestriction& restriction) const {
switch (restriction.type()) {
case AccessType::kHazmat:
if (hazmat_ != restriction.value()) {
if (hazmat_ && !restriction.value()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first check if hazmat is even turned on in the request before comparing it, since otherwise would not allow a combo like hazmat: false in the request but hazmat: true on the road.

@nilsnolde
Copy link
Member Author

nilsnolde commented Dec 9, 2022

Eventually I'd like to be able to categorize a bit more the hazmat types (A - E). AFAICT it doesn't need any change to any structures (no bits added), only the lua & access restriction & request parsing logic would need to change a bit. But I think it's fairly easily doable.

@kevinkreiser
Copy link
Member

We would have to store the types somewhere, presumably in the restriction, so that structure would need to change to accommodate it, but I agree we can trivially stuff it in the value as a mask. Iirc there are 9 classifications that the hundreds of placards can fall into. We have 64 bits so 9 easily fits. Then in request processing we could allow specifying the placard and we can turn that into a type/category. Anyway seems totally doable

@nilsnolde nilsnolde merged commit 31d95fe into master Dec 9, 2022
@nilsnolde nilsnolde deleted the nn-fix-hazmat branch December 9, 2022 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Truck-Routing with hazardous material
2 participants