ros2genmsg not recognizing folder?

I have the current folder structure here
where msg containts all the .msg files (as seen in px4_msgs github). I'm trying to add the PX4 messages to my matlab to incorporate it into a SitL loop for a quadrotor, but I'm receiving the following error:
But the msg folder clearly contains all the correct .msg files, so I'm not sure why this is having this error. Is there another step I need to add here?

3 Comments

@Patrick could you share the whole folder structure, like directories above msg etc
I would double check that the msg directory contains *.msg files
@Walter Roberson this is the same directory as the github repo mentioned by patrick

Sign in to comment.

Answers (1)

TED MOSBY
TED MOSBY on 24 Jun 2025
Hi,
You can try the following workarounds:
  1. Double check your path actually contains .msg files and the folder containing those files should be named "msg" only so you can check for any whitespaces, etc.
  2. You can try putting the actual folder path in the "ros2genmsg" command.
  3. You can try going level 1 or 2 up in the folderpath, so instead of "...work/ros2_ws/src/px4_msgs" you can try "...work/ros2_ws/src" or "...work/ros2_ws/src/ros2_ws"
  4. If the above doesn't work then you can try a known bug fix as below, although the error message suggests something else but with the limited information provided, these are the only ways to debug the issue.
Here is also a list of other MATLAB answers that you can refer if your issue persists futher: https://www.mathworks.com/support/search.html?c%5B%5D=support&q=ros2genmsg&page=1
Hope this helps! Feel free to reply to this answer for further queries.

Categories

Products

Release

R2024b

Tags

Asked:

on 18 Jun 2025

Answered:

on 24 Jun 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!