From c4fb598a3aa195b5df45b566ecb6945dd07aad14 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 6 May 2021 14:05:37 +0800 Subject: [PATCH 01/66] Add address sanitizer. Signed-off-by: Arjo Chakravarty --- .github/workflows/asan.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/asan.yaml diff --git a/.github/workflows/asan.yaml b/.github/workflows/asan.yaml new file mode 100644 index 00000000..230213bf --- /dev/null +++ b/.github/workflows/asan.yaml @@ -0,0 +1,31 @@ +name: tsan +on: [push, pull_request] +jobs: + tsan: + name: asan + runs-on: ubuntu-20.04 + steps: + - name: deps + uses: ros-tooling/setup-ros@v0.1 + with: + required-ros-distributions: foxy + - name: build_and_test + uses: ros-tooling/action-ros-ci@v0.2 + env: + CC: clang + CXX: clang++ + with: + target-ros2-distro: foxy + # build all packages listed in the meta package + package-name: | + rmf_traffic + vcs-repo-file-url: | + https://raw.githubusercontent.com/open-rmf/rmf/main/rmf.repos + colcon-defaults: | + { + "build": { + "mixin": ["asan"], + "cmake-args": ["-DCMAKE_BUILD_TYPE=Debug"] + } + } + colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml From 84262e717e41370dcb2f46e43a8b34f1f82e4d0b Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Mon, 24 May 2021 09:07:03 +0800 Subject: [PATCH 02/66] back ported useful changes Signed-off-by: Arjo Chakravarty --- .../rmf_traffic/reservations/Reservation.hpp | 70 ++++++++ .../reservations/ReservationRequest.hpp | 77 +++++++++ .../rmf_traffic/reservations/Reservation.cpp | 159 ++++++++++++++++++ .../reservations/ReservationRequest.cpp | 125 ++++++++++++++ 4 files changed, 431 insertions(+) create mode 100644 rmf_traffic/include/rmf_traffic/reservations/Reservation.hpp create mode 100644 rmf_traffic/include/rmf_traffic/reservations/ReservationRequest.hpp create mode 100644 rmf_traffic/src/rmf_traffic/reservations/Reservation.cpp create mode 100644 rmf_traffic/src/rmf_traffic/reservations/ReservationRequest.cpp diff --git a/rmf_traffic/include/rmf_traffic/reservations/Reservation.hpp b/rmf_traffic/include/rmf_traffic/reservations/Reservation.hpp new file mode 100644 index 00000000..ed589154 --- /dev/null +++ b/rmf_traffic/include/rmf_traffic/reservations/Reservation.hpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2021 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. + * +*/ + +#ifndef RMF_TRAFFIC__RESERVATIONS_HPP +#define RMF_TRAFFIC__RESERVATIONS_HPP + +#include +#include +#include +#include + +namespace rmf_traffic { +namespace reservations { + +using ReservationId = uint64_t; +//============================================================================== +class Reservation +{ +public: + const rmf_traffic::Time start_time() const; + + const std::optional duration() const; + + const std::optional finish_time() const; + + void set_actual_finish_time(rmf_traffic::Time dur); + + Reservation propose_new_finish_time(rmf_traffic::Time dur); + + Reservation propose_new_start_time(rmf_traffic::Time dur); + + bool is_indefinite() const; + + const std::optional actual_finish_time() const; + + const std::string resource_name() const; + + ReservationId reservation_id() const; + + bool operator==(const Reservation& other) const; + + static Reservation make_reservation( + rmf_traffic::Time start_time, + std::string resource_name, + schedule::ParticipantId pid, + std::optional duration, + std::optional finish_time); + + class Implementation; +private: + Reservation(); + rmf_utils::impl_ptr _pimpl; +}; +} // end namespace reservations +} // end namespace rmf_traffic +#endif \ No newline at end of file diff --git a/rmf_traffic/include/rmf_traffic/reservations/ReservationRequest.hpp b/rmf_traffic/include/rmf_traffic/reservations/ReservationRequest.hpp new file mode 100644 index 00000000..c175209b --- /dev/null +++ b/rmf_traffic/include/rmf_traffic/reservations/ReservationRequest.hpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2020 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. + * +*/ + +#ifndef RMF_TRAFFIC__RESERVATION_REQUEST_HPP +#define RMF_TRAFFIC__RESERVATION_REQUEST_HPP + +#include +#include +#include +#include + +namespace rmf_traffic { +namespace reservations { +class ReservationRequest +{ + +public: + class TimeRange + { + public: + const std::optional