jrl-umi3218 / mc_rtc

mc_rtc is an interface for simulated and real robotic systems suitable for real-time control
BSD 2-Clause "Simplified" License
122 stars 37 forks source link

[Plugin] Plugin uses ROS cannot be loaded via 'mc_rtc_ticker'. #413

Closed Mr-Zqr closed 11 months ago

Mr-Zqr commented 12 months ago

Hi Pierre @gergondet ,

I had a problem when trying to add a ROS subscriber in a plugin following plugin toturial and ROS integration toturial. When I launched the controller with

$ roslaunch mc_rtc_ticker display.launch $ mc_rtc_ticker

the plugin failed to launch with the following output:

[info] Loading default global configuration /usr/local/etc/mc_rtc.yaml [info] Loading additional global configuration /home/zqr/.config/mc_rtc/mc_rtc.yaml [info] GUI server enabled [info] Will serve data on: [info] - ipc:///tmp/mc_rtc_pub.ipc [info] - tcp://:4242 [info] Will handle requests on: [info] - ipc:///tmp/mc_rtc_rep.ipc [info] - tcp://:4343 [info] Enabled plugins: ROS (autoload), LikoMcrtcInterfPlugin (autoload) [info] Loading additional plugin configuration: /usr/local/lib/mc_plugins/etc/ROS.yaml [info] Loading additional plugin configuration: /usr/local/lib/mc_plugins/etc/LikoMcrtcInterfPlugin.yaml [critical] Requested creation of object named LikoMcrtcInterfPlugin which has not been loaded [critical] === Backtrace === 0# void mc_rtc::log::error_and_throw<mc_rtc::LoaderException, char const (&) [64], std::cxx11::basic_string<char, std::char_traits, std::allocator > const&>(char const (&) [64], std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) at /home/zqr/apps/mc_rtc/mc_rtc/include/mc_rtc/logging.h:52 1# mc_control::MCGlobalController::loadPlugin(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, char const*) at /home/zqr/apps/mc_rtc/mc_rtc/src/mc_control/mc_global_controller.cpp:1092 2# mc_control::MCGlobalController::MCGlobalController(mc_control::MCGlobalController::GlobalConfiguration const&) at /usr/include/c++/9/bits/stl_iterator.h:904 3# mc_control::Ticker::Ticker(mc_control::Ticker::Configuration const&) at /home/zqr/apps/mc_rtc/mc_rtc/src/mc_control/Ticker.cpp:154 4# main at /home/zqr/apps/mc_rtc/mc_rtc/utils/mc_rtc_ticker.cpp:51 5# __libc_start_main at ../csu/libc-start.c:342 6# _start in mc_rtc_ticker [error] Plugin LikoMcrtcInterfPlugin (required by global configuration) failed to load, functions provided by this plugin will not be available [info] Create controller CoM [info] Robots loaded in controller: [info] - Kuafu [info] - ground [info] MCController(base) ready [info] Added task posture_Kuafu [warning] [MCController::CoM] No state observation pipeline configured: the state of the real robots will not be estimated [info] Create controller HalfSitPose [info] Robots loaded in controller: [info] - Kuafu [info] - ground [info] MCController(base) ready [info] Added task posture_Kuafu [warning] [MC_RTC_DEPRECATED] Prefer using addContact/removeContact for contacts manipulation instead of QPSolver::setContacts [success] MCHalfSitPoseController init done [warning] [MCController::HalfSitPose] No state observation pipeline configured: the state of the real robots will not be estimated [info] Will log controller outputs to /tmp/mc-control-CoM-2023-12-01-11-02-56.bin [info] Updated latest log symlink: /tmp/mc-control-CoM-latest.bin [info] Added task com_Kuafu [info] Add contact ground::AllGround/Kuafu::LeftFoot (DoF: 1 1 1 1 1 1) [info] Add contact ground::AllGround/Kuafu::RightFoot (DoF: 1 1 1 1 1 1) [success] [mc_rtc::ROS] Starting ROS services

the same error happends when I tried to launch the controller with

$ mc_mujoco

However, when I launched the controller with

$ roslaunch mc_rtc_ticker display.launch $ rosrun mc_rtc_ticker mc_rtc_ticker

the plugin loaded successfully.

Is this a bug? What should I do to load a customized ROS intrgrated global plugin with ROS integration via mc_mujoco or mc_rtc_ticker ?

This is my computer configuration:

I'm looking forward to your kind reply.

gergondet commented 11 months ago

Your plugin needs to link with mc_rtc::mc_rtc_ros to use functionalities provided by the library

i.e. add

target_link_libraries(LikoMcrtcInterfPlugin PUBLIC mc_rtc::mc_rtc_ros)

after creating the plugin here: https://github.com/Mr-Zqr/liko_mcrtc_interf_plugin/blob/main/CMakeLists.txt#L41

Note: this plugin has another issue here where this will spin forever and stop your program in the init of the plugin