Robotics StackExchange | Archived questions

ros_canopen and Maxon EPOS2. Could not switch controller.

We are trying to setup roscanopen with a Maxon's Epos2 controller. Our enviroment is Ubuntu 16.04 with ROS Kinetic, and roscanopen version: 0.7.9.

We followed documentation described in ros_canopen, and mostly these two answer and answer .Now we have a basic communication between ros_canopen and Epos2 controller.

We had some issues when we setup the configuration. Maxon provides a tool for Windows called EPOS Studio, which allows to manage the controllers.

First, we configured the controller with EPOS Studio to handle canopen protocol, and we exported the configuration to a EDS file for roscanopen. We lost some time until we figured out that exported EDS file didn't contain the configuration that was using the controller and we overwrited the parameters within `dcfoverlay` section.

Then, we tried to initialize the controller, but we had an issue with the Interpolated Position Mode. ros_canopen defines such modes input in 60c1sub1 register, but Epos2 controller doesn't. Despited it isn't the best solution, we changed that mode to accept 0x607A (Target Position) in motor.h, but we do not use that mode.

At this point we have another issue, when we power on the controller, by default it is in disabled state (control word 0xxx xx0x) and if we rosservice call /driver/init we get "Transition timeout; Could not enable motor; Transition timeout". If we Enable the controller using EPOS Studio and call init service, then ros_canopen goes one step forward and makes Homing with it's default homing method (in this case actual position: 35). After that, the controller is set in disabled state.

Finally we launch our controller with the following configuration:

joint_position_controller:
  type: position_controllers/JointPositionController
  joint: motor_1_joint
  required_drive_mode: 1
joint_velocity_controller:
  type: velocity_controllers/JointVelocityController
  joint: motor_1_joint
  required_drive_mode: 3

We set PDO as:

can0  181   [2]  00 01        # Controlword
can0  281   [2]  40 07        # Statusword
can0  381   [1]  06           # Modes of Operation Display
can0  481   [4]  FD FF FF FF  # Position Actual Value

When we load the jointpositioncontroller we get following error:

Could not switch to mode 1, reason: Mode switch timed out.
[ERROR] [1527494153.154665304]: motor_1_jointcould not enter mode 1
[ERROR] [1527494153.155116906]: Could not switch one joint for joint_position_controller, will stop all related joints     and the controller.
[ERROR] [1527494153.928573312]: Could not switch one joint for joint_position_controller, will stop all related joints and the controller.

The same happens with jointvelocitycontroller.

Basically we have two questions:

1) How can we init the driver without manually enabling from EPOS Studio?

2) How can we proceed to success in loading the controllers?

Thanks!


Edit: Mathias thanks for your reply. As you said, I've set "0x6060":"1"in dcf_overlay, but nothing changes. I can monitor controller's registers with EPOS Studio in 'realtime' though USB. The value of 0x6060only changes only if rosservicell call .../init is called after enabling the controller. The value 0x6060is automatically set to 6 (homing method). I assume this is how it should work.

I've talked with Maxon's support and I think one step within the initialization is missing. Maxon Application Notes in section 8.4 Profile Position Mode describes the 2 commands need to send to the EPOS2 controller's controlword register in order to set in "Operation Enable" state: 1) Shutdown command, reg: 0x6040-00 value: 0x0006 2) Switch on & Enabl, reg: 0x6040-00 value: 0x000F

Those two commands corresponds with the definition of the EPOS2 controller's state-machine, explained in the Firmware Specification Section 3.2

I've sent those two commands using can-utils, and it set the controller in Operation Enable state.

cansend can0 601#2240600006000000

cansend can0 601#224060000F000000

I've sniffed can packages with:

candump -cae can0,0:0,#FFFFFFFF and I din't see any writing command in Controlword 0x6040, only readings.

1) the question now is whether this additional initialization step is needed to properly work with EPOS2 controllers using ros_canopen.

2) I can load the controller, setting switching_state to 4

thanks again!

asier.

Asked by asier.fernandez on 2018-05-28 03:28:23 UTC

Comments

Hi @asier.fernandez !

How did you configured the EDS file to overwrite the dcf_overlay section. And how did you know that you have the wrong configuration?

I have the same error but with 60c1sub0. Could you explain how did you change the mode in motor.h?

Many thanks, Jorge

Asked by jdeleon on 2018-06-05 12:45:19 UTC

You can manually edit EDS file, or create an overlay as it is explained in canopen_chain_mode

I've edited motor.hreplacing the mode typedef ModeForwardHelper InterpolatedPositionMode

Asked by asier.fernandez on 2018-06-05 15:22:01 UTC

Hi @asier.fernandez I try to replace the typedef as you explain, but it fails when compiling the code:

error: an assignment cannot appear in a constant-expression
 typedef ModeForwardHelper<MotorBase::Interpolated_Position, int32_t,="" 0x607A,="" 0,="" 0=""> InterpolatedPositionMode;

Asked by jdeleon on 2018-06-08 01:53:13 UTC

the second error:

/home/jorge/WS/epos_ws/src/ros_canopen/canopen_402/include/canopen_402/motor.h:209:94: error: wrong number of template arguments (3, should be 5)
         typedef ModeForwardHelper<MotorBase::Interpolated_Position, int32_t,="" 0x607A,="" 0,="" 0=""> InterpolatedPositionMode;

Asked by jdeleon on 2018-06-08 01:53:49 UTC

Sorry @jdeleon, I just copy/paste the command, and the format of the next was changes typedef ModeForwardHelper<MotorBase::Interpolated_Position, int32_t, 0x607A, 0, 0> InterpolatedPositionMode;

Asked by asier.fernandez on 2018-06-08 04:31:29 UTC

Hi @asier.fernandez, I try that change before I commented the other errors. I can compile with that modification, but the error when I try to initialize the motors still.

Asked by jdeleon on 2018-06-08 04:51:00 UTC

@asier.fernandez: please don't post updates as answers. Only use answers if you're answering your own question. For everything else, please edit your original post. Use the edit button/link for that.

Asked by gvdhoorn on 2018-06-12 09:07:41 UTC

@asier.fernandez, how do you know that the motor has activated the PDO? I'm monitoring the CAN with wireshark, but nothing happens... the motor receives the command but I don't know if it is correctly or not

Asked by jdeleon on 2018-06-13 04:26:36 UTC

Hi @asier.fernandez, did you managed to get your EPOS2 controller working with ros_canopen ?

Asked by Cyril Jourdan on 2018-10-08 06:35:41 UTC

I could't work more on that, and for the moment the work I started is stopped.

Asked by asier.fernandez on 2018-10-08 06:44:28 UTC

Answers

How can we init the driver without manually enabling from EPOS Studio?

Please try to set a value for 0x6060 (e.g. 1) in dcf_overlay. Not all devices switch to "Operation enabled" without a mode.

2) How can we proceed to success in loading the controllers?

Does Maxon prohibit mode switching to certain motor states? You could try to set the switching_state param to 4 ("Switched on").

Update: You might need to set switching_state ("Ready_To_Switch_On") to shutdown before switching.

Asked by Mathias Lüdtke on 2018-06-11 15:16:47 UTC

Comments