Problems in Chapter 3

I have followed the instructions given in Chapter 3 to create my custom controller.
My files are the following:

my_controller.yaml

my_controller.launch

controller_plugins.xml

package.xml

CMakeLists.txt

my_controller.cpp

I’m having an issue with the rospack plugins command

Also loading the controllers (all of them - not just the custom one) fails.

Any help is appreciated. Thank you.

Hello Nikos,

I’ve created a package for testing and it seems to be working OK for me. I’ve sent this package to your e-mail so that you can review it yourself and look for any differences with your own code (I couldn’t see any obvious one with a first look).

Best,

1 Like

Thank you for your response.
I tried to run the package you sent me in the online environment. However I’m getting some errors.

Specifically, I was having a problem with the constant static variable in the controller class.

As instructed by the error messages, I changed the const keyword with constexpr.
In this way, the package was successfully built and linked.

However, after launching the launch file, the controllers failed to load again.

Some questions to figure out whether I’m doing something wrong:

  • Did you test the package in your local environment or online?
  • Could the problem be related with the Noetic migration?

Also, I want to note that this time the rospack plugins command run successfully and the custom my_controller is one of the plugins listed.

Thank you again

Hello @NikosSoulounias ,

  • I tested the package in the online Academy, just the same environment where you are working at.

  • The compilation error you showed is related to the Noetic migration. However, once compiled, it should launch the controllers properly also in Noetic.

Could you maybe try deleting your build and devel folders and compiling everything again. Maybe you have some executable files there which are messing things up.

Best,

1 Like

I managed to solve the problem. I had deleted the build and devel folder before without a result (I retried it in case I missed something). What worked for me was deleting the folders and also changing to Unit0 afterwards.

I found what was wrong with my package btw. I’m writing it here in case someone has the same problem in the future.

In the package.xml file instead of:
<controller_interface plugin="${prefix}/controller_plugins.xml"/>
I had
<controller_interface plugin="$(prefix)/controller_plugins.xml"/>

After changing that, I also tried my package and it’s working now (I had to delete devel and build and change the unit again).

Thank you for your help.

1 Like

I see! That’s great news! Pretty hard to spot this one though.

Just for everybody to notice clearly, the difference is in the ${prefix} declaration. Curly brackets “{}” need to be used instead of the classic parenthesis “()”.

2 Likes