Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Michael X. Grey <[email protected]>
  • Loading branch information
mxgrey committed Sep 23, 2024
2 parents 5c4b796 + 16e5557 commit 72cd379
Show file tree
Hide file tree
Showing 57 changed files with 1,193 additions and 254 deletions.
1 change: 1 addition & 0 deletions .github/workflows/asan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
[{"ros_distribution": "humble",
"ubuntu_distribution": "jammy"}]
# NOTE: Avoid adding comments in the package lines, this can break some of the called scripts in github actions
repos-branch-override: "main"
packages: |
rmf_traffic_ros2
rmf_task_ros2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: open-rmf/rmf_ci_templates/.github/workflows/reusable_build.yaml@main
with:
# NOTE: Avoid adding comments in the package lines, this can break some of the called scripts in github actions
repos-branch-override: "main"
packages: |
rmf_fleet_adapter
rmf_fleet_adapter_python
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tsan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
[{"ros_distribution": "humble",
"ubuntu_distribution": "jammy"}]
# NOTE: Avoid adding comments in the package lines, this can break some of the called scripts in github actions
repos-branch-override: "main"
packages: |
rmf_traffic_ros2
rmf_task_ros2
Expand Down
11 changes: 11 additions & 0 deletions rmf_charging_schedule/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
Changelog for package rmf_charging_schedule
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.8.0 (2024-06-12)
------------------

2.7.1 (2024-06-11)
------------------
* Fix charging status (`#347 <https://github.com/open-rmf/rmf_ros2/pull/347>`_)
* Contributors: Grey

2.7.0 (2024-06-01)
------------------

2.6.0 (2024-03-13)
------------------

Expand Down
5 changes: 5 additions & 0 deletions rmf_charging_schedule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format for the schedule looks like this:
"02:00": { "robot_3": "charger_A", "robot_1": "queue_A" }
"03:55": { "robot_2": "queue_B" }
"04:00": { "robot_1": "charger_B", "robot_2": "queue_A" }
parking: ["queue_A", "queue_B"]
```

The time format is `"HH:MM"` where `HH` ranges from `00` to `23` and `MM` ranges
Expand Down Expand Up @@ -37,3 +38,7 @@ the intended charger assignments at midnight. When the node is launched, it will
move through the schedule from the earliest entry up until the last relevant one
and issue an initial charger assignment message based on what the assignments
would have been if the schedule had run from `00:00`.

If any of the waypoints are parking points instead of charging points, put them
into a list called `parking`. Note that this node does not support the existence
of a fleet with the name `parking`.
3 changes: 2 additions & 1 deletion rmf_charging_schedule/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rmf_charging_schedule</name>
<version>2.6.0</version>
<version>2.8.0</version>
<description>Node for a fixed 24-hour rotating charger usage schedule</description>
<maintainer email="[email protected]">Grey</maintainer>
<license>Apache License 2.0</license>

<depend>rclpy</depend>
<depend>rmf_fleet_msgs</depend>
<depend>python3-icecream</depend>

<export>
<build_type>ament_python</build_type>
Expand Down
31 changes: 23 additions & 8 deletions rmf_charging_schedule/rmf_charging_schedule/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,23 @@ def __init__(self, fleet, robot, charger):
self.charger = charger


def publish_assignments(publisher: Publisher, assignments: dict[dict[str]]):
def publish_assignments(
publisher: Publisher,
assignments: dict[dict[str]],
parking: list[str]
):
for fleet, robots in assignments.items():
msg = ChargingAssignments()
msg.fleet_name = fleet
for robot, charger in robots.items():
assignment = ChargingAssignment()
assignment.robot_name = robot
assignment.waypoint_name = charger
# The mode isn't actually used yet, so it doesn't matter what we set
# it to.
assignment.mode = ChargingAssignment.MODE_CHARGE

if charger in parking:
assignment.mode = ChargingAssignment.MODE_WAIT
else:
assignment.mode = ChargingAssignment.MODE_CHARGE
msg.assignments.append(assignment)

publisher.publish(msg)
Expand All @@ -89,6 +95,7 @@ def update_assignments(
sorted_times: list,
schedule: dict,
assignments: dict,
parking: list[str],
publisher: Publisher,
node: Node,
):
Expand All @@ -100,7 +107,7 @@ def update_assignments(
f'Sending {change.fleet}/{change.robot} to {change.charger} at '
f'{key.hour:02d}:{key.minute:02d}'
)
publish_assignments(publisher, assignments)
publish_assignments(publisher, assignments, parking)


def simulation_time(node: Node) -> ScheduleTimePoint:
Expand Down Expand Up @@ -176,7 +183,14 @@ def main(argv=sys.argv):
schedule_yaml = yaml.safe_load(f)

unsorted_schedule = {}
parking = []
for fleet, change in schedule_yaml.items():
if fleet == 'parking':
# We treat the parking entry as a special case that simply lists
# which waypoints are parking spots
parking = change
continue

for time_text, assignments in change.items():
time = ScheduleTimePoint.parse(time_text)
entry: list[Assignment] = unsorted_schedule.get(time, list())
Expand Down Expand Up @@ -206,7 +220,7 @@ def main(argv=sys.argv):
last_update_index = bisect.bisect_right(sorted_times, get_time())
update_assignments(
None, last_update_index,
sorted_times, schedule, assignments, publisher, node,
sorted_times, schedule, assignments, parking, publisher, node,
)

def update():
Expand All @@ -215,20 +229,21 @@ def update():
nonlocal schedule
nonlocal assignments
nonlocal publisher
nonlocal parking

next_update_index = bisect.bisect_right(sorted_times, get_time())
if last_update_index < next_update_index:
update_assignments(
last_update_index, next_update_index,
sorted_times, schedule, assignments, publisher, node,
sorted_times, schedule, assignments, parking, publisher, node,
)
last_update_index = next_update_index

elif next_update_index < last_update_index:
# The cycle must have restarted, e.g. passing midnight
update_assignments(
None, next_update_index,
sorted_times, schedule, assignments, publisher, node,
sorted_times, schedule, assignments, parking, publisher, node,
)
last_update_index = next_update_index

Expand Down
3 changes: 2 additions & 1 deletion rmf_charging_schedule/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

setup(
name=package_name,
version='2.6.0',
version='2.8.0',
packages=find_packages(),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
],
Expand Down
24 changes: 24 additions & 0 deletions rmf_fleet_adapter/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
Changelog for package rmf_fleet_adapter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.8.0 (2024-06-12)
------------------

2.7.1 (2024-06-11)
------------------
* Fix charging status (`#347 <https://github.com/open-rmf/rmf_ros2/pull/347>`_)
* Contributors: Grey

