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

Reservations #36

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c4fb598
Add address sanitizer.
arjo129 May 6, 2021
4e6c6de
Merge branch 'main' of https://github.com/open-rmf/rmf_traffic into main
arjo129 May 7, 2021
20a8383
Merge branch 'main' of https://github.com/open-rmf/rmf_traffic into main
arjo129 May 24, 2021
84262e7
back ported useful changes
arjo129 May 24, 2021
a3a424e
Added Writer API
arjo129 May 24, 2021
b737dcb
Add basic participant store
arjo129 May 24, 2021
374abd9
Add state API
arjo129 May 24, 2021
ce982c7
fix minor compile issues
arjo129 May 25, 2021
756d158
on par with the previous attempt
arjo129 May 27, 2021
b64be02
Add equality operator
arjo129 May 27, 2021
ab802cc
Add support for `NextStateGenerator` .
arjo129 May 28, 2021
82adb75
add removals
arjo129 May 31, 2021
f2698b2
Add insertion points
arjo129 Jun 1, 2021
5a2c9f9
Add hashes
arjo129 Jun 1, 2021
e5155ee
add push_back
arjo129 Jun 1, 2021
45172f6
Add begining
arjo129 Jun 2, 2021
2c825de
fix le compile issues
arjo129 Jun 2, 2021
ca1aa27
Finish Iterator begin and end
arjo129 Jun 4, 2021
3f2d092
make neater print
arjo129 Jun 7, 2021
af71eda
Add tests
arjo129 Jun 7, 2021
05f5ac1
manage to fix test case
arjo129 Jun 7, 2021
b93c32f
more segfault fixing
arjo129 Jun 8, 2021
6141168
work in removals :tada:
arjo129 Jun 8, 2021
f420ee8
Add primitives for planner
arjo129 Jun 8, 2021
47dc095
Added initial planner implementation
arjo129 Jun 9, 2021
d0a3185
Add planner
arjo129 Jun 9, 2021
23ac2e0
Add state difference
arjo129 Jun 15, 2021
f57d73c
Add state diff
arjo129 Jun 16, 2021
42a8967
Made progress on the execution engine
arjo129 Jun 16, 2021
0ecb7af
Add request list
arjo129 Jun 18, 2021
b79a933
Add states... Something wrong with toposort
arjo129 Jun 19, 2021
69d1ef1
const correctness, disable toposort
arjo129 Jun 19, 2021
8ea3264
Merge remote-tracking branch 'origin/main' into arjo/reservations_v2
arjo129 Jun 22, 2021
da92ad8
Documentation
arjo129 Jun 22, 2021
70d6bb5
fix failing test case
arjo129 Jun 23, 2021
a61e46c
style
arjo129 Jun 23, 2021
b3c08fe
style
arjo129 Jun 23, 2021
9c01012
fix divergences in test state
arjo129 Jun 23, 2021
0fb669d
Add Versioning Scheme
arjo129 Jun 25, 2021
7adb953
Merge remote-tracking branch 'origin/main' into arjo/reservations_v2
arjo129 Jul 1, 2021
3c47c8d
Merge remote-tracking branch 'origin/main' into arjo/reservations_v2
arjo129 Jul 15, 2021
bc5ad1f
minor clean ups
arjo129 Jul 15, 2021
5126d7c
more cleanups
arjo129 Jul 15, 2021
648360b
remove some crust
arjo129 Jul 15, 2021
23817a7
fixed memory issues; still have wierd planner behaviour.
arjo129 Jul 19, 2021
4a2f438
fix ordering?
arjo129 Jul 20, 2021
7bb05b7
Merge branch 'arjo/reservations_v2' of https://github.com/open-rmf/rm…
arjo129 Jul 20, 2021
2b4633d
Merge remote-tracking branch 'origin/main' into arjo/reservations_v2
arjo129 Jul 20, 2021
70ce90a
Style fixes
arjo129 Jul 20, 2021
c271ae5
fix state based style issues.
arjo129 Jul 20, 2021
5838c36
update state api
arjo129 Jul 21, 2021
c008dc6
Removed threading
arjo129 Jul 22, 2021
341be05
Rename ExecutionEngine
arjo129 Jul 22, 2021
184749a
Rename header
arjo129 Jul 22, 2021
f40bfce
Style fixes
arjo129 Jul 22, 2021
2a13f44
style fixes
arjo129 Jul 22, 2021
3ba6006
add debug flags to asan, for some reason cmake-args is being ignored.
arjo129 Jul 22, 2021
b2e318d
style
arjo129 Jul 22, 2021
c231cae
Adding test cases for cancellation
arjo129 Jul 22, 2021
2d6f3f2
fix style
arjo129 Jul 22, 2021
02401ef
Fix unregistration
arjo129 Jul 22, 2021
658ba42
style fixes
arjo129 Jul 22, 2021
eb0c34b
documentation and style fixes.
arjo129 Jul 22, 2021
2e55009
remove circular dependency
arjo129 Jul 23, 2021
5240770
fix `conflicts_with`
arjo129 Jul 23, 2021
9df78e8
style
arjo129 Jul 23, 2021
d2e06cc
style
arjo129 Jul 23, 2021
d4f7b9e
remove dead code
arjo129 Jul 23, 2021
1e207e8
update heuristic
arjo129 Jul 23, 2021
db8b747
function separators
arjo129 Jul 23, 2021
c2cbe94
style
arjo129 Jul 23, 2021
2b45926
a little less crusty?
arjo129 Jul 23, 2021
a4f58d0
style.
arjo129 Jul 23, 2021
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
Prev Previous commit
Next Next commit
Adding test cases for cancellation
Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
  • Loading branch information
