Robotis MicroPython API reference manual

I have just received the Robotis Engineer kit both 1 and 2. My son has built the Dr R robot from kit1. We played with robot using the code that was on the robot and the app on the phone. We have also played with making some custom motions and saving to the motion group on the CM-550 using task 3.0

We would like to start to now program the controller in Python. We clicked on programming tab in task 3.0 then clicked the tab and are ready to punch out some code but I am unable to find a link the Robitis API reference manual to know what are the functions are.

Although I couldn’t find any links to it on the Robotis website or in any documention for CM-550 or Engineer kit, when I google “robotis pycm” I did find this CM-550 MicroPython API that has the higher level classes and methods/functions. I do notice in @roboteer videos he also uses primitive classes and methods/functions like DXL(200).read8 can anyone link me to a complete reference of all the classes and methods/functions for the pycm module.

I ran the following code:

import pycm
pycm.console(pycm.const.USB)
for item in dir(pycm): print(item)

and discovered many classes in the pycm module that are not listed in API emanual:
DXL, dxlbus, eeprom, info, millis, micros, timer, BLE, UART, USB, error, etc, rpi

Hello @Out_of_the_BOTS ,
Thank you for sharing that handy piece of Python code. It looks like that you have received your ENGINEER Kit 1 and Kit 2? ROBOTIS has more free manuals for using TASK and MicroPython if you register your kits at this link Registration | ROBOTIS .
When you register your CM-550 S/N, it gives you access to manuals related to Kit 1 (such as how to use TASK 3).
When you register the S/N found from the back of Kit 2 Manual, it gives you access to the MicroPython manuals. There are some information in those manuals that are not (yet) listed in the web pages of the pycm API that you referred to. But like you had found out, those web pages are currently not complete. Right now I do not know of a complete list anywhere. Maybe ROBOTIS folks can help @willson.
When I wrote my first Engineer book (back in 2019), this API was not even published, but I know my way around Control Tables for the CM-550 and the 2XL430 servos, so I have gotten into the “bad habit” of using primitives, because I know that they are going to work for me no matter what.
Please see these links for the Control Tables that I used (CM-550) and (2XL430-W250-T)

Ok thanks you @roboteer

There is some more info about the python API in the lessons for kit2 but still very far from a complete documentation of pycm API. For example it does show some of the functionality of the ollo class only some of the ollo servo and IR distance sensor. There certainly isn’t any info about the smart class which is what I want to play with atm as my son has built the DR-R robot. My 16yr son is confident in programming in python and has won gold in robotics competitions before.

I personally have won many gold competing in the University/Professional class. When I compete I try very hard not to use complex systems or really custom build hardware as the kids then think that it is some thing very complex that they can’t do. I try to use only standard kids educational kits programmed in scratch where possible other wise programmed in python to inspire the kids that they can do it too.

I see the Robotis Engineer kit as having impressive hardware (18 DOF, ports for sensors, integrates with smart phone and RPi) and can be programmed in easy for kids to learn language like python. The only boundary is without the documentation it isn’t possible to make use of all this great hardware.

Every year I try to build an eye popping robot top take to the comp designed to inspire the kids. This https://fb.watch/79tKE78YV6/ is a robot that I built to compete in Alpine Challenge that has to climb up an 80 degrees slope and plant a flag on top. It won gold competing against fully custom built robots programmed in embedded C yet this was built using standard parts from the Makeblock education kit and programmed in scratch.

Next year I want to use the Robotis Engineer kit2 max-e2 robot with modified hands to walk up to the climb grab on and climb up then roll on to the top and plant the flag. This would be a hell of an eye popper for sure. The hardware is capable it is just a big programming challenge for me.

1 Like

