Topics_quiz how to initialize range data c++

Working on final quiz for Lecture 3 in ROS basics in 5 Days (C++), and I am having an issue with the ranges data. I don’t have errors at compilation, but I am getting a runtime error that I think is coming from my initialization of range_data.

Also, if there is a better way of working with the msg data, I would like to know.

I have edited my code and followed from How to read the laserscan,store and display it simultaneously (Topics_quiz)

I would like advice with trying to do this using objects still.

1 Like

Hi @rmmilner,

You must love C++ (and maybe other) classes, don’t you :wink:.

My advice is that if you are not very familiar with C++ don’t try to force it now.

Doing it the procedural way is fine and if you master this very well (and increase your knowledge of C++) you will be able to transition your code into your beloved C++ classes :slight_smile:

Keep pushing your ROS learning!

Yes, new to C++. Thanks for advice

1 Like