Topics Mini Project LaserScan library confusion


I have a problem with the mini project. I can’t include “sensor_msgs/msg/laserscan.hpp” (no such file or directory). I also tried: sensor_msgs/msg/LaserScan.hpp, sensor_msgs/LaserScan.hpp and like in ros1 sensor_msgs/laserscan.h
The /kobuki/laser/scan topic doesn’t have a subscriber or publisher if I make ros2 topic info on it (the bridge is running).

best regards

Hi @t.alscher,

Did you add sensor_msgs as a dependency when creating your package? I suppose sensor_msgs/msg/laserscan.hpp should work.

Yes, it won’t have a publisher, and you need to create a subscriber for it.

sensor_msgs is included as a dependencie and as a required package

Sorry for the confusion. The right message name is sensor_msgs/msg/laser_scan.hpp.

This worked.
But can you tell me how I should have gotten this information, so that I know this for future projects :sweat_smile:

1 Like

Yes, I took a peek at the /opt/ros/dashing/include/sensor_msgs/ directory to check the name of the messages.

It also appears that, by convention, a message named CamelCase would be camel_case.hpp, but the “final word” would be the actual message name in that directory.

1 Like