Skip to content

Commit

Permalink
Merge branch 'main' into link_threads
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgrey authored May 4, 2022
2 parents 74b5a66 + 50f3211 commit 517e27b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 29 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,33 @@ jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
ros_distribution:
- galactic
- rolling
include:
# Galactic Geochelone (May 2021 - November 2022)
- docker_image: ubuntu:focal
ros_distribution: galactic
ros_version: 2
# Rolling Ridley (No End-Of-Life)
- docker_image: ubuntu:jammy
ros_distribution: rolling
ros_version: 2
container:
image: ubuntu:latest
image: ${{ matrix.docker_image }}
steps:
- name: pwd
run: pwd
- name: deps
uses: ros-tooling/setup-ros@v0.2
- name: setup ROS environment
uses: ros-tooling/setup-ros@v0.3
with:
required-ros-distributions: rolling
required-ros-distributions: ${{ matrix.ros_distribution }}
- name: build
uses: ros-tooling/action-ros-ci@v0.2
with:
target-ros2-distro: rolling
target-ros2-distro: ${{ matrix.ros_distribution }}
# build all packages listed in the meta package
package-name: |
rmf_traffic
Expand Down
2 changes: 1 addition & 1 deletion rmf_traffic/include/rmf_traffic/schedule/Participant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Participant
///
/// \param[in] itinerary
/// The new itinerary that the participant should reflect in the schedule.
void set(PlanId plan, std::vector<Route> itinerary);
bool set(PlanId plan, std::vector<Route> itinerary);

/// Add more routes for the participant. All of the routes currently in the
/// itinerary will still be in it.
Expand Down
26 changes: 7 additions & 19 deletions rmf_traffic/src/rmf_traffic/schedule/Participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,24 @@ Participant::Implementation::Shared::Shared(
}

//==============================================================================
void Participant::Implementation::Shared::set(
bool Participant::Implementation::Shared::set(
PlanId plan, std::vector<Route> itinerary)
{
if (rmf_utils::modular(plan).less_than_or_equal(_current_plan_id))
{
// *INDENT-OFF*
throw std::runtime_error(
"[Participant::set] The given plan ID [" + std::to_string(plan)
+ "] needs to be greater than the current ["
+ std::to_string(_current_plan_id) + "]");
// *INDENT-ON*
}
return false;

for (std::size_t i = 0; i < itinerary.size(); ++i)
{
const auto& r = itinerary[i];
if (r.trajectory().size() < 2)
{
// *INDENT-OFF*
throw std::runtime_error(
"[Participant::set] Route [" + std::to_string(i) + "] has a trajectory "
"of size [" + std::to_string(r.trajectory().size()) + "], but the "
"minimum acceptable size is 2.");
// *INDENT-ON*
}
return false;
}

if (itinerary.empty())
{
// This situation is more efficient to express as a clear() command
clear();
return;
return true;
}

_change_history.clear();
Expand Down Expand Up @@ -118,6 +104,8 @@ void Participant::Implementation::Shared::set(
_writer->reached(
_id, plan, _progress.reached_checkpoints, _progress.version);
}

return true;
}

//==============================================================================
Expand Down Expand Up @@ -401,7 +389,7 @@ ItineraryVersion Participant::Implementation::Shared::get_next_version()
}

//==============================================================================
void Participant::set(PlanId plan, std::vector<Route> itinerary)
bool Participant::set(PlanId plan, std::vector<Route> itinerary)
{
return _pimpl->_shared->set(plan, std::move(itinerary));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Participant::Implementation
ParticipantDescription description,
std::shared_ptr<Writer> writer);

void set(PlanId plan, std::vector<Route> itinerary);
bool set(PlanId plan, std::vector<Route> itinerary);

void extend(std::vector<Route> additional_routes);

Expand Down
9 changes: 6 additions & 3 deletions rmf_traffic/test/unit/agv/test_Rollout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ class MockValidator : public rmf_traffic::agv::RouteValidator
nullptr))
{
return Conflict{
_other_participant, 0, 0,
route.trajectory().index_after(conflict->time),
conflict->time
rmf_traffic::Dependency{
_other_participant, 0, 0,
route.trajectory().index_after(conflict->time),
},
conflict->time,
std::make_shared<rmf_traffic::Route>(route)
};
}
}
Expand Down

0 comments on commit 517e27b

Please sign in to comment.