Robotics StackExchange | Archived questions

ros_canopen with lwa4d initialization fails

Hi all,

I am quite new to ROS. My intention is to use ROS_CANopen package to connect with my robot (Maxon EPOS2 motor), but I got the failure during initializing the schunk_lwa4d.

Here is my hardware configuration:

  1. A USB-to-CAN compact is used to communicate between my laptop and the robot. The Linux driver called IXXAT socketcan driver.
  2. The robot uses Maxon EPOS2 with CANopen. DCF file is generated from EPOS studio.

When initializing...

rosservice call /arm/driver/init

the failure as follows.

success: False
message: /home/cj/catkin_ws/src/ros_canopen/canopen_master/src/sdo.cpp(429): Throw in function void canopen::SDOClient::transmitAndWait(const canopen::ObjectDict::Entry&, const canopen::String&, canopen::String*)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<canopen::TimeoutException> >
std::exception::what: SDO
[canopen::tag_objectdict_key*] = 1003sub0

after run roslaunch schunk_lwa4b robot.launch, the log is shown as follows

auto-starting new master
process[master]: started with pid [1962]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to a2e27e66-c8d0-11e6-ba1f-005056c00001
process[rosout-1]: started with pid [1998]
started core service [/rosout]
process[arm/robot_state_publisher-2]: started with pid [2013]
process[joint_state_publisher-3]: started with pid [2015]
process[arm/driver-4]: started with pid [2023]
process[arm/arm_controller_spawner-5]: started with pid [2034]
process[topic_transf-6]: started with pid [2055]
[ INFO] [1482470911.684654700]: Using fixed control period: 0.010000000
[ INFO] [1482470936.775348397]: Initializing XXX
[ INFO] [1482470936.775647194]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1482470936.775941459]: Current state: 2 device error: system:0 internal_error: 0 (OK)
abort1003#0, reason: Invalid value for parameter (download only).
Could not process message
[ INFO] [1482470936.838776231]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1482470936.838828278]: Current state: 0 device error: system:0 internal_error: 0 (OK)

Note: I already set the txqueuelen 20.

sudo ip link set can0 txqueuelen 20

From error code showed that 1003sub0, is that possible Epos studio was generated incorrect DCF ? Does someone meet this failure before?

[latest update 12/27] I modified some configuration in epos studio and generated a new DCF. the results are different as follows. When initializing rosservice, the failure as follows.

success: False
message: /home/cj/catkin_ws/src/ros_canopen/canopen_master/src/sdo.cpp(429): Throw in function void canopen::SDOClient::transmitAndWait(const canopen::ObjectDict::Entry&, const canopen::String&, canopen::String*)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<canopen::TimeoutException> >
std::exception::what: SDO
[canopen::tag_objectdict_key*] = 2303sub3

after run roslaunch schunk_lwa4b robot.launch, the log is shown as follows.

setting /run_id to 6adddc60-cc2a-11e6-bacb-005056c00001
process[rosout-1]: started with pid [23228]
started core service [/rosout]
process[arm/robot_state_publisher-2]: started with pid [23247]
process[joint_state_publisher-3]: started with pid [23248]
process[arm/driver-4]: started with pid [23249]
process[arm/arm_controller_spawner-5]: started with pid [23257]
process[topic_transf-6]: started with pid [23262]
[ INFO] [1482839325.074128952]: Using fixed control period: 0.010000000
[ INFO] [1482839327.892443220]: Initializing XXX
[ INFO] [1482839327.892948706]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1482839327.893326862]: Current state: 2 device error: system:0 internal_error: 0 (OK)
abort2303#3, reason: Data cannot be transferred or stored to the application because of the present device state.
Could not process message
[ INFO] [1482839327.965413105]: Current state: 2 device error: system:125 internal_error: 0 (OK)
[ INFO] [1482839327.965583837]: Current state: 2 device error: system:0 internal_error: 0 (OK)
[ INFO] [1482839327.965682421]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1482839327.965812697]: Current state: 0 device error: system:0 internal_error: 0 (OK)

[latest update 1/2] I commented some objectdict in my DCF file and run rosservice init. I still observed one error, 60c1sub1, which is not listed in EPOS manual. and I also consulted Drive operation modes, it's shown Interpolated Position. but EPOS manual doesn't mention 60C1 item. What can I do for this issue?

success: False 
message: /home/cj/catkin_ws/src/ros_canopen/canopen_master/include/canopen_master/objdict.h(217): Throw in function const boost::shared_ptr<const canopen::ObjectDict::Entry>& canopen::ObjectDict::at(const canopen::ObjectDict::Key&) const
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::out_of_range> >
std::exception::what: Unable to find key in unordered_map.
[canopen::tag_objectdict_key*] = 60c1sub1
; Could not set transition

after run roslaunch schunk_lwa4b robot.launch, the log is shown as follows.

