When I compile it , the compiler complains that it does not know Plan or PlanItem.
When I manually change this to plansys2_msgs::msg::PlanItem and plansys2_msgs::msg::Plan than it complains later the functions push_back and empty which cannot be used with these types.
First complaint (no alterations code):
-- stderr: plansys2_tfd_plan_solver
In file included from /home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:24:
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/include/plansys2_tfd_plan_solver/tfd_plan_solver.hpp:34:17: error: ‘Plan’ was not declared in this scope; did you mean ‘plansys2_msgs::msg::Plan’?
34 | std::optional<Plan> getPlan(
| ^~~~
| plansys2_msgs::msg::Plan
In file included from /home/edward/plansys2_ws/install/plansys2_msgs/include/plansys2_msgs/msg/plan.hpp:7,
from /home/edward/plansys2_ws/install/plansys2_core/include/plansys2_core/PlanSolverBase.hpp:22,
from /home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/include/plansys2_tfd_plan_solver/tfd_plan_solver.hpp:22,
from /home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:24:
/home/edward/plansys2_ws/install/plansys2_msgs/include/plansys2_msgs/msg/detail/plan__struct.hpp:117:7: note: ‘plansys2_msgs::msg::Plan’ declared here
117 | using Plan =
| ^~~~
In file included from /home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:24:
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/include/plansys2_tfd_plan_solver/tfd_plan_solver.hpp:34:21: error: template argument 1 is invalid
34 | std::optional<Plan> getPlan(
| ^
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/include/plansys2_tfd_plan_solver/tfd_plan_solver.hpp:34:23: error: conflicting return type specified for ‘virtual int plansys2::TFDPlanSolver::getPlan(const string&, const string&, const string&)’
34 | std::optional<Plan> getPlan(
Second complaint after altering code:
--- stderr: plansys2_tfd_plan_solver
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp: In member function ‘virtual std::optional<plansys2_msgs::msg::Plan_<std::allocator<void> > > plansys2::TFDPlanSolver::getPlan(const string&, const string&, const string&)’:
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:116:11: error: ‘using Plan = struct plansys2_msgs::msg::Plan_<std::allocator<void> >’ {aka ‘struct plansys2_msgs::msg::Plan_<std::allocator<void> >’} has no member named ‘push_back’
116 | ret.push_back(item);
| ^~~~~~~~~
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:125:11: error: ‘using Plan = struct plansys2_msgs::msg::Plan_<std::allocator<void> >’ {aka ‘struct plansys2_msgs::msg::Plan_<std::allocator<void> >’} has no member named ‘empty’
125 | if (ret.empty()) {
| ^~~~~
/home/edward/plansys2_ws/src/plansys2_tfd_plan_solver/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp:130:1: warning: control reaches end of non-void function [-Wreturn-type]
130 | }
| ^
make[2]: *** [CMakeFiles/plansys2_tfd_plan_solver.dir/build.make:63: CMakeFiles/plansys2_tfd_plan_solver.dir/src/plansys2_tfd_plan_solver/tfd_plan_solver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:164: CMakeFiles/plansys2_tfd_plan_solver.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
When I compile it , the compiler complains that it does not know Plan or PlanItem.
When I manually change this to plansys2_msgs::msg::PlanItem and plansys2_msgs::msg::Plan than it complains later the functions push_back and empty which cannot be used with these types.
First complaint (no alterations code):
Second complaint after altering code: