diff --git a/include/cell_controller.h b/include/cell_controller.h index e1e65677b8d6b6e29fcb4690cd86ba04cef6458c..de53c91085fc807c9f4351e52291d534758cbb01 100644 --- a/include/cell_controller.h +++ b/include/cell_controller.h @@ -14,7 +14,7 @@ class CellController Cell cell_; std::shared_ptr<Action> current_action_; std::shared_ptr<Task> current_task_; - std::function<void(const Action&)> action_callback_; + std::function<void(const Action &)> action_callback_; public: CellController() @@ -22,7 +22,7 @@ public: cell_.state = Cell::DISCONNECTED; } - void setCellId(const std::string& id) + void setCellId(const std::string &id) { cell_.id = id; } @@ -32,7 +32,7 @@ public: action_callback_ = action_callback; } - const Cell& cell() const + const Cell &cell() const { return cell_; } @@ -42,36 +42,35 @@ public: return current_action_ == nullptr; } - const Action& getCurrentAction() const + const Action &getCurrentAction() const { return *current_action_; } - const std::shared_ptr<Task>& getCurrentTask() const + const std::shared_ptr<Task> &getCurrentTask() const { return current_task_; } void setCurrentTask(const std::shared_ptr<Task> &new_task) { - if (!currentActionCompleted()) { - ROS_WARN_STREAM("Cell " << cell_.id << " got a new task although an action of the previous task is still ongoing."); + if (!currentActionCompleted()) + { + ROS_WARN_STREAM( + "Cell " << cell_.id << " got a new task although an action of the previous task is still ongoing."); } current_task_.reset(new_task.get()); } void proceedWithTask() { - if (cell_.state == Cell::IDLE) + if (currentActionCompleted()) { - if (currentActionCompleted()) - { - auto action = triggerNextAction(); - } + auto action = triggerNextAction(); } } - void updateModel(const std::string& scene_string) + void updateModel(const std::string &scene_string) { ROS_INFO_STREAM("Getting a scene update for cell " << cell_.id); if (cell_.state == Cell::DISCONNECTED) @@ -84,7 +83,7 @@ public: } // TODO do we need this method? - void updateModel(const Scene& scene) + void updateModel(const Scene &scene) { ROS_INFO_STREAM("Getting a scene update for cell " << cell_.id); if (cell_.state == Cell::DISCONNECTED) @@ -122,7 +121,7 @@ public: std::optional<Action> triggerNextAction() { // TODO this assumes each action can be performed only once, which holds for pick-and-drop tasks but not in general - for (Action action : current_task_->getActions()) + for (Action action: current_task_->getActions()) { if (!action.isCompleted(cell_.scene) && action.canBePerformed(cell_.scene)) {