Chapter4 Exercise4.3

Excercise for creating a Msg inside Example 4.3 does not work. ROS Project does not support msg folder Age inside exercise_33. Enclosing screenshot, did everything, but issue is not fixed.
If someone can help to debug or resolve it will be greatly appreciated.

enclosing errror code image:

1 Like

Hi @Pankaj82 ,

Welcome to this Community!

Did you follow the exact same steps as described in the section that teaches how to make a custom message?
You need to add certain lines as dependencies in the CMakeLists.txt and package.xml.
Then you need to compile the package that has the custom message before you can use the custom message in your program.

Writing out all the steps here will be a duplicate of the same process. I suggest that you refer back to the course and follow/repeat the process to make a custom message. That should fix your issue.

Regards,
Girish

Yes, I followed exact steps! if you want I can share files!

can you share the CMakeLists.txt and package.xml code

I have this same issue that the ‘exercise_33’ module is not found, with the same error. Tried loads of things, none of which worked unfortunately:

  • Adding it to the path and changing working directory using different libraries (os, sys, and path)
  • Renaming the launch file (in the course it mentioned there was a bug of some kind with same names for other files where publish_age.py and publish_age.launch were the same)
  • Running from other folders other than catkin_ws
  • Using rosrun and roslaunch
  • Changing some of the code in the CMakeLists.txt and package.xml (images below show code copied from solution provided by The Construct)
  • Deleted, recreated, and compiled a new package from scratch, then pasted in the solutions, following the exact process

When pressing the ‘tab’ shortcut on the keyboard to fill the terminal line for roslaunch and rosrun it does pick up exercise_33.

CMakeLists should be below:
CMakeLists

Package code:
package

I’ve managed to find a workaround, and included all of the changes I’d implemented below which are different than the course sections:

Creating the initial package (in ~/catkin_ws/src): Need to include “rospy”, “std_msgs”, and “message_generation” for dependencies.
catkin_create_pkg <package_name> rospy std_msgs message_generation

CMakeLists.txt
INCLUDE rospy in find_package of CMakeLists.txt as below
find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
message_generation
)

package.xml
EXCLUDE this line (commented out in my version)
<build_export_depend>message_runtime</build_export_depend>

Once all is updated use these commands to delete and reset the /build and /devel folders using:
cd ~/catkin_ws
rm -rf build/ devel/
catkin_make
source devel/setup.bash

When in ~/catkin_ws directory:
roslaunch exercise_33 publish_age.launch

This starts the topic, then need to ‘echo’ the topic value in another terminal.

Other sources:
https://get-help.robotigniteacademy.com/t/no-module-named-actions-quiz-ros-basics-python/25205/8

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.