[SOLVED] ros_canopen ERROR after spawning controllers
Hello!
The solution is given in the answer section.
The original question with different edit parts start here:
-------------------------------------------------- ORIGINAL QUESTION --------------------------------------------------
i am trying to communicate with a single motor through CANopen. I had posted the initial problems earlier in the following question: #q294570.
The original problem was that i was unable to spawn the controllers after the canopen driver was initialized. This problem was solved by correcting the EDS file (object [6502] datatype 0x0007).
However there is a new problem.
After successful spawning (i.e., after i call /driver/init) new errors occur. This is the error message:
[ INFO] [1529588044.212953924]: Initializing XXX
[ INFO] [1529588044.213546917]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1529588044.214010384]: Current state: 2 device error: system:0 internal_error: 0 (OK)
EMCY: 81#0000000000000000
[ WARN] [1529588059.484589143]: RPDO timeout
Loaded joint_state_controller
Loaded joint_1_position_controller
Started ['joint_state_controller'] successfully
Started ['joint_1_position_controller'] successfully
[ERROR] [1529588059.984608960]: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >
std::exception::what: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
[controller_spawner-6] process has finished cleanly
log file: /home/akosodry/.ros/log/bc213964-7557-11e8-ac9e-78321b043645/controller_spawner-6*.log
[ERROR] [1529588069.994551018]: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >
std::exception::what: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
[ERROR] [1529588079.994594260]: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >
std::exception::what: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
The aforementioned error message repeats.
------------------------------------------------------------ EDIT1 ------------------------------------------------------------
As Mathias Lüdtke recommended i edited the launch file, and spawned only the joint_state_controller. Then, there is NO error message.
Then i tried to load the controller, which returned "OK":
rosservice call /controller_manager/load_controller "name: 'joint_1_position_controller'"
If i do rosservice call /controller_manager/list_controllers
:
controller:
-
name: "joint_state_controller"
state: "running"
type: "joint_state_controller/JointStateController"
claimed_resources:
-
hardware_interface: "hardware_interface::JointStateInterface"
resources: []
-
name: "joint_1_position_controller"
state: "stopped"
type: "position_controllers/JointPositionController"
claimed_resources:
-
hardware_interface: "hardware_interface::PositionJointInterface"
resources: [joint_1]
If i do rostopic list, i see the following topics:
/clicked_point
/diagnostics
/initialpose
/joint_1_position_controller/command
/joint_command
/joint_states
/move_base_simple/goal
/rosout
/rosout_agg
/tf
/tf_static
I tried to publish something to the /joint_1_position_controller/command
topic, like:
rostopic pub /joint_1_position_contller/command std_msgs/Float64 "data: 1.0"
But nothing happens (i mean i an ideal world the motor would rotate :) ...also i tried different bigger, smaller numbers).
Then i tried to diffent ways to start the controller: FIRST WAY: If i do the following:
rosservice call /controller_manager/switch_controller "start_controllers:
- 'joint_1_position_controller'
stop_controllers:
- ''
strictness: 2"
ok: False
i got the following error message:
[ERROR] [1529592920.142827840]: Could not stop controller with name because no controller with this name
exists
[ERROR] [1529592942.782467753]: Could not stop controller with name because no controller with this name
exists
SECOND WAY:
rosservice call /controller_manager/switch_controller "{start_controllers: ['joint_1_position_controller'], stop_controllers: [], strictness: 2}"
ok: True
and i got the following:
canopen_motor_node: /usr/include/boost/thread/pthread/mutex.hpp:127: void boost::mutex::unlock(): Assertion `res == 0' failed.
[canopen_driver-5] process has died [pid 27211, exit ...
First of all, the joint_state_controller must work. Do you get sane data in /joint:states? Afterwards you could open
rqt_console
, start the position controller and see in which file the error was reported.Thanks for the reply, Mathias! Its not obvious for me, that in the launch file, should i run the
joint_state_publisher
andrviz
, or these can be omitted? If i run thejoint_state_publisher
andrviz
then by changing the rviz slider the link starts to "shake".If i dont run the
joint_state_publisher
then the/joint_states
topic pos, vel values stays on zero. Of course (i think), since no desired/goal value was given?! How to test if thejoint_state_controller
works correctly?joint_state_publisher
is not needed in your case. (mostly used for rate limiting and mimic joints) Can you turn your motor manually? You should at least see little changes.Unfortunatelly i can't turn the motor manually, i think its in a break, its a quite big motor, i am driving it with a 750W motor controller. I updated the question, there is a
EDIT2
part, where i posted the output of therqt_console
Please try spawn the position controller multiple times until the node crashes (like in "SECOND WAY"). GDB will then show an interactive shell. Type "bt" and hit enter to get the backtrace.
OK, so now, the node wont crash :D idk what did change, but im trying multiple times, even restarted the launch file, but it wont crash..
It just gives the error messages: either:
Throw location unknown (consider using BOOST_THROW_EXCEPTION)
orController 'joint_1_position_controller' is already running
,So basically i think the spawning was succesfull.