Rosbasicsin5days Exercise 2.3 query

Hi RobotIgnite Community Support,

Sorry is me again, asking some stupid questions but really scratching my head again,

I ran the roslaunch exercise_231 publish_age.launch command and followed the instructions to solution provided for exercise 2.3 (created the msg folder with age.msg inside, created launch and py file with the copy and paste codes) , except my package is called exercise_231 instead which I shouldnt think it would make a difference, I also made this change of exercise_231 for the launch and .py file) , but the errors below still shows up , I’m not sure why exercise_231.msg is not a module…

Traceback (most recent call last):
File “/home/user/catkin_ws/src/exercise_231/src/”, line 4, in
from exercise_231.msg import Age #Import Age message from the exercise_23 package
ImportError: No module named exercise_231.msg
[publish_age_node-1] process has died [pid 26925, exit code 1, cmd /home/user/catkin_ws/src/exercise_231/src/ __name:=publish_age_node __log:=/home/user/.ros/log/876a909a-8855-11ea-89c6-02914e9abbec/publish_age_node-1.log].
log file: /home/user/.ros/log/876a909a-8855-11ea-89c6-02914e9abbec/publish_age_node-1*.log

I look forward to your reply and thank you for your help,

Kind Regards,

Hi @wai.mak,
The name of a package is defined in the package.xml and CMakeLists.txt, NOT the folder name. Check whether that is correct. Secondly, make sure that you have all the required message-building packages included in those two files. Oh and as always, make sure your workspace is built and sourced, and the files is executable!

Hi @simon.steinmann91,

Thanks alot for your quick reply, I finally got it working…, you are right, I haven’t defined the package.xml and CMakeLists.txt properly ( I realise that I forgot to put the package name in there…) And also I haven’t got my second workspace sourced, that was another issue as I didnt know that running the command rostopic echo /age_info requires the workspace to be sourced as well but now I know, it’s awesome!

Thank you for your help,
Kind Regards,

1 Like