Segmentation fault (core dumped)
Hello dears, i would like to simply scan front but i got this error "Segmentation fault (core dumped)" do you know what is the reason or how to fix this? thank you.
double FrontRange(sensor_msgs::LaserScan & LaserScanMsg) {
return LaserScanMsg.ranges[LaserScanMsg.ranges.size()/2]; }
You should print the size of the range before the return to check if the message isn't empty. Maybe you are calling your function too early so the first message hasn't been received yet, so you are sending an empty message (leading to the segfault issue).
Moreover, are you sure the issue comes from this function in particular ?