ros_canopen and Maxon EPOS2. Could not switch controller.
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 0x6060
only changes only if rosservicell call .../init
is called after enabling the controller. The value 0x6060
is automatically set to 6 (homing method). I assume this is how it should work.
I've talked with Maxon's support and ...
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
You can manually edit EDS file, or create an overlay as it is explained in canopen_chain_mode
I've edited
motor.h
replacing the mode typedef ModeForwardHelper<motorbase::interpolated_position, int32_t,="" 0x607a,="" 0,="" 0=""> InterpolatedPositionModeHi @asier.fernandez I try to replace the typedef as you explain, but it fails when compiling the code:
the second error:
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;
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.
@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.@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