Group Abstract Group Abstract

Message Boards Message Boards

Controlling a Meccano G15 KS robot with the EZ-Robot system

Posted 8 years ago
POSTED BY: Terence Smith
8 Replies

In the past year I have been working very hard with my robots. I have been lucky enough to have purchased a NAO robot. This robot is very high end. It comes with a number of SDK's. Python being one of them. With NAO robot comes a visual programming environment called Choregraphe. This entry will show how I have integrated Mathematica into this environment making use of the Wolfram Cloud.

enter image description here

Cloud access and Choregraphe

Being able to integrate Mathematica into the Choregraphe environment would mean that nearly all of the functionality of Mathematica can now be used by the NAO robot. The steps to achieve this are shown below.

1). Create an API Function in Mathematica.

2). Embed this function in the cloud using the Python option.

3). Copy the embedded code to a Python box in Choregraphe.

4). Create any Python code that is required to assist in execution of the function.

5). Finally execute the Python box in Choregraphe to test it

??Now to examine each step in detail. Steps 1 and 2 can be carried out as shown in the code below. Creating an API function and embedding it is done in one step strictly speaking. However it is good to be aware that there are two steps. The user must create their own function because the cloud address shown in the code image below no longer exists. This is the case simply because if it were still available a user of this site would be using my cloud credits. Cloud credits are required to use cloud functions. Visit Wolfram research for more details on cloud credits.

EmbedCode[ APIFunction[{"x" -> "Integer"}, #x+#x+5 &], "Python"]

enter image description here

Steps 3 and 4 can be carried out as shown in the image below. These steps are much like the first two steps they are carried out in one process. Create a Python box in Choregraphe and copy and paste the code shown above into the Python box as shown below. The red outline at the top is all the code pasted in from Mathematica. The red outline at the bottom is the code that will call the cloud function and get NAO to speak the result

The code that is used by the robot to access the cloud function

I have now created what is called a box library in Choregraphe containing access to a great variety of Mathematica functions. For example my NAO robot can now make use of most of the machine learning functionality provided by Mathematica. The image processing and computer vision functions are also very useful to my robots. Access to all the math functions of which there are thousands. This means I do not have to sit and write code to carry out calculus. I am making use of one of the best computer algebra systems available.

However for the robotics purists out there. There is a small amount of latency that would not be good in a production environment. As I have stated many times before I am about testing and research. I can implement a system to allow the NAO robot to identify hand written digits 0-9 (using MNIST database). I know I could do this in minutes. Not hours or days, minutes. It is easy to see how a small acorn can become a very big oak tree using this setup.

I now apologise for showing code as images displaying the embedded code using the code option did not seem to work. I had to display the Python box used in Choreograph as an image because this will not display using the code option. I have created a small personal website to demonstrate all that I have done with my robots. The web site shows all the code I have produced for my robots so far and demonstrates how I have used it. There is a lot of code there. Far to much to place on a forum. My site can be found here

POSTED BY: Terence Smith

This is marvelous, thank your for sharing! We consolidated all your comments into the original head post so it reads better. We are looking forward to more of your work!

POSTED BY: EDITORIAL BOARD

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

Hi Rohit, I did consider it. However I liked the idea of the code in some way being connected to this community.

POSTED BY: Terence Smith
Posted 7 years ago

Hi Terence,

Very interesting, thanks for sharing! Have you considered hosting your code on Github so others can collaborate and contribute.

Rohit

POSTED BY: Rohit Namjoshi

Thanks very much Divya. I would like to have put more code on the forum as I am a great fan of Wolfram Research and Mathematica. I hope I have not offended anyone in the community by placing a link to my site in the discussion above.

POSTED BY: Terence Smith
Anonymous User
Anonymous User
Posted 7 years ago

Hello, Greetings of the day This is great research you shared with us having a lot of information.

POSTED BY: Anonymous User
Posted 8 years ago

Fascinating stuff Terence. I am just starting to use Mathematica for control of external devices and your work is inspirational. Thanks for sharing!

POSTED BY: Tom Wightman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard