Could not load custom controller, controller type does not exist
Hello,
I'm a ROS novice trying to run a Gazebo simulation with a user defined Joint Position Controller and I'm experiencing some difficulties loading the controller.
I have the code running successfully on another machine and now I'm trying to migrate to a new computer. I duplicated the configuration as best I could but upon running my controller launch file, I get the following error which I'm not sure how to resolve:
[ERROR] [1569865552.085248704]: Could not load class 'user_joint_position_controller/userJointPositionController': MultiLibraryClassLoader: Could not create object of class type controller_ns::userJointPositionController as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary() [ERROR] [1569865552.085297045]: Could not load controller 'steering_position_controller' because controller type 'user_joint_position_controller/userJointPositionController' does not exist. [ERROR] [1569865552.085313300]: Use 'rosservice call controller_manager/list_controller_types to get the available types`
Here is the output of running rosservice call /toninus_rdt/controller_manager/list_controller_types
:
user_joint_position_controller/userJointPositionController is there, 5th from the end
types: [ackermann_steering_controller/AckermannSteeringController, controller_manager_tests/DerivedController,
controller_manager_tests/EffortTestController, controller_manager_tests/ExtensibleController,
controller_manager_tests/MyDummyController, controller_manager_tests/PosEffController,
controller_manager_tests/PosEffOptController, controller_manager_tests/VelEffController,
diff_drive_controller/DiffDriveController, effort_controllers/GripperActionController,
effort_controllers/JointEffortController, effort_controllers/JointGroupEffortController,
effort_controllers/JointGroupPositionController, effort_controllers/JointPositionController,
effort_controllers/JointTrajectoryController, effort_controllers/JointVelocityController,
force_torque_sensor_controller/ForceTorqueSensorController, imu_sensor_controller/ImuSensorController,
joint_state_controller/JointStateController, pos_vel_acc_controllers/JointTrajectoryController,
pos_vel_controllers/JointTrajectoryController, position_controllers/GripperActionController,
position_controllers/JointGroupPositionController, position_controllers/JointPositionController,
position_controllers/JointTrajectoryController, user_joint_position_controller/userJointPositionController,
velocity_controllers/JointGroupVelocityController, velocity_controllers/JointPositionController,
velocity_controllers/JointTrajectoryController, velocity_controllers/JointVelocityController]
base_classes: ['controller_interface::ControllerBase', 'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase', 'controller_interface::ControllerBase',
'controller_interface::ControllerBase']
Here is my .yaml:
toninus_rdt:
# Publish all joint states -----------------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Position Controllers ---------------------------------------
steering_position_controller:
type: user_joint_position_controller/userJointPositionController
joint: steering
pid: {p: 300.0, i: 0.0, d: 7.5}
# Delay time = delayQueueLength * max_step_size from .world file
delayQueueLength: 1660
deadzoneThreshold: 0.0
rear_velocity_controller:
type: effort_controllers/JointVelocityController
joint: rear_wheel_joint
pid: {p: 40.0, i: 0.0, d: 1.00}
Here is the .launch file:
<?xml version="1.0" encoding="UTF-8"?> <launch>
<!-- Load joint controller configurations from YAML file to parameter server --> <rosparam file="$(find toninus_rear_asm)/control/config/toninus_rear_asm_control.yaml" command="load"/>
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="/toninus_rdt" args="steering_position_controller rear_velocity_controller >joint_state_controller"/>
<!-- convert joint states to TF transforms for rviz, etc --> <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen"> <remap from="/joint_states" to="/toninus_rdt/joint_states" /> </node>
</launch>
Here is my controller_plugins.xml:
<library path="lib/libeffort_controllers">
<class name="user_joint_position_controller/userJointPositionController"
type="controller_ns::userJointPositionController"
base_class_type="controller_interface::ControllerBase">
</class>
</library>
Here is the controller source from user_joint_position_controller.cpp, it's barely modified from the standard position controller :
#include <effort_controllers/user_joint_position_controller.h>
#include <angles/angles.h>
#include <pluginlib/class_list_macros.hpp>
#include <queue>
static std::queue<double> delayQueue;
static double deadzoneThreshold = 0.0;
namespace ...
Could you please check formatting of your
.yaml
files? It doesn't appear to be valid yaml right now. That is not the cause of your problem -- most likely -- but would make it easier to understand what is going on.My bad, the formatting has been corrected.
Just to doublecheck:
The namespace in your source code as well as the type in your plugin.xml do match?
I believe the namespaces match, I've included the plugin.xml and the controller source.
Was this ever resolved?
Not yet, do you have a similar problem?
Not sure about this, but I thought the PLUGIN_EXPORT_CLASS line is supposed to be inside your namespace?