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

Adds a simple parking spot management system. #325

Open
wants to merge 131 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
a9da70a
Bump main to 2.3.2 (#299)
Yadunund Aug 28, 2023
8a71324
Cancel automatic pending tasks that are removed during new assignment…
aaronchongth Sep 28, 2023
480f439
Add support for multiple destinations in `GoToPlace`
arjo129 Nov 21, 2023
267d200
Missed the schema
arjo129 Nov 21, 2023
a316675
Update schema to follow @mxgrey's specifications.
arjo129 Nov 21, 2023
6dda072
Tweaking implementation
mxgrey Dec 18, 2023
3a3786e
Mutex groups, dynamic charging, and more (#310)
mxgrey Dec 15, 2023
9e90fd7
Update changelog and bump version (#311)
mxgrey Dec 15, 2023
93729d5
Fix merge with main
mxgrey Dec 18, 2023
433dc94
Fix same floor constraint parsing
mxgrey Dec 20, 2023
8c8ad1d
Fix a minor typo in fleet adapter error log
arjo129 Oct 31, 2023
9c06243
Add Reservation System node
arjo129 Nov 7, 2023
0eba733
Rework node for new flexible time API
arjo129 Jan 10, 2024
5e0cbe2
Adding support for reservation system in classic RMF
arjo129 Jan 16, 2024
6fe0d4f
Some things missing from previous push
arjo129 Jan 16, 2024
59fc995
Add support for releasing reservations
arjo129 Jan 26, 2024
e1c37fc
Added a simple C++ mutex based proto-reservation system
arjo129 Feb 1, 2024
76100b6
Adds a simple parking spot management system.
arjo129 Feb 5, 2024
705028a
Fix edge case when starting on a lane (#312)
mxgrey Dec 21, 2023
fe3534c
Update changelogs and 2.5.0 (#313)
Yadunund Dec 22, 2023
91ce68b
Adds an option to generate unique hex strings for new task ids, fix t…
aaronchongth Jan 22, 2024
7c51898
Add support of fleet-level task (#317)
cwrx777 Jan 26, 2024
ed96418
use keep_last(10) for all instances without a depth already set
Jan 31, 2024
5c04a66
style
Jan 31, 2024
a70a6ca
catch multi line usages
Jan 31, 2024
727dcbd
catch some extra edge cases
Jan 31, 2024
d4fc0bc
fix false positive
Feb 1, 2024
e4e9433
Change emergency pullover behaviour.
arjo129 Feb 7, 2024
b38612e
Style
arjo129 Feb 7, 2024
3af172e
Remove holding time nonsense.
arjo129 Feb 16, 2024
317ee7f
Don't wait for retry. immediately plan.
arjo129 Mar 1, 2024
98d3b37
Cancel retry timer
arjo129 Mar 1, 2024
dd65259
Better logging.
arjo129 Mar 1, 2024
bcde5fe
merge
arjo129 Apr 26, 2024
dfbcdfe
add in_lift readonly property in Graph::Waypoint binding. (#326)
cwrx777 Feb 28, 2024
3badb2e
Add Backward-ROS for improved logging in event of segfaults (#327)
arjo129 Mar 6, 2024
ea0afb3
include cstdint header (#331)
Yadunund Mar 13, 2024
ccba1e5
Removes a line of dead code (#322)
arjo129 Mar 13, 2024
b10baee
Bump main to 2.6.0 (#332)
Yadunund Mar 13, 2024
145b9cf
Add Speed Limit Requests (#222) (#335)
Yadunund Mar 18, 2024
872213b
Fix interaction between emergency pullover and finishing task (#333)
mxgrey Mar 19, 2024
e92d165
Support labels in booking information (#328)
aaronchongth Mar 21, 2024
07b4a52
Release other mutexes if robot started charging (#334)
xiyuoh Mar 25, 2024
fac1703
Add all_known_lifts in Graph binding (#336)
cwrx777 Mar 25, 2024
8a4b9e8
Stabilize commissioning feature (#338)
mxgrey Apr 8, 2024
fd8fe46
Refactors the socket broadcast client (#329)
arjo129 Apr 8, 2024
0ded63b
Lower debug level of some messages in rmf_websocket (#340)
arjo129 Apr 9, 2024
61f712a
Manual release of mutex groups (#339)
mxgrey Apr 17, 2024
24ca1ac
Disable automatic retreat (#330)
xiyuoh Apr 18, 2024
1665859
Fix deadlock in websocket server (#342)
arjo129 Apr 23, 2024
caf32bf
Automatically begin or cancel idle behavior when commission changes (…
mxgrey Apr 25, 2024
5494dec
Add fleet-level reassign dispatched tasks API (#348)
xiyuoh May 6, 2024
908e00d
Fix schema dictionary used during robot status override (#349)
mxgrey May 7, 2024
eaec283
Filter DoorOpen insertion by map name (#353)
mxgrey May 10, 2024
dba5bbd
Event based lift / door logic (#320)
luca-della-vedova May 10, 2024
8df5bab
Fix segfault
arjo129 Jun 7, 2024
66afd15
Merge remote-tracking branch 'origin/main' into arjo/feat/integrated_…
arjo129 Jun 10, 2024
550c817
Fix compile issues.
arjo129 Jun 10, 2024
712848d
Merge branch 'main' into arjo/feat/integrated_ressys
arjo129 Jun 19, 2024
498365f
Merge branch 'main' into arjo/feat/integrated_ressys
arjo129 Jun 20, 2024
ec3f2de
Merge branch 'main' into arjo/feat/integrated_ressys
arjo129 Jul 15, 2024
f93747b
Merge branch 'main' into arjo/feat/integrated_ressys
luca-della-vedova Jul 18, 2024
1c89d26
Get config from yaml to `RobotContext`
arjo129 Jul 19, 2024
ad92262
Restore old behaviour by default.
arjo129 Jul 19, 2024
b8f0100
Only proceed if next spot is free.
arjo129 Jul 19, 2024
82176af
Still broken: Fixing implementation of wait and spot and then go beha…
arjo129 Jul 23, 2024
a51157f
Fix compilation eror
arjo129 Jul 24, 2024
999d04a
Giant refactor
arjo129 Jul 29, 2024
3a7d942
Merge remote-tracking branch 'origin/main' into arjo/feat/integrated_…
arjo129 Jul 31, 2024
ae62f4f
Basic queueing is working
arjo129 Jul 31, 2024
e39f83c
Looks like the segfault was thanks to some logging
arjo129 Jul 31, 2024
19e8618
So... I know how to fix the leak but that version does not work
arjo129 Aug 1, 2024
dfaa0ea
Fixed memory leak
arjo129 Aug 1, 2024
af2185d
Finally works fully
arjo129 Aug 2, 2024
0fefbb3
Add docs
arjo129 Aug 2, 2024
3b049bc
Whoops fix stray keystroke
arjo129 Aug 2, 2024
f90946d
Release in the correct place
arjo129 Aug 2, 2024
cf4885b
Merge remote-tracking branch 'origin/main' into arjo/feat/integrated_…
arjo129 Aug 5, 2024
2c18dcb
Code clean ups
arjo129 Aug 8, 2024
3f4bd8a
Fix typos
arjo129 Aug 8, 2024
020d7b1
Switched to names to support multiple graphs
arjo129 Aug 8, 2024
b264cfb
Refactoring and Stylistic changes
arjo129 Aug 14, 2024
49a82a6
Removing unused subscriber
arjo129 Aug 14, 2024
bdb8cc4
More refactoring
arjo129 Aug 16, 2024
f868131
More style fixes
arjo129 Aug 16, 2024
7728eb7
More style fixes
arjo129 Aug 16, 2024
7dcc41f
More style fixes
arjo129 Aug 16, 2024
7302369
More style fixes
arjo129 Aug 16, 2024
f8aad5d
More refactoring
arjo129 Aug 19, 2024
1af04f0
Was logging the wrong thing
arjo129 Aug 20, 2024
196bfdd
Update Readme
arjo129 Aug 21, 2024
da54f12
Fix deadlock
arjo129 Aug 21, 2024
eb97406
Style fixes
arjo129 Aug 21, 2024
7d41ece
Merge remote-tracking branch 'origin/main' into arjo/feat/integrated_…
arjo129 Aug 21, 2024
5dca4bb
Add support for getting lost
arjo129 Aug 27, 2024
62446ab
Fix segfault
arjo129 Aug 28, 2024
f424094
Fixed patrol behaviour
arjo129 Sep 2, 2024
ca75f7e
Support cancellation
arjo129 Sep 17, 2024
06afb59
More Refactors
arjo129 Sep 17, 2024
aff7fcb
Address namespacing issue
arjo129 Sep 17, 2024
33a7930
Style
arjo129 Sep 17, 2024
da01d5d
Style
arjo129 Sep 17, 2024
e4218cb
Merge branch 'main' into arjo/feat/integrated_ressys
arjo129 Sep 17, 2024
704d140
Fix navigation parameters
mxgrey Sep 24, 2024
32f2160
Mega Re-name
arjo129 Sep 25, 2024
66b546d
Merge branch 'main' into arjo/feat/integrated_ressys
arjo129 Sep 26, 2024
0da49f3
Mostly style fixes address shared pointer capture
arjo129 Sep 26, 2024
5b368d3
Merge branch 'arjo/feat/integrated_ressys' of github.com:open-rmf/rmf…
arjo129 Sep 26, 2024
646de63
More style fixes
arjo129 Sep 28, 2024
a00d34c
More style fixes
arjo129 Sep 30, 2024
b57cb3e
Rework how configurations are loaded so as not to break abi
arjo129 Sep 30, 2024
f2fced6
More cleanups
arjo129 Sep 30, 2024
3e5ccc2
More cleanups
arjo129 Sep 30, 2024
fc345f9
Copyright headers
arjo129 Sep 30, 2024
19f1eb2
Move make_request to worker thread lso make sure we only use the rese…
arjo129 Oct 1, 2024
66ea3ba
Style
arjo129 Oct 1, 2024
5e74ac2
Clean up readme
arjo129 Oct 1, 2024
f9d7195
Use rclcpp for logging everywhere
arjo129 Oct 2, 2024
ed07cb8
Cancellation flow
arjo129 Oct 2, 2024
3d25ec7
Make sure cancellation is done on worker
arjo129 Oct 2, 2024
9e16a6e
Use updated topic names
arjo129 Oct 3, 2024
d50e194
Clean up reservatiion Manager
arjo129 Oct 4, 2024
e68733f
Minor renames
arjo129 Oct 4, 2024
16531d6
Merge remote-tracking branch 'origin/main' into arjo/feat/integrated_…
arjo129 Oct 4, 2024
6373d8c
Fix compile error and rename variable to be more readable
arjo129 Oct 4, 2024
d016fbe
Remove key stroke
arjo129 Oct 4, 2024
d610e13
Fix logging levels and log robot id
arjo129 Oct 4, 2024
0b8e7fb
Remove retry timer.
arjo129 Oct 4, 2024
df7b21d
Merge branch 'main' into arjo/feat/integrated_ressys
mxgrey Oct 4, 2024
7efbf45
Refactor
arjo129 Oct 4, 2024
045c5ed
Merge branch 'arjo/feat/integrated_ressys' of github.com:open-rmf/rmf…
arjo129 Oct 4, 2024
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
8 changes: 8 additions & 0 deletions rmf_fleet_adapter/include/rmf_fleet_adapter/StandardNames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ const std::string MutexGroupStatesTopicName = "mutex_group_states";
const std::string MutexGroupManualReleaseTopicName =
"mutex_group_manual_release";

const std::string ReservationRequestTopicName = "rmf/reservations/request";
const std::string ReservationResponseTopicName = "rmf/reservations/tickets";
const std::string ReservationClaimTopicName = "rmf/reservations/claim";
const std::string ReservationAllocationTopicName =
"rmf/reservations/allocation";
const std::string ReservationReleaseTopicName = "rmf/reservations/release";
const std::string ReservationCancelTopicName = "rmf/reservations/cancel";

const uint64_t Unclaimed = (uint64_t)(-1);

} // namespace rmf_fleet_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,13 @@ class EasyFullControl::FleetConfiguration
/// Should robots in this fleet have responsive wait enabled by default?
bool default_responsive_wait() const;

/// Should robots use the parking reservation system.
bool using_parking_reservation_system() const;

/// Set whether this fleet uses the parking reservation system.
void use_parking_reservation_system(
const bool use);

/// Set whether robots in this fleet should have responsive wait enabled by
/// default.
void set_default_responsive_wait(bool enable);
Expand Down
1 change: 1 addition & 0 deletions rmf_fleet_adapter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<depend>rmf_api_msgs</depend>
<depend>rmf_battery</depend>
<depend>rmf_building_map_msgs</depend>
<depend>rmf_reservation_msgs</depend>
<depend>rmf_dispenser_msgs</depend>
<depend>rmf_door_msgs</depend>
<depend>rmf_fleet_msgs</depend>
Expand Down
3 changes: 2 additions & 1 deletion rmf_fleet_adapter/src/rmf_fleet_adapter/agv/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ std::shared_ptr<EasyFullControl> Adapter::add_easy_fleet(
config.default_responsive_wait(),
config.default_max_merge_waypoint_distance(),
config.default_max_merge_lane_distance(),
config.default_min_lane_length());
config.default_min_lane_length(),
config.using_parking_reservation_system());
}

//==============================================================================
Expand Down
31 changes: 30 additions & 1 deletion rmf_fleet_adapter/src/rmf_fleet_adapter/agv/EasyFullControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,7 @@ class EasyFullControl::FleetConfiguration::Implementation
double default_min_lane_length;
std::unordered_map<std::string, std::string> lift_emergency_levels;
std::unordered_set<std::size_t> strict_lanes;
bool use_parking_reservation;
};

//==============================================================================
Expand Down Expand Up @@ -2063,7 +2064,8 @@ EasyFullControl::FleetConfiguration::FleetConfiguration(
std::move(default_max_merge_lane_distance),
std::move(default_min_lane_length),
{},
{}
{},
false // Parking reservation system
}))
{
// Do nothing
Expand Down Expand Up @@ -2474,6 +2476,14 @@ EasyFullControl::FleetConfiguration::from_config_files(
default_responsive_wait = default_responsive_wait_yaml.as<bool>();
}

bool use_simple_parking_reservation_system = false;
const YAML::Node& parking_reservation = rmf_fleet["use_parking_reservations"];
if (parking_reservation)
{
use_simple_parking_reservation_system =
parking_reservation.as<bool>();
}

double default_max_merge_waypoint_distance = 1e-3;
const YAML::Node& default_max_merge_waypoint_distance_yaml =
rmf_fleet["max_merge_waypoint_distance"];
Expand Down Expand Up @@ -2743,6 +2753,7 @@ EasyFullControl::FleetConfiguration::from_config_files(
default_min_lane_length);
config.change_lift_emergency_levels() = lift_emergency_levels;
config.set_retreat_to_charger_interval(retreat_to_charger_interval);
config.use_parking_reservation_system(use_simple_parking_reservation_system);
config.change_strict_lanes() = std::move(strict_lanes);
return config;
}
Expand Down Expand Up @@ -3056,6 +3067,20 @@ bool EasyFullControl::FleetConfiguration::default_responsive_wait() const
return _pimpl->default_responsive_wait;
}

//==============================================================================
bool EasyFullControl::FleetConfiguration::using_parking_reservation_system()
const
{
return _pimpl->use_parking_reservation;
}

//==============================================================================
void EasyFullControl::FleetConfiguration::use_parking_reservation_system(
const bool use)
{
_pimpl->use_parking_reservation = use;
}

//==============================================================================
void EasyFullControl::FleetConfiguration::set_default_responsive_wait(
bool enable)
Expand Down Expand Up @@ -3362,6 +3387,7 @@ auto EasyFullControl::add_robot(
localization = std::move(localization),
nav_params = robot_nav_params,
enable_responsive_wait,
use_parking_reservation = _pimpl->use_parking_reservation,
finishing_request
](const RobotUpdateHandlePtr& updater)
{
Expand All @@ -3382,6 +3408,7 @@ auto EasyFullControl::add_robot(
context,
nav_params,
enable_responsive_wait,
use_parking_reservation,
finishing_request
](const auto&)
{
Expand All @@ -3403,6 +3430,8 @@ auto EasyFullControl::add_robot(
context->robot_finishing_request(true);
}

context->_set_parking_spot_manager(use_parking_reservation);

RCLCPP_INFO(
node->get_logger(),
"Successfully added robot [%s] to the fleet [%s].",
Expand Down
59 changes: 59 additions & 0 deletions rmf_fleet_adapter/src/rmf_fleet_adapter/agv/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ std::shared_ptr<Node> Node::make(
node->create_observable<MutexGroupStates>(
MutexGroupStatesTopicName, transient_local_qos);

node->_reservation_request_pub =
node->create_publisher<ReservationRequest>(
ReservationRequestTopicName, transient_local_qos);

node->_reservation_ticket_obs =
node->create_observable<ReservationTicket>(
ReservationResponseTopicName, transient_local_qos);

node->_reservation_claim_pub =
node->create_publisher<ReservationClaim>(
ReservationClaimTopicName, transient_local_qos);

node->_reservation_alloc_obs =
node->create_observable<ReservationAllocation>(
ReservationAllocationTopicName, transient_local_qos);

node->_reservation_release_pub =
node->create_publisher<ReservationRelease>(
ReservationReleaseTopicName, transient_local_qos);

node->_reservation_cancel_pub =
node->create_publisher<ReservationCancel>(
ReservationCancelTopicName, transient_local_qos);

return node;
}

Expand Down Expand Up @@ -260,5 +284,40 @@ auto Node::mutex_group_states() const -> const MutexGroupStatesObs&
return _mutex_group_states_obs->observe();
}

//==============================================================================
auto Node::location_requester() const -> const ReservationRequestPub&
{
return _reservation_request_pub;
}

//==============================================================================
auto Node::claim_location_ticket() const -> const ReservationClaimPub&
{
return _reservation_claim_pub;
}

//==============================================================================
auto Node::location_ticket_obs() const -> const ReservationTicketObs&
{
return _reservation_ticket_obs->observe();
}

//==============================================================================
auto Node::allocated_claims_obs() const -> const ReservationAllocationObs&
{
return _reservation_alloc_obs->observe();
}

//==============================================================================
auto Node::release_location() const -> const ReservationReleasePub&
{
return _reservation_release_pub;
}

//==============================================================================
auto Node::cancel_reservation() const -> const ReservationCancelPub&
{
return _reservation_cancel_pub;
}
} // namespace agv
} // namespace rmf_fleet_adapter
43 changes: 43 additions & 0 deletions rmf_fleet_adapter/src/rmf_fleet_adapter/agv/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef SRC__RMF_FLEET_ADAPTER__AGV__NODE_HPP
#define SRC__RMF_FLEET_ADAPTER__AGV__NODE_HPP


#include <rmf_rxcpp/Transport.hpp>

#include <rmf_dispenser_msgs/msg/dispenser_request.hpp>
Expand All @@ -32,6 +33,13 @@
#include <rmf_lift_msgs/msg/lift_request.hpp>
#include <rmf_lift_msgs/msg/lift_state.hpp>
#include <rmf_task_msgs/msg/task_summary.hpp>
#include <rmf_reservation_msgs/msg/claim_request.hpp>
#include <rmf_reservation_msgs/msg/flexible_time_request.hpp>
#include <rmf_reservation_msgs/msg/free_parking_spots.hpp>
#include <rmf_reservation_msgs/msg/release_request.hpp>
#include <rmf_reservation_msgs/msg/reservation_allocation.hpp>
#include <rmf_reservation_msgs/msg/ticket.hpp>

#include <std_msgs/msg/bool.hpp>

#include <rmf_fleet_msgs/msg/fleet_state.hpp>
Expand Down Expand Up @@ -135,6 +143,35 @@ class Node : public rmf_rxcpp::Transport
using MutexGroupStatesObs = rxcpp::observable<MutexGroupStates::SharedPtr>;
const MutexGroupStatesObs& mutex_group_states() const;

using ReservationRequest = rmf_reservation_msgs::msg::FlexibleTimeRequest;
using ReservationRequestPub =
rclcpp::Publisher<ReservationRequest>::SharedPtr;
const ReservationRequestPub& location_requester() const;

using ReservationTicket = rmf_reservation_msgs::msg::Ticket;
using ReservationTicketObs = rxcpp::observable<ReservationTicket::SharedPtr>;
const ReservationTicketObs& location_ticket_obs() const;

using ReservationClaim = rmf_reservation_msgs::msg::ClaimRequest;
using ReservationClaimPub = rclcpp::Publisher<ReservationClaim>::SharedPtr;
const ReservationClaimPub& claim_location_ticket() const;

using ReservationAllocation = rmf_reservation_msgs::msg::ReservationAllocation;
using ReservationAllocationObs =
rxcpp::observable<ReservationAllocation::SharedPtr>;
const ReservationAllocationObs& allocated_claims_obs() const;

using ReservationRelease = rmf_reservation_msgs::msg::ReleaseRequest;
using ReservationReleasePub =
rclcpp::Publisher<ReservationRelease>::SharedPtr;
const ReservationReleasePub& release_location() const;

using ReservationCancel = rmf_reservation_msgs::msg::ReleaseRequest;
using ReservationCancelPub =
rclcpp::Publisher<ReservationCancel>::SharedPtr;
const ReservationCancelPub& cancel_reservation() const;


template<typename DurationRepT, typename DurationT, typename CallbackT>
rclcpp::TimerBase::SharedPtr try_create_wall_timer(
std::chrono::duration<DurationRepT, DurationT> period,
Expand Down Expand Up @@ -195,6 +232,12 @@ class Node : public rmf_rxcpp::Transport
MutexGroupRequestPub _mutex_group_request_pub;
Bridge<MutexGroupRequest> _mutex_group_request_obs;
Bridge<MutexGroupStates> _mutex_group_states_obs;
ReservationRequestPub _reservation_request_pub;
Bridge<ReservationTicket> _reservation_ticket_obs;
ReservationClaimPub _reservation_claim_pub;
Bridge<ReservationAllocation> _reservation_alloc_obs;
ReservationReleasePub _reservation_release_pub;
ReservationCancelPub _reservation_cancel_pub;
};

} // namespace agv
Expand Down
72 changes: 72 additions & 0 deletions rmf_fleet_adapter/src/rmf_fleet_adapter/agv/ReservationManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2024 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include "ReservationManager.hpp"
#include "RobotContext.hpp"

using namespace rmf_fleet_adapter::agv;

//==============================================================================
void ReservationManager::replace_ticket(
const rmf_reservation_msgs::msg::ReservationAllocation new_allocation)
{
if (has_ticket())
{
if (new_allocation.ticket.ticket_id != _allocation->ticket.ticket_id)
{
RCLCPP_INFO(
_context->node()->get_logger(),
"Releasing waypoint for ticket %lu as new ticket has become available",
_allocation->ticket.ticket_id);
rmf_reservation_msgs::msg::ReleaseRequest msg;
msg.ticket = _allocation->ticket;
_context->node()->release_location()->publish(msg);
}
}
_allocation = new_allocation;
}

//==============================================================================
void ReservationManager::cancel()
{
if (has_ticket())
return;

RCLCPP_INFO(
_context->node()->get_logger(),
"Cancelling ticket %lu",
_allocation->ticket.ticket_id);
rmf_reservation_msgs::msg::ReleaseRequest msg;
msg.ticket = _allocation->ticket;
_context->node()->cancel_reservation()->publish(msg);
_allocation = std::nullopt;
}

//==============================================================================
std::string ReservationManager::get_reserved_location() const
{
if (has_ticket())
return _allocation->resource;

return "";
}

//==============================================================================
bool ReservationManager::has_ticket() const
{
return _allocation.has_value();
}
Loading
Loading