Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile #8

Open
edhage opened this issue Dec 10, 2021 · 7 comments
Open

Does not compile #8

edhage opened this issue Dec 10, 2021 · 7 comments

Comments

@edhage
Copy link

edhage commented Dec 10, 2021

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
@edhage
Copy link
Author

edhage commented Dec 10, 2021

I looked at the message-structure and came to this alteration:

ret.push_back(item); --> ret.items.push_back(item);
ret.empty() --> ret.items.empty()

than it fails on the unit-test. I disabled the unittest and now it compiles, don't know if it is working.

Has the Plan-msg been altered?
I am using ROS galactic

@edhage edhage closed this as completed Dec 10, 2021
@edhage
Copy link
Author

edhage commented Dec 10, 2021

closed the issue by mistake. Please SOLVE

@edhage edhage reopened this Dec 10, 2021
@fmrico
Copy link
Contributor

fmrico commented Dec 10, 2021

It shouldn't be changed. Give me a couple of days to check it.

@roveri-marco
Copy link
Contributor

I've prepared a patch. You can find it here.
compile_patch.txt
If I'm allowed I can create a merge request with the fix

@edhage
Copy link
Author

edhage commented Jan 13, 2022 via email

@fmrico
Copy link
Contributor

fmrico commented Jan 19, 2022

Hi @roveri-marco

I've prepared a patch. You can find it here. compile_patch.txt If I'm allowed I can create a merge request with the fix

Can you create a Pull Request to start working on it?

Thanks!!!

@roveri-marco
Copy link
Contributor

Hi @fmrico
I'll fork, create the fix there and I'll then create a push request. Although it would be much easier to work on this repo without having to fork!
Thanks,
Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants