HKUST-Aerial-Robotics / Fast-Planner

A Robust and Efficient Trajectory Planner for Quadrotors
GNU General Public License v3.0
2.39k stars 663 forks source link

Migrating to ubuntu 20.04/noetic #85

Open jodusan opened 3 years ago

jodusan commented 3 years ago

I am trying to build master branch in Noetic, apart from installing ros-noetic-pcl* and changing std=c++11 flags to std=c++14 in all cmake files (PCL 1.10 requires it) everything works/compiles.

I can run both roslaunch plan_manage rviz.launch and roslaunch plan_manage kino_replan.launch

But when I issue navgoal it crashes without much information:

[fast_planner_node-1] process has died [pid 23197, exit code -11, cmd /home/user/catkin_ws/devel/lib/plan_manage/fast_planner_node /odom_world:=/state_ukf/odom /sdf_map/odom:=/state_ukf/odom /sdf_map/cloud:=/pcl_render_node/cloud /sdf_map/pose:=/pcl_render_node/camera_pose /sdf_map/depth:=/pcl_render_node/depth name:=fast_planner_node log:=/home/user/.ros/log/c518fd5c-3f9b-11eb-9def-dd79eedcd81f/fast_planner_node-1.log]. log file: /home/user/.ros/log/c518fd5c-3f9b-11eb-9def-dd79eedcd81f/fast_planner_node-1*.log

I have ran the second command with --log so I have output of fast_planner_node but it doesnt say much:

hit: 0.619039 miss: -0.619039 min log: -1.99243 max: 2.19722 thresh log: 1.38629 origin_: -20 -10 -1 map size: 40 20 5 [FSM]: from INIT to WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET [FSM]: state: WAIT_TARGET Triggered! [TRIG]: from WAIT_TARGET to GEN_NEW_TRAJ

start: -19 0 1.51788e-18, 0 0 0, 0 0 0 goal:-9.50174 -1.04982 1, 0 0 0 open set empty, no path! use node num: 1 iter num: 1 kino replan: kinodynamic search fail! reach horizon kino replan: retry search success.

Rviz minor issue: Simulation-robot marker is not showing it says: status:error for frame /world fixed frame [world] does not exist

Update: This line in planner_manager.cpp:200 seems to be the issue in debugger

ctrl_pts = bsplineoptimizers[0]->BsplineOptimizeTraj(ctrl_pts, ts, cost_function, 1, 1);

Segfault happens here

Down the rabbit hole- Update 2: bspline_optimizer.cpp:150 opt.set_min_objective(BsplineOptimizer::costFunction, this);

crashes in nlopt.hpp:347 mythrow(nlopt_set_min_objective(o, myvfunc, d)); // d freed via o

WANGSSSSSSS commented 3 years ago

i meet this error too, have you solve this problem yet?

yjhdhr commented 3 years ago

hello, the same problem ...

yjhdhr commented 3 years ago

i meet this error too, have you solve this problem yet?

HI, do you know how to fix it?

surfii3z commented 3 years ago

Same here, did anyone figure out the fix?

Junking1 commented 3 years ago

You can fix it with https://github.com/HKUST-Aerial-Robotics/Fast-Planner/pull/107 OR with https://github.com/Junking1/Fast-Planner-for-ubuntu20.04

jodusan commented 3 years ago

@Junking1 It doesnt work for me on 20.04. It builds successfully and when I give it 2d nav goal it crashes? Any ideas?

Junking1 commented 3 years ago

@Junking1 It doesnt work for me on 20.04. It builds successfully and when I give it 2d nav goal it crashes? Any ideas?

Is it the same mistake as before?In fact, I suggest you download code from https://github.com/Junking1/Fast-Planner-for-ubuntu20.04 and try again.

jodusan commented 3 years ago

@Junking1 I have cloned your repository and changed c++11 to c++14. There are no errors. Exactly on setting 2D nav goal fast_planner node crashes. You have no issues? It works as expected?

Junking1 commented 3 years ago

@dulex123 Yes, it works.Maybe you can output something in your nlopt library, making sure you're using the nlopt library you installed from the source code instead of the library from ros.

ddefuijk commented 3 years ago

@dulex123 I'm having the same problem. Did you find a solution for this?

jodusan commented 3 years ago

@ddefuijk nope. If you succeed please share the solution.

ddefuijk commented 3 years ago

@dulex123 It seems I made a typo while sourcing the workspace's setup.bash. I doubt that you have the same issue but you can check that.

iamrajee commented 2 years ago

@ddefuijk @dulex123 @WANGSSSSSSS @surfii3z @yjhdhr @Junking1 I'm facing the same issue of crashing with the message "open set empty, no path!". I'm on ubuntu 20 ros noetic. I've made all the other necessary modifications. Any lead on what might be causing the issue?

Update I realised that my code went into the below snippet and continued(L189) thereafter. That is why it's unable to reach to this line(L278), where new pro_node is pushed to openset.

// Check if in close set
        Eigen::Vector3i pro_id = posToIndex(pro_pos);
        int pro_t_id = timeToIndex(pro_t);
        PathNodePtr pro_node = dynamic ? expanded_nodes_.find(pro_id, pro_t_id) : expanded_nodes_.find(pro_id);
        if (pro_node != NULL && pro_node->node_state == IN_CLOSE_SET)
        {
          if (init_search)
            std::cout << "close" << std::endl;
          continue;
        }

Also, I have included return value to avoid the bad_alloc error in KinodynamicAstar::timeToIndex Function

int KinodynamicAstar::timeToIndex(double time)
{
  int idx = floor((time - time_origin_) * inv_time_resolution_);
  return idx; //new <==
}

Any suggestions on what can I do to avoid this error? Thanks!

DeveloperFuloo commented 2 years ago

crash in the same problem.. anyone fixed it?

iamrajee commented 2 years ago

crash in the same problem.. anyone fixed it?

Stuck with the same issue for a long time now. Eventually, I had to shift to the melodic. There it works without any issue!

eliabntt commented 2 years ago

A general suggestion, try the following:

sudo apt list | grep nlopt | grep installed

purge all packages that are being listed as output.

run rm build devel logs -rf

install nlopt from source as stated here

be sure to run sudo ldconfig and _clean the catkinws before compiling again

add the return statement in L654 of kinodinamic_astar.cpp

Change the bspline_opt cmakelists with this or use the following one:

cmake_minimum_required(VERSION 2.8.3)
project(bspline_opt)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall")

find_package(Eigen3 REQUIRED)
find_package(PCL 1.7 REQUIRED)
find_package(nlopt)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  visualization_msgs
  plan_env
  active_perception
  cv_bridge
)

catkin_package(
 INCLUDE_DIRS include
 LIBRARIES bspline_opt
 CATKIN_DEPENDS plan_env active_perception
#  DEPENDS system_lib
)

include_directories( 
    SYSTEM 
    include 
    ${catkin_INCLUDE_DIRS}
    ${Eigen3_INCLUDE_DIRS} 
    ${PCL_INCLUDE_DIRS}
    ${nlopt_INCLUDE_DIRS}
)

add_library( bspline_opt 
    src/bspline_optimizer.cpp 
    )
target_link_libraries( bspline_opt
    ${catkin_LIBRARIES} 
    nlopt
    )  

Either change the CMakeLists to use c++14 or run catkin_make -DCMAKE_CXX_STANDARD=14

Build and try to run. It should work.

It is important to REMOVE the ros nlopt and not use that in the bspline opt package.

iamrajee commented 2 years ago

@eliabntt Thank you for your solution but it doesn't work for me. Has anybody else got it working?

eliabntt commented 2 years ago

Hi, do you get an error? I did exactly what I stated and it started working. Be sure to completely clean the build files (catkin clean/ rm build devel logs -rf) after you removed the nlopt packages. Try also to remove the packages, reboot and install nlopt from source.

iamrajee commented 2 years ago

catkin_make -DCMAKE_CXX_STANDARD=14

I tried that, but no luck :( I get the same error:

[FSM]: state: WAIT_TARGET
Triggered!
[TRIG]: from WAIT_TARGET to GEN_NEW_TRAJ
[kino replan]: -----------------------
start: -19   0   0, 0 0 0, 0 0 0
goal:-14.1123  2.39684        1, 0 0 0
open set empty, no path!
use node num: 1
iter num: 1
[kino replan]: kinodynamic search fail!
reach end
[kino replan]: retry search success.
[ INFO] [1647850496.244883026]: cost func: smooth | dist  | feasi |

Thanks!

eliabntt commented 2 years ago

I don't see segfault here. The problem of this topic is the segfault :)

jodusan commented 2 years ago

It will build with gcc-7 and c++14

qycqycqyc commented 1 year ago

@eliabntt Thank you very much!