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

ros_canopen and Maxon EPOS2. Could not switch controller.

asked 2018-05-28 03:28:23 -0500

asier.fernandez gravatar image

updated 2018-06-12 09:06:47 -0500

gvdhoorn gravatar image

We are trying to setup ros_canopen with a Maxon's Epos2 controller. Our enviroment is Ubuntu 16.04 with ROS Kinetic, and ros_canopen 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 ros_canopen. 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 dcf_overlay 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 joint_position_controller 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 joint_velocity_controller.

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 ... (more)

edit retag flag offensive close merge delete

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

jdeleon gravatar image jdeleon  ( 2018-06-05 12:45:19 -0500 )edit

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<motorbase::interpolated_position, int32_t,="" 0x607a,="" 0,="" 0=""> InterpolatedPositionMode

asier.fernandez gravatar image asier.fernandez  ( 2018-06-05 15:22:01 -0500 )edit

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;
jdeleon gravatar image jdeleon  ( 2018-06-08 01:53:13 -0500 )edit

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;
jdeleon gravatar image jdeleon  ( 2018-06-08 01:53:49 -0500 )edit

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;

asier.fernandez gravatar image asier.fernandez  ( 2018-06-08 04:31:29 -0500 )edit

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.

jdeleon gravatar image jdeleon  ( 2018-06-08 04:51:00 -0500 )edit

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

gvdhoorn gravatar image gvdhoorn  ( 2018-06-12 09:07:41 -0500 )edit

@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

jdeleon gravatar image jdeleon  ( 2018-06-13 04:26:36 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-06-11 15:16:47 -0500

Mathias Lüdtke gravatar image

updated 2018-06-12 14:03:25 -0500

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.

edit flag offensive delete link more

Question Tools

6 followers

Stats

Asked: 2018-05-28 03:28:23 -0500

Seen: 710 times

Last updated: Jun 12 '18