This is how my class looks. My code compiles successfully but when I run it, it crashes and stops.
class Explore{
public:
Explore(ros::NodeHandle &nh, tf2_ros::Buffer &buffer);
private:
bool is_frontier(size_t mx, size_t my);
void explore_level_three();
void go_to_cell(size_t mx, size_t my);
void publish_markers_array();
void publish_markers();
costmap_2d::Costmap2DROS* global_costmap, *local_costmap;
costmap_2d::Costmap2D* global_costmap_, *local_costmap_;
ros::NodeHandle nh_;
ros::Publisher frontier_array_pub, frontier_pub;
vector<pair<size_t, size_t> >frontiers;
string global_frame, robot_base_frame;
unsigned char *global_og;
size_t size_x, size_y;
double init_wx, init_wy;
int vis[4001][4001], frontier_vis[4001][4001] ;
};
When I change vis[4001][4001], frontier_vis[4001][4001];
to vis[500][500], frontier_vis[500][500];
the code runs successfully.
This is my main
function -
int main(int argc, char** argv) {
ros::init(argc, argv, "explore_node");
ros::NodeHandle nh("explore_node");
tf2_ros::Buffer buffer(ros::Duration(10));
tf2_ros::TransformListener tf(buffer);
Explore explore_one(nh, buffer);
return 0;
}
How can I solve this issue?