arjo129 committed Jul 22, 2021
commit c231cae284e2e4b5c5f88d50ac6af972da472446
10 changes: 6 additions & 4 deletions rmf_traffic/src/rmf_traffic/reservations/internal/Protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ class Protocol
{
for (auto change: changes.differences())
{
assert(
_participant_store->get_participant(change.participant_id).has_value());
if(!_participant_store->get_participant(change.participant_id).has_value())
{
continue;
}

auto participant =
_participant_store->get_participant(change.participant_id).value();
Expand Down Expand Up @@ -221,8 +223,8 @@ class Protocol
{
auto impacted_participant = diff.participant_id;

assert(
_participant_store->get_participant(impacted_participant).has_value());
if(!_participant_store->get_participant(impacted_participant).has_value())
continue;

auto participant =
_participant_store->get_participant(impacted_participant)
Expand Down
66 changes: 66 additions & 0 deletions rmf_traffic/test/unit/reservations/test_Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class SimpleParticipant : public Participant
return _proposed[rid];
}

ParticipantId get_id() const
{
return _pid;
}

private:
ParticipantId _pid;
RequestId _reqid;
Expand Down Expand Up @@ -169,5 +174,66 @@ SCENARIO("Test database behaviour at the start of our lord, the saviour, UNIX")
REQUIRE(!participant1->get_proposal(req_id).has_value());
}
}

WHEN("We remove the second participant")
{
auto request1_alt1 = ReservationRequest::make_request(
"table_at_timbre",
ReservationRequest::TimeRange::make_time_range(
now,
now+5s
),
{10s}
);

auto request1 = std::vector{request1_alt1};
auto req_id = participant1->make_request_blocking(request1);
auto prop = participant1->get_proposal(req_id);

std::shared_ptr<SimpleParticipant> participant2 =
std::make_shared<SimpleParticipant>(1, database, 20);
database->register_participant(1, participant2);
auto req_id2 = participant2->make_request_blocking(request1);
auto prop2 = participant2->get_proposal(req_id2);
REQUIRE(prop2.has_value());
REQUIRE(!participant1->get_proposal(req_id).has_value());

database->unregister_participant(participant2->get_id());
THEN("Participant 1 will regain its reservation")
{
//REQUIRE(participant1->get_proposal(req_id).has_value());
}
}


WHEN("We cancel the second reservation")
{
auto request1_alt1 = ReservationRequest::make_request(
"table_at_timbre",
ReservationRequest::TimeRange::make_time_range(
now,
now+5s
),
{10s}
);

auto request1 = std::vector{request1_alt1};
auto req_id = participant1->make_request_blocking(request1);
auto prop = participant1->get_proposal(req_id);

std::shared_ptr<SimpleParticipant> participant2 =
std::make_shared<SimpleParticipant>(1, database, 20);
database->register_participant(1, participant2);
auto req_id2 = participant2->make_request_blocking(request1);
auto prop2 = participant2->get_proposal(req_id2);
REQUIRE(prop2.has_value());
REQUIRE(!participant1->get_proposal(req_id).has_value());

database->cancel_request(participant2->get_id(), req_id2);
THEN("Participant 1 will regain its reservation.")
{
REQUIRE(participant1->get_proposal(req_id).has_value());
}
}
}
}