# Chapter4 Exercise4.3

**URL:** <https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316>\
**Category:** ROS Basics In 5 Days (Python)\
**Tags:** error\
**Created:** [July 9, 2023, 4:00am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316 "2023-07-09T04:00:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pankaj82](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@Pankaj82](https://get-help.theconstruct.ai/u/Pankaj82)\
**Post date:** [July 9, 2023, 4:00am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/1 "2023-07-09T04:00:14Z")

</div>

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.

 ![image](https://get-help.robotigniteacademy.com/uploads/default/original/2X/c/ce4a681b21215352a8c5a571a867c12fb1c51ff4.png)

---

<div class="post-metadata">

**Author:** ![Pankaj82](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@Pankaj82](https://get-help.theconstruct.ai/u/Pankaj82)\
**Post date:** [July 9, 2023, 4:01am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/2 "2023-07-09T04:01:20Z")

</div>

enclosing errror code image:

 ![image](https://get-help.robotigniteacademy.com/uploads/default/original/2X/5/5a599c0aaacdfbdbf938cec62a58ecb644e2fd47.png)

---

<div class="post-metadata">

**Author:** ![girishkumar.kannan](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/girishkumar.kannan/32/6994_2.png) [@girishkumar.kannan](https://get-help.theconstruct.ai/u/girishkumar.kannan)\
**Post date:** [July 9, 2023, 9:37am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/3 "2023-07-09T09:37:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pankaj82](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@Pankaj82](https://get-help.theconstruct.ai/u/Pankaj82)\
**Post date:** [July 9, 2023, 7:38pm UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/4 "2023-07-09T19:38:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AshishVarma](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/ashishvarma/32/7119_2.png) [@AshishVarma](https://get-help.theconstruct.ai/u/AshishVarma)\
**Post date:** [July 9, 2023, 8:26pm UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/5 "2023-07-09T20:26:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lewis01](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/l/76d3ee/32.png) [@Lewis01](https://get-help.theconstruct.ai/u/Lewis01)\
**Post date:** [July 13, 2023, 9:41am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/6 "2023-07-13T09:41:27Z")

</div>

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](https://get-help.robotigniteacademy.com/uploads/default/original/2X/5/586e7a621d10749a761357dc5b5640021743a1e7.jpeg)

---

<div class="post-metadata">

**Author:** ![Lewis01](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/l/76d3ee/32.png) [@Lewis01](https://get-help.theconstruct.ai/u/Lewis01)\
**Post date:** [July 13, 2023, 9:44am UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/7 "2023-07-13T09:44:39Z")

</div>

Package code:  
 ![package](https://get-help.robotigniteacademy.com/uploads/default/original/2X/1/1dada7c5a0b470a41ebce5d357abc474b51225f8.png)

---

<div class="post-metadata">

**Author:** ![Lewis01](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/l/76d3ee/32.png) [@Lewis01](https://get-help.theconstruct.ai/u/Lewis01)\
**Post date:** [July 13, 2023, 12:30pm UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/8 "2023-07-13T12:30:56Z")

</div>

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](https://get-help.robotigniteacademy.com/t/no-module-named-actions-quiz-ros-basics-python/25205/8)

> [@Keep having issues with custom message](https://get-help.robotigniteacademy.com/t/keep-having-issues-with-custom-message/24869/2):
>
> Perhaps this is your scenario. Did you run source devel/setup.bash on the same terminal where you are attempting to run your package? After (re)compiling your package, you need to source devel/setup.bash on each terminal, otherwise they will not know about your changes. Additionally, since it appears that you modified your package a number of times, you might need to remove build and devel folder every time you are recompiling (after every change): cd ~/catkin\_ws rm -rf build/ devel/ catkin\_m…

[![](https://get-help.robotigniteacademy.com/uploads/default/original/2X/b/bbd903bfa221aebac30abc7a28c8a6b3934b1d47.jpeg "How to Create and Publish a Custom Message in ROS | ROS Tutorial for Beginners |") ](https://www.youtube.com/watch?v=baAE0i8Rzvg)

---

<div class="post-metadata">

**Author:** ![system](https://get-help.theconstruct.ai/uploads/default/original/2X/9/9d3ce8305cc0d0d9b6e07d15767a6f245c526f1b.jpeg) [@system](https://get-help.theconstruct.ai/u/system)\
**Post date:** [July 23, 2023, 12:31pm UTC](https://get-help.theconstruct.ai/t/chapter4-exercise4-3/25316/9 "2023-07-23T12:31:41Z")

</div>

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