Hi Ziga,
Quite an interesting monologue!
I can’t help much with the C++ part, but there’s something missing in your code, which seems to be causing your head to spin()
:
You need to include
ros::spin()in your classinitmethod, where your subscriber and publisher are initialized.
ros::spin() ensures that your subscriber messages arrive. It seems your messages were not arriving; with spin() included, you shouldn’t need to publish to the laser_scan message manually, neither do you need spinOnce().
ros::spin() and rospy.spin() are different, and here lies the difference. See this post for details: