cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

How to control a EtherCAT slave (IndraDrive CS) via REST API?

How to control a EtherCAT slave (IndraDrive CS) via REST API?

Binarus
Member

I have a hardware CtrlX core and have installed the ethercat_master app there. There are two IndraDrive CS MPE drive systems connected to the CtrlX via EtherCAT. Each drive system has a motor attached. The ethercat_master finds the drive systems with no issue; in principle, everything works.

Now my goal is to control the drive systems via REST API. I believe that I have understood the basic concepts of the API and of the data layer. For example, I can read real-time process data from the drive systems via REST. But I can't write realtime process data to the drive systems. For brevity, I'll focus on the master control word in the following description.

Whatever I do, there is no chance to change the master control word that the ethercat_master sends to the drive systems. This works neither via REST API nor via the web UI of the CtrlX. It is also not possible to change the master control word by writing S-0-0134 to the drive systems in the I/O engineering tool. In every case, the drive system seems to accept the written value for fractions of a second, but then the value changes back again.

I believe that the ethercat_master writes the master control word to the drives cyclically, and therefore it cannot be changed by writing S-0-0134 to the drive systems, or by writing values at the data layer IndraDrive nodes that are mapped below the ethercat_master node. Instead, the desired values must probably be written to the ethercat_master (which in turn sends them out to the drive systems). But I couldn't find out yet how to do it. Looking at the data layer, the ethercat_master does not seem to provide appropriate nodes.

Please see the attached screenshots for clarification.

Could somebody please explain what I have to do to be able to change the master control word that the ethercat_master sends to the drive systems?

Thank you very much in advance, and best regards!

Clipboard01.png

 

2 REPLIES 2

Yvonne_
Established Member

Hi @Binarus,

It should be possible to write a value to the drive control word on the datalayer there. With a similar setup (ctrlX core OS V2.4 and MPE20 drive) I can write a value both from the datalayer in the webinterface and via a rest client, e.g. to set the drive from state Ab to AH with value 35840. 

Is the etherCAT master + slaves in state OP, and the drive in state Ab (visible on display) when you are sending the command? What response do you receive if you send a PUT request via restAPI? Does the drive receive the new control word value (can be checked with the parameter editor in Indraworks/ctrlX drive engineering)? 

Yvonne__2-1712327942792.png

 

 

 

Hi @Yvonne_ 

Thank you very much for your your reply. Your input has been invaluable, because since then I at least knew that it should work as I thought.

Yes, both the ethercat_master and the slaves had been in the OP state, and the drive systems had shown "Ab" in their display. But whatever I did, the drive systems had not accepted any process data I had sent to them, neither via the REST API nor via the web UI. I also had tried to change the master control word in the parameter editor in Drive Engineering, but that didn't work either. While the web UI had shown the new value for fractions of a second, I believe that this was due to a glitch in the UI and that the drive system had not accepted the new value at all, not even during a small time span.

In the meantime, I have found out the cause of the problem: Originally, somebody had installed the PLC app and the Motion app in addition to the ethercat_master app. It had been clear to me that those apps probably would prevent me from using the rest API as intended, so I had disabled them. Obviously, that was not enough:

There were still entries in the scheduler related to them. Even uninstalling (in addition to disbling) them didn't solve the problem. Then I decided to become radical and deleted every entry in the scheduler except the one where this isn't possible. Of course, the ethercat_app didn't work afterwards, but it was easy to add it back to the scheduler.

This finally made the drive systems accept process data. At least, it was working via Web UI last Friday. I haven't tried via REST yet, because it was already later in the evening, but I'm convinced that it now will work via REST as well.

So the cause of the problem was that disabling the PLC and Motion app left inappropriate entries in the scheduler configuration, and that these entries even survived uninstalling the apps.

Without your reply, I would have been unsure whether the REST API and the Web UI should work the way I imagined, and probably wouldn't have looked into the scheduler configuration. Again, thank you very much!

Best regards, and have a nice week!

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist