hichamhendy / mav_swarm_commander

Drone Swarm
0 stars 0 forks source link

Solution vector is empty #1

Closed hichamhendy closed 1 year ago

hichamhendy commented 1 year ago

The solution vector has no solution inside even though the solver succeeds. CppAD::ipopt::solve<Dvector, FG_eval>(options, vars, vars_lowerbound, vars_upperbound, constraints_lowerbound, constraints_upperbound, fg_eval, solution);

bradbell commented 1 year ago

I was expecting there to be a command I execute to reproduce the bug (after cloning this repository)

hichamhendy commented 1 year ago

I am sorry, such a command is hard to implement. This is a micro aerial vehicle swarm module and usually one needs to send a goal over GUI, and subsequently path planning will be called then the trajectory tracking using CppAD and Ipopt. There's also another modules dependencies which hasn't yet a repo. I kind of figured out that there is a memory leak, but I can't locate the problem. I am ready to share with you all error message if you wish. But as I said it seems that solving itself isn't working properly.

bradbell commented 1 year ago

It would be much better if I could reproduce the error message instead of my guessing at the cause. Perhaps you need to use the CPPAD_DEBUG_AND_RELEASE flag see https://cppad.readthedocs.io/en/latest/preprocessor.html#cppad-debug-and-release

hichamhendy commented 1 year ago

yes sir. I got this Begin test group swarm/Node memory_leak Error 1 tests failed. [ INFO] [1678434301.953998247, 44.164000000]: [Swarm Commanding]: Summary (mem): 0 [ INFO] [1678434301.954011563, 44.164000000]: [Swarm Commanding]: Solution found!!! [ INFO] [1678434301.954023362, 44.164000000]: [Swarm Commanding]: Cost: 0 { } cppad-20180000.0 error from a known source: vector: index greater than or equal vector size Error detected by false result for i < length_ at line 473 in the file /usr/include/cppad/utility/vector.hpp mav_swarm_commander_node: /usr/include/cppad/utility/error_handler.hpp:206: static void CppAD::ErrorHandler::Default(bool, int, const char*, const char*, const char*): Assertionfalse' failed. Stack trace (most recent call last) in thread 18739:

31 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f899f1b3e91, in ros::SubscriptionQueue::call()

30 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e15524e, in ros::SubscriptionCallbackHelperT<boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&)

29 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e15bcd2, in boost::function1<void, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> >::operator()(boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const>) const

28 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e147ff1, in boost::detail::function::void_function_obj_invoker1<boost::function<void (boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&)>, void, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const>)

27 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e14b8a7, in boost::function1<void, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>::operator()(boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&) const

26 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e138f79, in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>, boost::_bi::list2<boost::_bi::value<actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> > >, void, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&)

25 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e13fbfc, in void boost::_bi::bind_t<void, boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>, boost::_bi::list2<boost::_bi::value<actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> > >::operator()<boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>(boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&)

24 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e144121, in void boost::_bi::list2<boost::_bi::value<actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>, boost::_bi::rrlist1<boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&> >(boost::_bi::type, boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>&, boost::_bi::rrlist1<boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>&, int)

23 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e147d51, in void boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>::operator()<actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >>(actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >&, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&) const

22 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e14b526, in void boost::_mfi::mf1<void, actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&>::call<actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const>(actionlib::ActionServer<managermsgs::FlyToAction<std::allocator > >&, void const*, boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&) const

21 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0f5ce6, in actionlib::ActionServerBase<managermsgs::FlyToAction<std::allocator > >::goalCallback(boost::shared_ptr<managermsgs::FlyToActionGoal<std::allocator > const> const&)

20 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e105489, in boost::function1<void, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >::operator()(actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > >) const

19 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e104a78, in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >, boost::_bi::list2<boost::_bi::value<actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> > >, void, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >::invoke(boost::detail::function::function_buffer&, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > >)

18 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e1205f6, in void boost::_bi::bind_t<void, boost::_mfi::mf1<void, actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >, boost::_bi::list2<boost::_bi::value<actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> > >::operator()<actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >(actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > >&&)

17 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e13897d, in void boost::_bi::list2<boost::_bi::value<actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >, boost::_bi::rrlist1<actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > > >(boost::_bi::type, boost::_mfi::mf1<void, actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >&, boost::_bi::rrlist1<actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >&, int)

16 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e13f907, in boost::_mfi::mf1<void, actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > > >::operator()(actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >*, actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > >) const

15 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0d99c7, in actionlib::SimpleActionServer<managermsgs::FlyToAction<std::allocator > >::goalCallback(actionlib::ServerGoalHandle<managermsgs::FlyToAction<std::allocator > >)

14 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0c58c6, in boost::function0::operator()() const

13 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0f9652, in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, SwarmCommander>, boost::_bi::list1<boost::_bi::value<SwarmCommander*> > >, void>::invoke(boost::detail::function::function_buffer&)

12 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e107f55, in boost::_bi::bind_t<void, boost::_mfi::mf0<void, SwarmCommander>, boost::_bi::list1<boost::_bi::value<SwarmCommander*> > >::operator()()