2.7.0 (2024-06-01)
------------------
* Fix race condition for ingesting/dispensing and disable uncrustify tests by default (`#362 <https://github.com/open-rmf/rmf_ros2/pull/362>`_)
* Event based lift / door logic (`#320 <https://github.com/open-rmf/rmf_ros2/pull/320>`_)
* Filter DoorOpen insertion by map name (`#353 <https://github.com/open-rmf/rmf_ros2/pull/353>`_)
* Fix schema dictionary used during robot status override (`#349 <https://github.com/open-rmf/rmf_ros2/pull/349>`_)
* Add fleet-level reassign dispatched tasks API (`#348 <https://github.com/open-rmf/rmf_ros2/pull/348>`_)
* Automatically begin or cancel idle behavior when commission changes (`#346 <https://github.com/open-rmf/rmf_ros2/pull/346>`_)
* Disable automatic retreat (`#330 <https://github.com/open-rmf/rmf_ros2/pull/330>`_)
* Manual release of mutex groups (`#339 <https://github.com/open-rmf/rmf_ros2/pull/339>`_)
* Stabilize commissioning feature (`#338 <https://github.com/open-rmf/rmf_ros2/pull/338>`_)
* Release other mutexes if robot started charging (`#334 <https://github.com/open-rmf/rmf_ros2/pull/334>`_)
* Support labels in booking information (`#328 <https://github.com/open-rmf/rmf_ros2/pull/328>`_)
* Fix interaction between emergency pullover and finishing task (`#333 <https://github.com/open-rmf/rmf_ros2/pull/333>`_)
* Contributors: Aaron Chong, Grey, Luca Della Vedova, Xiyu, Yadunund

2.6.0 (2024-03-13)
------------------
* Removes a line of dead code (`#322 <https://github.com/open-rmf/rmf_ros2/pull/322>`_)
Expand Down
4 changes: 3 additions & 1 deletion rmf_fleet_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ foreach(pkg ${dep_pkgs})
find_package(${pkg} REQUIRED)
endforeach()

