ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[SOLVED] ros_canopen ERROR after spawning controllers

asked 2018-06-21 09:19:01 -0600

akosodry gravatar image

updated 2018-06-30 07:21:47 -0600

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 ...
(more)
edit retag flag offensive close merge delete

Comments

1

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.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-22 02:33:33 -0600 )edit

Thanks for the reply, Mathias! Its not obvious for me, that in the launch file, should i run the joint_state_publisher and rviz, or these can be omitted? If i run the joint_state_publisher and rviz then by changing the rviz slider the link starts to "shake".

akosodry gravatar image akosodry  ( 2018-06-22 04:14:57 -0600 )edit

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 the joint_state_controller works correctly?

akosodry gravatar image akosodry  ( 2018-06-22 04:19:46 -0600 )edit
1

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.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-22 04:37:41 -0600 )edit

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 the rqt_console

akosodry gravatar image akosodry  ( 2018-06-22 04:52:09 -0600 )edit

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.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-22 09:26:14 -0600 )edit

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..

akosodry gravatar image akosodry  ( 2018-06-22 09:49:43 -0600 )edit

It just gives the error messages: either: Throw location unknown (consider using BOOST_THROW_EXCEPTION) or Controller 'joint_1_position_controller' is already running,

So basically i think the spawning was succesfull.

akosodry gravatar image akosodry  ( 2018-06-22 09:50:21 -0600 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2018-06-30 07:19:38 -0600

akosodry gravatar image

Solution:

(History:)Originally I was unable to spawn the controllers after initializing the canopen driver. A lot was discussed here and i was really struggling with my setup, but here are the solutions that made it work finally:

First problem was identified by @Mathias Lüdtke. Namely, the original EDS file had a wrong object description, the right one is DataType=0x0007.

The second problem was again around the EDS file, namely, the correct PDO mapping was the issue. For me its still not 100% clear why the PDO mapping from the working Schunk package did not allow to successfully spawn the position controller and control the motor,

however the following PDO mapping allows both to measure the shaft position (through joint_states topic) and control the shaft position (through the /joint_1_position_contller/command topic):

[1600sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=1
PDOMapping=0
ObjFlags=0x0
ParameterValue=2

[1600sub1]
ParameterName=PDO mapping 1
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0x60400010
PDOMapping=0
ObjFlags=0x0
ParameterValue=0x60400010

[1600sub2]
ParameterName=PDO mapping 2
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0
PDOMapping=0
ObjFlags=0x0
ParameterValue=0x607a0020

[1601sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=2
PDOMapping=0
ObjFlags=0x0
ParameterValue=0

[1602sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=2
PDOMapping=0
ObjFlags=0x0
ParameterValue=0

[1603sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0
PDOMapping=0
ObjFlags=0x0

[1A00sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=1
PDOMapping=0
ObjFlags=0x0
ParameterValue=3

[1A00sub1]
ParameterName=PDO mapping 1
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0x60410010
PDOMapping=0
ObjFlags=0x0
ParameterValue=0x60410010

[1A00sub2]
ParameterName=PDO mapping 2
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0
PDOMapping=0
ObjFlags=0x0
ParameterValue=0x60610008

[1A00sub3]
ParameterName=PDO mapping 3
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0
PDOMapping=0
ObjFlags=0x0
ParameterValue=0x60640020

[1A01sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=2
PDOMapping=0
ObjFlags=0x0
ParameterValue=0

[1A02sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=2
PDOMapping=0
ObjFlags=0x0
ParameterValue=0

[1A03sub0]
ParameterName=number of mapped application objects in PDO
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=rw
DefaultValue=0
PDOMapping=0
ObjFlags=0x0

I hope this solution can help others to save some time.

I would also like to thank Mathias for the constant help!

edit flag offensive delete link more

Comments

Great! Could you provide me the full broken and working EDS, please? There must be a certain case / error that was not handled properly and I'd like to handle this in a better way :)

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-30 10:58:42 -0600 )edit

Hello!

The original EDS from the manufacturer: Original

The edited EDS based on Schunk: edited based on Schunk

akosodry gravatar image akosodry  ( 2018-06-30 11:09:06 -0600 )edit

The working EDS: Working

Would be good if you can explain what was the problem with the former EDS files :)

akosodry gravatar image akosodry  ( 2018-06-30 11:10:30 -0600 )edit
2

answered 2018-06-21 09:37:04 -0600

Mathias Lüdtke gravatar image

updated 2018-06-25 10:46:29 -0600

[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

This really looks suspicious, I have never seen this before. Which OS/architecture are you using?

Please try to spawn only the joint_state_controller. And which part of the code does issue the ROS error? (check with rqt_console).

Update: I must admit that I am running out of ideas.. I would suggest to upgrade ALL ros packages to the latest version to rule out ABI problems. Afterwards you have to clean and rebuild your workspace.

If the node keeps dying, please debug it with GDB and provide the backtrace of the crash.

Update 2: Your candump looks wrong. The driver does not receive any joint values. And even the status words gets sent at a rather strange timing. I think you should first solve the joint state issue before trying to move. Some things to check: * Does the sync rate fit (might be restricted by the controller)? Does it need a certain format (e.g. with overflow)? * Is the PDO mapping correct? Is it set to transmission type 1? (Sent data after every sync message) * For now you might want to turn off homing: Set homing method to 0 (if possible) or remove the homing mode bit from 0x6502 (in DefaultValue).

edit flag offensive delete link more

Comments

Thank you again! I ve just edited/updated the question

akosodry gravatar image akosodry  ( 2018-06-21 09:58:26 -0600 )edit

If i am not asking too much, can provide the commands for the upgrade ALL ros packages to the latest version? I guess: it should start with sudo apt-get update, then sudo apt-get install ros-kinetic- ? (does * stand for the all packages?)

I know this is a noobie question.

akosodry gravatar image akosodry  ( 2018-06-22 06:07:01 -0600 )edit

The easiest way might be: sudo apt update && sudo apt full-upgrade This will upgrade ALL packages. If you don't want to do that, you could use synaptic (graphical packages manager) to select only specific packages.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-22 06:13:09 -0600 )edit

Thank you! I am doing it. I will report back what is the situation after the upgrade. This is quite unfortunate situation... Could not it be the EDS file that makes some problems still? I dont know, maybe another object is wrongly defined, or is missing. No idea.

akosodry gravatar image akosodry  ( 2018-06-22 06:18:00 -0600 )edit

@Mathias Lüdtke, i updated again the question. There is an EDIT3 part. Thank you for the help. Also i was considering to write to Delta about the canopen mode or EDS file, but i dont really know what specific problems should i address.

akosodry gravatar image akosodry  ( 2018-06-22 08:12:50 -0600 )edit

Hello @Mathias Lüdtke. Thank you again both for the help and the recommendations. I updated the post, now it contains an EDIT4 part. May i ask you to check it? Iam waiting for the replies. Thank you.

akosodry gravatar image akosodry  ( 2018-06-27 03:02:47 -0600 )edit

@Mathias Lüdtke: i also uploaded a new candump at 100 ms sync rate, i updated the post, the github link is in EDIT4 part.

akosodry gravatar image akosodry  ( 2018-06-27 16:06:14 -0600 )edit

I found a solution. Still not 100% clear why the PDO mapping of Schunk did not work.. I updated the post with the solution.

akosodry gravatar image akosodry  ( 2018-06-29 12:15:24 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-21 09:19:01 -0600

Seen: 1,249 times

Last updated: Jun 30 '18