How to program ROBOTIS ENGINEER from Matlab

I was able to implement the two independent networks as suggested by @roboteer. I connected the CM550 by the USB port and the servos by the U2D2 connected to an ankle servo and opening both ports from Matlab (the servos network works at 3Mbps and the CM550 at 57.6kbps) and I have the power source connected to the CM550.

Network Connection

With this setup, I can read and write information of all the built in components of the robot. Something that is a little strange for me is that the readings from the CM550 and the ones from the Servos take about the same time (~5ms/byte). I thought that the readings from the CM550 would be slower for the huge difference between communication speeds, but it seems that there is another bottleneck anywhere.

Now the next step for me is to be able to read information from the force sensing resistors that I plan to set on the foot of the robot to estimate the Center of Pressure. Originally I thought that I could connect those sensors to an RPi ADC and process it onboard but it doesn’t seem very viable in this moment. I think I’ll try using another port from Matlab to access the RPi or an Arduino as Data Acquisition Board and process the signal in Matlab directly. If you have a recommendation on this part I’d appreciate it.

Full Network Connection

Edit: I’d like to quickly add a suggestion to anyone interested about this and it is to use the SyncRead/Write functions of the SDK instead of the individual Read/WriteNBytes. The difference in the effective transfer rate of those functions compared to the one obtained receiving/sending each package individually is very notorious. With my entire control algorithm it was the difference between 28 Hz and 320 Hz effective sample frequency.

1 Like

In theory, the five GPIO ports (5 pins) on the CM-550 can handle general purpose sensors like your foot pressure sensors (0 to 5 V input, digitized to 0 - 1023). But I have no experience in using them. The Control Table addresses for them are below:

Except here it says that the Analog Input should be 3.3 V. So, you better check with ROBOTIS Tech Support directly to see which voltage level is the correct one to use!

Also, did you take care of the USB Latency Timer issue (default value of 16 ms). I know for sure changing this value to 1 ms on RPi4B made a big difference in throughput when 1 Mbps is used as baud rate talking to servos.

You will have to recompile the DXL-SDK with this new setting and adjust the USB Port properties on Device Manager also (as shown in the file “port_handler_windows.cpp”).