if(BUILD_TESTING)
# Disable uncrustify tests by default.
set(TEST_UNCRUSTIFY "Off")
if(BUILD_TESTING AND TEST_UNCRUSTIFY)
find_package(ament_cmake_uncrustify REQUIRED)
find_file(uncrustify_config_file
NAMES "rmf_code_style.cfg"
Expand Down
2 changes: 2 additions & 0 deletions rmf_fleet_adapter/include/rmf_fleet_adapter/StandardNames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const std::string ChargingAssignmentsTopicName = "charging_assignments";

const std::string MutexGroupRequestTopicName = "mutex_group_request";
const std::string MutexGroupStatesTopicName = "mutex_group_states";
const std::string MutexGroupManualReleaseTopicName =
"mutex_group_manual_release";

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,12 @@ class EasyFullControl::FleetConfiguration
/// vehicles in this fleet when battery levels fall below the
/// recharge_threshold.
///
/// \param[in] retreat_to_charger_interval
/// Specify whether to allow automatic retreat to charger if the robot's
/// battery is estimated to fall below its recharge_threshold before it is
/// able to complete its current task. Provide a duration between checks in
/// seconds. If nullopt, retreat to charger would be disabled.
///
/// \param[in] task_categories
/// Provide callbacks for considering tasks belonging to each category.
///
Expand Down Expand Up @@ -706,6 +712,14 @@ class EasyFullControl::FleetConfiguration
/// Set whether or not to account for battery drain during task planning.
void set_account_for_battery_drain(bool value);

/// Get the duration between retreat to charger checks.
std::optional<rmf_traffic::Duration> retreat_to_charger_interval() const;

/// Set the duration between retreat to charger checks. Passing in a nullopt
/// will turn off these checks entirely.
void set_retreat_to_charger_interval(
std::optional<rmf_traffic::Duration> value);

/// Get the task categories
const std::unordered_map<std::string, ConsiderRequest>&
task_consideration() const;
Expand Down Expand Up @@ -807,6 +821,17 @@ class EasyFullControl::FleetConfiguration
const std::unordered_map<std::string, std::string>&
lift_emergency_levels() const;

/// A set of lanes which must strictly be navigated from from the start to end
/// of the lane when used. This means when replanning, the planner cannot ask
/// a robot in the middle of one of these lanes to immediately go to the end
/// of the lane.
const std::unordered_set<std::size_t>& strict_lanes() const;

/// Get a mutable reference to the set of strict lanes.
///
/// \sa strict_lanes
std::unordered_set<std::size_t>& change_strict_lanes();

class Implementation;
private:
rmf_utils::impl_ptr<Implementation> _pimpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,19 @@ class FleetUpdateHandle : public std::enable_shared_from_this<FleetUpdateHandle>
FleetUpdateHandle& set_update_listener(
std::function<void(const nlohmann::json&)> listener);

/// Get the duration between retreat to charger checks.
std::optional<rmf_traffic::Duration> retreat_to_charger_interval() const;

/// Specify whether to allow automatic retreat to charger if the robot's
/// battery is estimated to fall below its recharge_threshold before it is
/// able to complete its current task. Provide a duration between checks in
/// seconds. If nullopt, retreat to charger would be disabled.
FleetUpdateHandle& set_retreat_to_charger_interval(
std::optional<rmf_traffic::Duration> duration);

/// Trigger a replan for task allocation for robots in this fleet.
void reassign_dispatched_tasks();

/// Get the rclcpp::Node that this fleet update handle will be using for
/// communication.
std::shared_ptr<rclcpp::Node> node();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,26 @@ class RobotUpdateHandle
/// could change in the future.
void reassign_dispatched_tasks();

/// Information about where the lift will be asked to go for a robot.
class LiftDestination
{
public:
/// Name of the lift that is being used.
const std::string& lift() const;

/// Name of the level that the lift will be going to.
const std::string& level() const;

class Implementation;
private:
LiftDestination();
rmf_utils::impl_ptr<Implementation> _pimpl;
};

/// If this robot has begun a lift session, this will contain information
/// about where the robot will ask to go, and which lift it intends to use.
std::optional<LiftDestination> lift_destination() const;

class Implementation;

/// This API is experimental and will not be supported in the future. Users
Expand Down Expand Up @@ -542,6 +562,25 @@ class RobotUpdateHandle
/// Turn on/off a debug dump of how position updates are being processed
void debug_positions(bool on);

/// Cancel a task but keep the task state displayed as completed, if it has
/// been assigned to this robot
///
/// \param[in] task_id
/// The ID of the task to be canceled
///
/// \param[in] labels
/// Labels that will be assigned to this cancellation. It is recommended to
/// include information about why the cancellation is happening.
///
/// \param[in] on_cancellation
/// Callback that will be triggered after the cancellation is issued.
/// task_was_found will be true if the task was successfully found and
/// issued the cancellation, false otherwise.
void quiet_cancel_task(
std::string task_id,
std::vector<std::string> labels,
std::function<void(bool task_was_found)> on_cancellation);

private:
friend Implementation;
Implementation* _pimpl;
Expand Down
2 changes: 1 addition & 1 deletion rmf_fleet_adapter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rmf_fleet_adapter</name>
<version>2.6.0</version>
<version>2.8.0</version>
<description>Fleet Adapter package for RMF fleets.</description>
<maintainer email="[email protected]">Grey</maintainer>
<maintainer email="[email protected]">Aaron</maintainer>
Expand Down
12 changes: 12 additions & 0 deletions rmf_fleet_adapter/schemas/priority_description__binary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_ros2/main/rmf_fleet_adapter/schemas/priority_description__binary.json",
"title": "Binary Priority Description",
"description": "Describes the priority of a task as a binary",
"type": "object",
"properties": {
"type": { "type": "string" },
"value": { "type": "integer", "minimum": 0, "maximum": 1 }
},
"required": ["type", "value"]
}
Loading

0 comments on commit 72cd379

Please sign in to comment.