setting /run_id to e79ec716-cdbd-11e6-89e6-005056c00001
process[rosout-1]: started with pid [29959]
started core service [/rosout]
process[arm/robot_state_publisher-2]: started with pid [29977]
process[arm/driver-3]: started with pid [29978]
process[arm/arm_controller_spawner-4]: started with pid [29979]
[ INFO] [1483012621.660409510]: Using fixed control period: 0.010000000
[ INFO] [1483012627.483444541]: Initializing XXX
[ INFO] [1483012627.484200784]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012627.484639008]: Current state: 2 device error: system:0 internal_error: 0 (OK)
illegal tranistion 0 -> 2
[ INFO] [1483012629.605565222]: Current state: 2 device error: system:125 internal_error: 0 (OK)
[ INFO] [1483012629.605852872]: Current state: 2 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012629.606016674]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012629.606159925]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012634.301906742]: Initializing XXX
[ INFO] [1483012634.302166583]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012634.302478668]: Current state: 2 device error: system:0 internal_error: 0 (OK)
illegal tranistion 0 -> 2
[ INFO] [1483012636.421239619]: Current state: 2 device error: system:125 internal_error: 0 (OK)
[ INFO] [1483012636.421434058]: Current state: 2 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012636.421535409]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1483012636.421609735]: Current state: 0 device error: system:0 internal_error: 0 (OK

thanks for the reply,

Asked by CJ.Nilson on 2016-12-23 02:23:39 UTC

Comments

Your new DCF specifies a ParameterValue (0x00) for 2303sub3, but your controller does not like it. ros_canopen sends SDOs for all non-default parameters at start-up. Please consult the EPOS manual to find out in which cases 2303sub3 (and 1003) can be written.

Asked by Mathias Lüdtke on 2016-12-29 12:07:33 UTC

I commented some objectdict in my DCF file and run rosservice init. I still observed one error, 60c1sub1, which is not listed in EPOS manual. and I also consulted Drive operation modes, it's shown Interpolated Position. but EPOS manual doesn't mention 60C1 item. Could you plz advise for this issue?

Asked by CJ.Nilson on 2017-01-02 13:38:49 UTC

log and details listed on above [latest update 1/2] , thanks for your time and the reply

Asked by CJ.Nilson on 2017-01-02 13:40:02 UTC

Maxon uses 0x20C1 instead of 0x60C1, not sure why.. There is not config option for the object to use, so you have to subclass the 402 layer to make it work. Or just use another mode.. (Please ask a new question if you really want to subclass)

Asked by Mathias Lüdtke on 2017-01-03 06:28:28 UTC

You probably want to use Maxon-specific Postion Mode (-1).

Or http://wiki.ros.org/epos_hardware

Asked by Mathias Lüdtke on 2017-01-03 07:32:52 UTC

Did you mean I should not comment some objectdict in my DCF file eg. 2303sub3 (analog position setpoint notation index) or each of Drive operation modes should be included and make it work? I will ask a new question, thanks for the reply.

Asked by CJ.Nilson on 2017-01-03 08:26:21 UTC

For my understanding, epos_hardware only supports USB and rs232. My intention is to use CANopen to communicate with my robot. Is ros_canopen package the only one solution for my case? If yes, I will try to let it work on my robot. Thank you for the reply.

Asked by CJ.Nilson on 2017-01-03 09:01:59 UTC

Maxon does not support standard IP mode, it uses setpoint (pos, vel & time) with 0x20C1.

You could implement this mode (difficult) or you could implement mode -1 (looks almost like IP mode).

If you do not need full trajectories, you can uses PP mode. Or you can use a PID controller with Pv mode.

Asked by Mathias Lüdtke on 2017-01-03 13:27:01 UTC

Yes, I don't need full trajectories, just need PP mode, PV mode, and torque mode. Do you know where I could find more information about mode -1 as you mentioned? I'm a little bit confused. Could you advise how to skip IP mode or should I ask a new question?

Asked by CJ.Nilson on 2017-01-03 13:54:10 UTC

mode -1 (position mode) is documented in the manual you linked above If you don't need IP mode, don't map 0x60c1 and better do not use the schunk bringup, as is was designed for trajectories and uses them by default.

Asked by Mathias Lüdtke on 2017-01-03 14:27:04 UTC

Better start from scratch with http://answers.ros.org/question/250174/how-to-control-maxon-motor-by-using-ros_canopen/?answer=250180#post-id-250180 You can copy parts from schunk_robot, as long as you understand the implications.

Asked by Mathias Lüdtke on 2017-01-03 14:28:20 UTC

Hi all, I am running into the same problem. I have a Maxon EPOS70/10 motor controller and I would like to drive a motor over the CAN bus. I had a look at https://answers.ros.org/question/250174/how-to-control-maxon-motor-by-using-ros_canopen/?answer=250180#post-id-250180.

Asked by Edgar Carrasco on 2017-11-06 10:56:43 UTC

After this I followed the link https://github.com/ipa320/canopen_test_utils and adapted the config files for CAN. Once I start the rosservice call /../driver/init I get a time out error when trying to write to index 0x60C1. I tried to configure the drive_mode to 1 that according to canopen_402 is PP

Asked by Edgar Carrasco on 2017-11-06 11:00:57 UTC

I can start a new question with all the details if required.

Asked by Edgar Carrasco on 2017-11-06 11:01:40 UTC

Did following in order to avoid the IP mode for the Maxon motor. In the dcf config file for the canopen I wrote for the dictionary entry 0x6502 following value 0x003F0025. This differs from the controller value (0x003F0065) in the bit 7. The value of this bit is set to 0 in the dcf. Hope this helps.

Asked by Edgar Carrasco on 2017-11-22 07:41:24 UTC

Hi CJ, Mathias and Edgar, I am trying to move 6 Maxon MCD Epos with an IXXAT adapter. I look in my DCF file and have the entry 0x6502, do I have to assign manually the value (0x6502=0x003F0025)? Also, I have that value at the end of the file.

Asked by jdeleon on 2018-05-31 07:09:03 UTC

Also I change the required_drive_mode to -1, but still having the same error:

[ INFO] []: Initializing XXX [ INFO] []: Current state: 1 device error: system:0 internal_error: 0 (OK) [ INFO] []: Current state: 2 device error: system:0 internal_error: 0 (OK) [ INFO] []: Current state: 2 device error:

Asked by jdeleon on 2018-05-31 07:14:15 UTC

Hi, I did change and saved the value of the dictionary entry 0x6502 using the EPOS Studio SW. I exported then the DCF file from there and used it in the ros_canopen package. For my application I had to use the profiled velocity mode and this is why I used the the value 3 in the required_drive_mode.

Asked by Edgar Carrasco on 2018-06-01 03:10:04 UTC

Hi again @Edgar Carrasco, I'm trying to modify the dictionary entry, but is impossible. I have try with EPOS_UserInterface and EPOS Studio. It says that the object is not ReadWrite, because is a Constant.

Did you have that problem? If yes, how could you solved it?

Asked by jdeleon on 2018-06-08 03:05:42 UTC

Just change it in the EDS/DCF with a text editor.

Asked by Mathias Lüdtke on 2018-06-08 03:34:22 UTC

Hi @Mathias Lüdtke, I have this in my DCF file:

[6502]
ParameterName=Supported Drive Modes
DataType=0x0007
AccessType=const
PDOMapping=0
ObjFlags=0x1
ParameterValue=0x003F0025

But the error persists.

Asked by jdeleon on 2018-06-08 03:52:54 UTC

I changed also:

66=0x003F0025

and

[003F0025]
ParameterName=Supported Drive Modes
DataType=0x0007
AccessType=const
PDOMapping=0
ObjFlags=0x1
ParameterValue=0x003F0025

But still the error

Asked by jdeleon on 2018-06-08 03:53:57 UTC

This entry is const, you cannot change ParameterValue. Please set DefaultValue instead.

Asked by Mathias Lüdtke on 2018-06-08 03:57:46 UTC

I add the DefaultValue, but the same error:

[6502]
ParameterName=Supported Drive Modes
DataType=0x0007
AccessType=const
DefaultValue=0x003F0025
PDOMapping=0
ObjFlags=0x1
ParameterValue=0x003F0025

Also, change the PDOMapping to 1, and the same result

Asked by jdeleon on 2018-06-08 05:23:19 UTC

Please open a new question. It is wrong to change PDOMapping and 66=0x003F0025 is not even valid.

Asked by Mathias Lüdtke on 2018-06-08 05:41:41 UTC

Answers

abort1003#0, reason: Invalid value for parameter (download only).

ros_canopen tries to reset the error counter on initialization. There might be a little glitch because the code just checks if the object is available, but does not check if it's writable. It seems like it is marked writable in your EDS/DCF. Can you upload it somewhere? gist would be best.

sudo ip link set can0 txqueuelen 20

Don't do this if you have a single axis! This is just required (and recommended) if you have more than 4 nodes on one CAN bus.

Asked by Mathias Lüdtke on 2016-12-23 07:41:41 UTC

Comments

Thank you for your reply, should I just upload my DCF, or it's better to upload the entire lwa4d project which I modified some part of configuration?

Asked by CJ.Nilson on 2016-12-26 13:40:58 UTC

Why should I set txqueuelen to 20 if I have more than 4 nodes on one CANbus ? If I don't set one, it will be more possible to lose packages ? thanks for your reply

Asked by CJ.Nilson on 2016-12-26 13:45:41 UTC

I set txqueuelen to 10 as a single axis config, it still failed to initial package.

Asked by CJ.Nilson on 2016-12-27 07:05:36 UTC

ros_canopen sends synchronous PDOs in bursts, so the socketcan queue might overrun and the driver stops working. (https://github.com/ros-industrial/ros_canopen/issues/102)

Asked by Mathias Lüdtke on 2016-12-30 10:12:08 UTC