I came across a memory problem when I declare a variable:
std::pair<int, int> best_cost[n][m][DIR]; In this case, n and m are both const int 1066 and DIR is 8. By running Valgrind I get an error:
Invalid write of size 8 ==73213== at 0x15D3B75E: simple_planner::SimplePlanner::aStar(geometry_msgs::PoseStamped_<std::allocator<void> > const&, geometry_msgs::PoseStamped_<std::allocator<void> > const&, std::vector<geometry_msgs::PoseStamped_<std::allocator<void> >, std::allocator<geometry_msgs::PoseStamped_<std::allocator<void> > > >&) (in /home/yyu/devel/lib/libsimple_planner.so) ==73213== Address 0xfe0f340 is on thread 8's stack Am I declaring the variable wrong?
My end use of this variable is to get the direction on a specific coordinate.