@Out_of_the_BOTS , thank you for the great videos and it looks like that you’ve got great plans for the Engineer kits.
Right now, for Python programmers wanting to use “all” Smart Device functions, there is only one possible path and it involves a “comparative study”:

  1. There is good info for using Smart Device in TASK programming at this web link (R+ Task 3.0) - but there is no such equivalent information for Python users.
  2. There is sort of a Control Table for Smart Device commands (similar to the ones for CM-550 and 2XL430) - but it is only in Korean (and I do not read/write Korean). Luckily, you can use Google Translate to get an acceptable version in English. This link is at (smanrt_manual).
    So until ROBOTIS gets some more info added to the English E-manual, you will have to go back and forth between the TASK examples and using primitive commands of the type DXL(xxx).read() and DXL(xxx).write() for the Python coding work. That Smart Device Control Table will tell you what is the size of the arguments to read and write (1, 2, 3 or 4 bytes). Just remember that DXL(200) refers to the CM-550, DXL(201) refers to the RPi0W, and DXL(100) refers to the ENGINEER App. You should have seen that usage approach in my ENGINEER Book 1. Section 1.4 in this book goes over the Dynamixel Network concept used in all their robotics kits. I also made a tutorial video for translating TASK code to MicroPython code here ( Converting Task code to MicroPython code for Engineer Kits - YouTube.
    Come to think of it, as you are a capable Python programmer, you can create a bunch of wrapper functions for your son to use! So he won’t have to deal with the DXL function calls.

Happy Coding!

@roboteer thanks for the links, they will get me a little further.

Yes it is my intention to create python wrappers around the spaghetti of functionality to create a nice and easy to use class that follows python convention so python programming skills are portable between Robotis Engineer and other python programming environments.

I run Professional Development days for teachers and they have to show what they are teaching is meeting the curriculum. 2 big ticket item are portable coding skills and OOP (object originated programming). So they all want scratch for younger kids and python for older kids that way it is portable between lots of platforms. Task programming environment is only used on Robotis educational platform so isn’t portable. Python is very easy to teach OOP concepts and implementation. U can see how all the big educational platforms like Lego education, micro bit, Makeblock, Adafruit, RPi have switch to python with a scratch sitting on top.

OK I have now got a lot of the stuff that I wanted to get working on the smart phone.

I have also found a lot of undocumented functionality available in the smart class of the pycm module but I still had to use low level primitives for some of the stuff I wanted to do.

Here is all functions I found:

smart.is_connected()
smart.wait_connected()
smart.write()
smart.write8()
smart.write16()
smart.write32()
smart.read()
smart.read8()
smart.read16()
smart.read32()
smart.read64()
smart.display.screen_orientation()
smart.display.back_image()
smart.display.frontimage()
smart.display.mask_image()
smart.display.shape()
smart.display.text()
smart.display.number()
smart.camera.select()
smart.camera.zoom()
smart.camera.fuction()
smart.camera.record()
smart.camera.capture()
smart.multimedia.tts()
smart.multimedia.play_instrument()
smart.multimedia.play_audio1()
smart.multimedia.play_video()
smart.multimedia.volume()
smart.multimedia.playaudio2()
smart.multimedia.pause_video()
smart.vision.tracking_color()
smart.vision.face_detected_area()
smart.vision.detected_color()
smart.vision.motion_detected()
smart.vision.line_detected_area()
smart.sensor.speech_recognize()
smart.sensor.speech_recognition_result()
smart.sensor.shaking()
smart.sensor.tilt_left()
smart.sensor.tilt_right()
smart.sensor.tilt_up()
smart.sensor.tilt_down()
smart.sensor.brightness()
smart.sensor.magnetic()
smart.sensor.compass()
smart.sensor.noise()
smart.sensor.touched_area1()
smart.sensor.touched_area2()
smart.sensor.gesture()
smart.etc.debug_info()
smart.etc.sms_number()
smart.etc.sms_text()
smart.etc.notification_event()
smart.etc.stimer()
smart.etc.vibrate()
smart.etc.flash()
smart.etc.run_app()
smart.etc.send_email()
smart.etc.print_screen()
smart.etc.println_screen()

1 Like

Thanks for sharing a glimpse into how Computer Science is taught in Australia!

Wonderful “sleuth” work. This list and the Smart Device Control Table will help lots of MicroPython users on the Engineer Kits.
Thanks a lots for sharing!

1 Like

Hi @Out_of_the_BOTS

Wow, a lot more discussions were going on here.
FYI, I’ve left a link to this thread on the Robotis website forum below.

At the moment, the pycm document on the eManual is what I can disclose, but I’ll see if there’s any updates in the API documentation to share with community.

Thank you!

@willson it seems to me that the cmpy API is in beta stage compared the the mature port of Ardunio for Opencm controller.

I am relativity experienced in using quite a number of micropython ports on a number of platforms. Since the CM-550 port of micropython is very young and is likely to develop a lot in the near future is there anywhere that I can give input/requests in to the development??

I find when new platforms start off with some not optimal way of doing things then as the platform develops it becomes very held back by it as everyone wants backward compatible leading to a legacy code brake forever more.

@Out_of_the_BOTS
Thank you for your suggestions.

I personally prefer to build up and improve together with many users because it could reflect the needs of the actual users and developers into the product.

And I think your teaching and maker experiences will be great inputs for the developers to improve useful and more user friendly features.
Since I do not have any information about the current development status and future plan of CM-550 and related products, I’m going to share this thread with the relevant developers for their references.

But please note that many ROBOTIS’s CM controllers including CM-550 are not an open source project and somewhat dependent on legacy libraries that are compatible with ROBOTIS apps and this sometimes make all those awesome ideas difficult to accept.

1 Like

@willson
I am currently reading @roboteer book and it is greatly helping my understand of the Dynamixel ethos.

I think 1 place I can offer a lot of input is into the how most experienced users make use of the advantages Mircopython can offer over using C (interpreted vs compiled).

This biggest thing I am missing atm is not having a run option to run code without downloading it. ATM to run a python script with task IDE you have to download it to the MCU flash then press the run button on the CM-550 to then load it from the flash into RAM to be interpreted. This both slows development cycle of my code and causes a lot of excess wear on the flash RAM of the MCU.

To load a python script directly in to RAM in micropython you use the paste mode (ctrl E then ctrol V to paste then ctrl D to execute then after the code has finished you useually do a soft reset to clear RAM) see here The MicroPython Interactive Interpreter Mode (aka REPL) — MicroPython latest documentation

@Out_of_the_BOTS

Thank you for the information.
@roboteer creates a lot of interesting projects and he hacks almost every recent ROBOTIS products so he has abundant knowledge about them and what he does amazes me like what you did for the ENG kit.

When I spoke to the developer yesterday, the python API documentation seemed to be distributed only for the customers who purchased the ENGINEER Kit so I’m not quite sure how deeply I can go through.

In regard with running the python script method, I’ll request developers to review the feature and check whether it is something they can implement or not.

Thank you!

@willson many thanks for taking to time to attend to my questions.

I have purchased both Engineer kit1 and kit2 but am only able to access the very limited docs that are public available here https://emanual.robotis.com/docs/en/edu/pycm which is a small subset of the whole API. Roboteer also had never seen all the smart class that I posted above and he too owns the Engineer kit.

It does seem a little strange to me for Robotis to spend the time and money to develop a user API but then not let the user/customer access docs on how to use it.

As I get a better understanding of the way the whole system works and gain more experence on the system I am more like to continue to develop my own API as I can create it to my own personal likes. Anything I create I will make publicly available MIT for anyone to use.

At the risk of asking for too many requests and ticking off the developers, I have another request. I would like to be able to access the Micropython file system on the CM-550 so that I can download any APIs (python modules) that I create.

I assume Robotis forked the STM32 micropython port from here https://github.com/micropython/micropython/tree/master/ports/stm32 so all this functionality is already within the micropython core just Robotis developers have disabled the user from accessing it.

Can the developers allow users to access the os module documented here https://docs.micropython.org/en/latest/library/uos.html

@Out_of_the_BOTS

No worries. It is my pleasure to be able to help other developers.

You can also download the python material in the link here.
What I was told is that it is the python coursework material rather than the API reference.
Disclosing the python API has been listed in the agenda and will be discussed in the relevant group meetings.

I’m sorry but I do not have much experience with the micropython and CM-550 so I’ll have to relay your request to the developers and will get back to you with their responses.

Thanks!

1 Like

Hi @Out_of_the_BOTS

CM-550 developers confirmed that some modules such as uOS are excluded due to the limitation of the flash size of the MCU.
Since flash memory is tightly allocated to operate the default program provided by ROBOTIS, it seems difficult to append additional modules.

Thank you.

@willson thanks again to take the time to deal with all my request,it shows very good after sales service by Robotis.

Yes micropython is always tight for both flash and RAM on many MCUs especially if you want a files system of any size.

Hopefully in the future the team will be able to claw back a little of the 1024kb flash for the micropython core as the fully featured micropython binaries for most of the STM32F4 ports are 330kb see https://micropython.org/download/stm32/

I really like the Engineer kit hardware.

The servos are next level and the captive nut design makes for a very compact high performance design.

I love the idea that the controller can be programmed by micropython rather than Ardunio because it makes for really easy and fast development of code and it makes it much more accessible to beginners.

I do how ever find it frustrating that this micopython port is a bit like going to boxing match with 1 arm tied behind your back. Imagine having an Ardunio port where many of the standard functions from the Ardunio core are removed then also the libraries directly is disabled so you can’t add new libraries.

I was under the impression that tools like AMPY (Adafuit Micropython) tool and rShell for accessing the file system work by leveraging the uOS module.

There must be some sort of access to the Micropython file system because TASK IDE downloads the users program to it.

1 Like

I assume the CM-550 won’t be the very last micropython controller that Robotis ever make. If the reason that the CM-550 can’t run a full version of Micropython is due to the hardware limitations then this might be something that wants to be put on the list for consideration when designing future controllers so they don’t have the same limitations.

1 Like

@Out_of_the_BOTS

I’m very much appreciated to be able to hear your feedback about the microPython and the CM-550 controller.
The CM-XXX controllers are somewhat limited within the boundary of ROBOTIS software environment and the CM-550 was the first movement toward other popular languages like python, so please understand the lack of our experience in adopting a new environment to the controller.
Unlike the CM controller series, Open controllers are more wide open for various environments and easier to accept various changes as they are “open” source based hardware.
We’re keep working on developing a new product that will meet the requirement of the market and I believe python will be very likely to be supported in the future products (as well as Arduino).

1 Like