11 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e1226fe, in void boost::_bi::list1<boost::_bi::value<SwarmCommander*> >::operator()<boost::_mfi::mf0<void, SwarmCommander>, boost::_bi::list0>(boost::_bi::type, boost::_mfi::mf0<void, SwarmCommander>&, boost::_bi::list0&, int)

10 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e13af8e, in boost::_mfi::mf0<void, SwarmCommander>::operator()(SwarmCommander*) const

9 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0a3e65, in SwarmCommander::goalCallback()

8 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0a543f, in SwarmCommander::globalPlanner()

7 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0a7d9c, in SwarmCommander::modelPredictivePlanning(Path const&)

6 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0d14f9, in CppAD::vector::operator[](unsigned long)

5 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0b828a, in CppAD::ErrorHandler::Call(bool, int, char const, char const, char const*)

4 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f899e0b8470, in CppAD::ErrorHandler::Default(bool, int, char const, char const, char const*)

3 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 101, in __assert_fail [0x7f899cfcb471]

2 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 92, in __assert_fail_base [0x7f899cfcb3f9]

1 Source "/build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c", line 79, in abort [0x7f899cfdb7f0]

0 Source "../sysdeps/unix/sysv/linux/raise.c", line 51, in raise [0x7f899cfd9e87]

Aborted (Signal sent by tkill() 18697 1000) Aborted (core dumped) `

hichamhendy commented 1 year ago

I tried that radically different over a subscriber instead action and got `#26 Object "", at 0xffffffffffffffff, in

25 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/mav_swarm_commander/mav_swarm_commander_node", at 0x55d876e9f4f9, in _start

24 Source "../csu/libc-start.c", line 310, in __libc_start_main [0x7f2672905c86]

23 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/mav_swarm_commander/mav_swarm_commander_node", at 0x55d876e9fdaf, in main

22 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f2674afc37a, in ros::spin()

21 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f2674b13a38, in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*)

20 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f2674abc2fa, in ros::CallbackQueue::callAvailable(ros::WallDuration)

19 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f2674aba558, in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*)

18 Object "/opt/ros/melodic/lib/libroscpp.so", at 0x7f2674b0fe91, in ros::SubscriptionQueue::call()

17 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673aad424, in ros::SubscriptionCallbackHelperT<boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&)

16 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673ab4380, in boost::function1<void, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> >::operator()(boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const>) const

15 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a91423, in boost::detail::function::void_function_obj_invoker1<boost::function<void (boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&)>, void, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const>)

14 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a97ff9, in boost::function1<void, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>::operator()(boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&) const

13 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a5dab9, in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, SwarmCommander, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>, boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::arg<1> > >, void, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&)

12 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a785d4, in void boost::_bi::bind_t<void, boost::_mfi::mf1<void, SwarmCommander, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>, boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::arg<1> > >::operator()<boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>(boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&)

11 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a9116c, in void boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, SwarmCommander, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>, boost::_bi::rrlist1<boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&> >(boost::_bi::type, boost::_mfi::mf1<void, SwarmCommander, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>&, boost::_bi::rrlist1<boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>&, int)

10 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a97cd0, in boost::_mfi::mf1<void, SwarmCommander, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&>::operator()(SwarmCommander*, boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&) const

9 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f26739f8fb3, in SwarmCommander::dummyGoalCallback(boost::shared_ptr<geometrymsgs::PoseStamped<std::allocator > const> const&)

8 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f26739fa43a, in SwarmCommander::globalPlanner()

7 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f26739fcd61, in SwarmCommander::modelPredictivePlanning(Path const&)

6 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a266ff, in CppAD::vector::operator[](unsigned long)

5 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a0d250, in CppAD::ErrorHandler::Call(bool, int, char const, char const, char const*)

4 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7f2673a0d436, in CppAD::ErrorHandler::Default(bool, int, char const, char const, char const*)

3 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 101, in __assert_fail [0x7f2672914471]

2 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 92, in __assert_fail_base [0x7f26729143f9]

1 Source "/build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c", line 79, in abort [0x7f26729247f0]

0 Source "../sysdeps/unix/sysv/linux/raise.c", line 51, in raise [0x7f2672922e87]

Aborted (Signal sent by tkill() 11282 1000) Aborted (core dumped) `

What I can see that there is a problem to boost::shared_ptr. beutiI ain't sure. Could you guess where the problem here could be?

hichamhendy commented 1 year ago

My last try was by executing that in a thread boost::thread(&SwarmCommander::modelPredictivePlanning, this, current_path_).detach(); and I got Begin test group swarm/Node memory_leak Error 1 tests failed. [ INFO] [1678439911.824434053, 22.848000000]: [Swarm Commanding]: Summary (mem): 0 [ INFO] [1678439911.824450138, 22.848000000]: [Swarm Commanding]: Solution found!!! [ INFO] [1678439911.824463658, 22.848000000]: [Swarm Commanding]: Cost: 6.9339e-310 { } cppad-20180000.0 error from a known source: vector: index greater than or equal vector size Error detected by false result for i < length_ at line 473 in the file /usr/include/cppad/utility/vector.hpp mav_swarm_commander_node: /usr/include/cppad/utility/error_handler.hpp:206: static void CppAD::ErrorHandler::Default(bool, int, const char*, const char*, const char*): Assertionfalse' failed. Stack trace (most recent call last) in thread 24512:

15 Object "", at 0xffffffffffffffff, in

14 Source "../sysdeps/unix/sysv/linux/x86_64/clone.S", line 95, in __clone [0x7fa4a464861e]

13 Source "/build/glibc-CVJwZb/glibc-2.27/nptl/pthread_create.c", line 463, in start_thread [0x7fa4a61cd6da]

12 Object "/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1", at 0x7fa4a303ebcc, in

11 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a56e5917, in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<Path, SwarmCommander, Path const&>, boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::_bi::value > > >::run()

10 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a56ec529, in boost::_bi::bind_t<void, boost::_mfi::mf1<Path, SwarmCommander, Path const&>, boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::_bi::value > >::operator()()

9 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a56f259a, in void boost::_bi::list2<boost::_bi::value<SwarmCommander*>, boost::_bi::value >::operator()<boost::_mfi::mf1<Path, SwarmCommander, Path const&>, boost::_bi::list0>(boost::_bi::type, boost::_mfi::mf1<Path, SwarmCommander, Path const&>&, boost::_bi::list0&, int)

8 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a56f8f42, in boost::_mfi::mf1<Path, SwarmCommander, Path const&>::operator()(SwarmCommander*, Path const&) const

7 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a563716a, in SwarmCommander::modelPredictivePlanning(Path const&)

6 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a5660b45, in CppAD::vector::operator[](unsigned long)

5 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a5647658, in CppAD::ErrorHandler::Call(bool, int, char const, char const, char const*)

4 Object "/home/rnd/catkin_ws/devel/.private/mav_swarm_commander/lib/libmav_swarm_commander.so", at 0x7fa4a564783e, in CppAD::ErrorHandler::Default(bool, int, char const, char const, char const*)

3 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 101, in __assert_fail [0x7fa4a4557471]

2 Source "/build/glibc-CVJwZb/glibc-2.27/assert/assert.c", line 92, in __assert_fail_base [0x7fa4a45573f9]

1 Source "/build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c", line 79, in abort [0x7fa4a45677f0]

0 Source "../sysdeps/unix/sysv/linux/raise.c", line 51, in raise [0x7fa4a4565e87]

Aborted (Signal sent by tkill() 24237 1000) Aborted (core dumped) `

bradbell commented 1 year ago

cppad-20180000.0 error from a known source: vector: index greater than or equal vector size Error detected by false result for i < length_ at line 473 in the file /usr/include/cppad/utility/vector.hpp

It looks like you are accessing a cppad vector with a invalid index value. You should run in the debugger so you can go back up the stack and find the source code that has the bad index.

hichamhendy commented 1 year ago

I used "backward_ros" to answer this question precisely and actually It's no problem for(i = 0; i < n_vars; i++) std::cout << solution.x[i];

Even a desperate try std::cout << solution.x[1]; got me an error. I expect to find the solution here! Am I wrong?

bradbell commented 1 year ago

Yes, the question is why is it not there.

If you look in the file https://github.com/coin-or/CppAD/blob/master/include/cppad/ipopt/solve_callback.hpp at the line solution.x.resize(nx); I suspect that this line is no being executed; i.e., finalize_solution is not being called by ipopt (which should only happen if ipopt fails). Since I cannot reproduce the problem, you will have to try an debug it on your machine; i.e., figure out why finalize_solution is not being called by Ipopt.

hichamhendy commented 1 year ago

The thing is I tried a simple code on a model of car (solution room is almost half of a quadrotor) on my machine and it worked fine and got solution!! The only difference was build system. The one that doesn't work is build using catkin and run on ROS and the who does work is built using Cmake. So the problem is somehow related to ROS! I will try to get deeper.

hichamhendy commented 1 year ago

By the way, finalize_solution gets called. The reason is simply that ipopt doesn't fail otherwise bool ok = true; ok &= solution.status == CppAD::ipopt::solve_result<Dvector>::success; if(CppAD::ipopt::solve_result<Dvector>::success) ROS_INFO_STREAM(kStreamPrefix <<"Solution found!!!");

would have given false.

bradbell commented 1 year ago

Then you should be able run a debug version and put a breakpoint just after solution_.x.resize(nx_); in solvecallback.hpp and to see why solution.x has size zero ?

hichamhendy commented 1 year ago

I found the problem https://github.com/hichamhendy/mav_swarm_commander/blob/develop/src/SwarmCommander.cpp#L449

Everything was alright I just made a stupid mistake by switching upper and lower limits

Thank your Prof. Brad. It was an honor.

bradbell commented 1 year ago

Please add comments to https://github.com/coin-or/CppAD/issues/170 explaining what happened and close that issue.

hichamhendy commented 1 year ago

Sure. I intend to do that.