Asked — Edited
Resolved Resolved by CochranRobotics!

Programming Architecture

I have yet to buy my first one and am curious about the programming model. I can't tell if you write programs that run on the device, or run on a host that talks to the device, or both.

And I'm not sure what the platform is. It looks like a lot more powerful than an Arduino (which is slow and low memory), but I saw some post that made me think otherwise.

I want to write my own code that runs on the device and that supports my own interface to my own host where I control many other types of devices. How possible is it? Or, to do the more complicated moves do I have to use the GUI tools?


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

#1  

You write code that runs on the host and communicates to the EZ-B over WiFi. You write the code on a windows computer. For all features, you run it on a windows computer, but with some limitations, you can use the ARC software to create a mobile app that runs on Android or iOS.

There is a .NET and a Windows Universal SDK, so if you really want to write everything yourself, you can (running your app either on Windows 7 or higher using the .NET SDK or on Windows mobile or a Raspberry Pi running Windows 10.

Many developers have found the best use of the SDK is for integration, so use ARC for everything it already does well, and the SDK to communicate between your own applications and ARC to extend the functionality.

Alan

#2  

Thank you and that helped greatly. Still a little confused. Can I write code that runs on the device itself it or is that way too involved? And if I have a bigger application how do I interface to the builder? Api? Socket? Web services?

#3  

hey Stakutis, Welcome to the community.

Your code would be developed for windows, which uses the sdk to communicate with the EZ-B. The code runs on the windows machine. It communicates with the EZ-B over wifi and a TCP port. Your code doesn't run directly on the EZ-B. The EZ-B has to be tethered to a PC which runs the code.

The beauty of this design is that the PC does all of the "heavy lifting". The EZ-B is kind of like a communications port that is queried by the PC. Commands can be sent to it to use the digital, I2C, Analog, serial and camera port on the EZ-B. The EZ-B controls the hardware that is connected to these ports. This architecture allows you to then also have use of all of the capabilities that the PC has. For example, you can use API's from internet sites to do some pretty cool things. Lets say that you had a GPS I2C device connected to the EZ-B. This information would be able to be queried from the PC application, which could then go to Google Maps to get your location, directions to other locations and whatever else you want it to do. It allows your solution to become very powerful.

The SDK can be used to communicate with ARC. It uses a network port for this communication. The code can run from different machines than the one running ARC because of this. This allows you to build web services for this if you would like, or really any abstraction layer that you are comfortable building. I personally use a C# application that communicates directly to the port via an object that is available in the SDK.

I would suggest downloading the SDK. There are many examples and I believe all of them contain the connection object that you would use.

#4  

Thank you again. I've looked through lots of the documentation and downloaded the SDK and Builder and I'm still a bit confused.

Let me see if my understanding is at all correct...

The robot has some base-communication ability programmed into it and the host talks to that interface. In general, that interface "exposes" the fundamental pins and I/O's and all the joy of the internal computer. The host can set values and read values etc. And then the combination of such things makes the robot do something useful and all from the host. Is that about right?

If so, first, is THAT API at all published? Because that is exactly what I want to call and what I do for my other devices (often I have to write that interface). And I want to call this from javascript and stay in that environment.

And here is a very basic question that might help me understand overall how things work. To me, I understand that Builder allows you to specify all the connections (because you could connect any motor to any I/O) and allows you to tune the motors to specific initial settings, right?

In the videos, you show some amazing motions, such as the robot getting up off the ground. How and where is that logic? Does builder allow the user to somehow choreograph motions and record them for later play back? Or does the creator "script" each and every motor move and then get those assembled and timed correctly all in the scripting language? Is all of that motion "running" in the Host or is the host remote-calling some mini-execution environment/program downloaded to the device?

I would rather not "build" a C++ project or anything like. I'd rather call the API from my own javascript, and/or use javascript libraries that provide an interface. I'm willing to provide the latter if need be because then it fits into my overall control scheme well and I would LOVE to support this robo.

#5  

Answers are inline...

The robot has some base-communication ability programmed into it and the host talks to that interface. In general, that interface "exposes" the fundamental pins and I/O's and all the joy of the internal computer. The host can set values and read values etc. And then the combination of such things makes the robot do something useful and all from the host. Is that about right?

Answer - The robot can be communicated with directly, outside of ARC. DJ would need to give you more information on this, but yes, there is a service running on the controller that is what ARC uses to communicate with the EZ-B on. There was a post not that long ago about this and I will see if I cant dig it up for you.

If so, first, is THAT API at all published? Because that is exactly what I want to call and what I do for my other devices (often I have to write that interface). And I want to call this from javascript and stay in that environment.

Answer - some others are doing this. The other post I will look for which might provide some insight. I don't do things this way, but I remember reading that it is possible.

And here is a very basic question that might help me understand overall how things work. To me, I understand that Builder allows you to specify all the connections (because you could connect any motor to any I/O) and allows you to tune the motors to specific initial settings, right?

Answer - Yes, you can connect almost anything you would like to the EZ-B that has a Digital, Analog, I2C or serial interface. The thing that you have to remember is that the Real Time Clock isn't on the EZ-B and would have to be handled by your application. Something that requires very accurate timing (like a neopixel ring) couldn't be used directly from the EZ-B with real good success. I and others have used a serial or I2C interface to an arduino to handle this because the arduino can handle these critical timings. Another option is a PIC.

In the videos, you show some amazing motions, such as the robot getting up off the ground. How and where is that logic?

Answer - This is reading a device on the EZ-B and the logic on what to do in different situations is happening inside ARC on the PC.

Does builder allow the user to somehow choreograph motions and record them for later play back? Or does the creator "script" each and every motor move and then get those assembled and timed correctly all in the scripting language?

Answer - There is an Auto Position control in ARC which allows you to setup frames which are movements to specific locations. These frames are combined into actions. For example, stand up could have 20 frames of movements (multiple servos at one time) which are then added to an Action. You would call an action, which would run through the frames. This can be scripted if you would like to do that.

Is all of that motion "running" in the Host or is the host remote-calling some mini-execution environment/program downloaded to the device?

Answer - All of the logic is running on the PC and is sent to the EZ-B. There is no way to run any user code directly on the EZ-B.

I would rather not "build" a C++ project or anything like. I'd rather call the API from my own javascript, and/or use javascript libraries that provide an interface. I'm willing to provide the latter if need be because then it fits into my overall control scheme well and I would LOVE to support this robo.

Answer - There currently isn't a Java implementation of the API that is supported. I don't know what UniversalBot SDK would do yet as I am waiting for a couple of things before messing around with it. Let me see if I can find the other post. I will add it to the end of this post.

Post that might interest you. Disregard the majority of the post. It seems like the user got frustrated and then tried to point fingers or something. I didn't read the entire thread. If you ask, as you have seen, there are many users who will try to help or point you in a direction to get help. It looks like this guy tried and got frustrated and then left. The help had started to come in but whatever.

I do hate that I had to send you to a post that contains a very rare situation on this forum. Please don't hold it against us:)

#6  

It is discussions like this one that greatly expand my understanding of, and potential uses of, the EZ Robot environment.

Keep up the great work d.cochran.

PRO
Synthiam
#7  

Hi and welcome to the forum! The EZ-Robot approach is quite different than an Arduino/micro approach - because we work at a higher level. Assume that you want to make real robotics (such as darpa style or honda asimo, etc). You would need to develop the platform architecture which we have already developed. Leveraging the processing potential of your controlling device (ie PC or iOS/Android).

If you are a rare breed coming from micro programming, then it might be a little difficult to wrap your head around. Generally our users are either R&D facilities, newcommer hobbyists or education - with no prior micro experience.

I can, however, assure you that ez-robot will blow your mind and you would enjoy it a lot:D:D

I copy and pasted this from here: https://synthiam.com/Community/Questions/7844

Quote:

The EZ-B is dumb. It is a IoT-like device that just sits there waiting for commands. The actual program runs on your device (pc or mobile). The concept was inspired by seeing advanced robots, such as Honda's Asimo and other Darpa robots. This is because unlike all the arduino "robots" and stuff out there, those Asimo-style robots were doing amazing things! And I wanted people to do amazing things. So EZ-Robot is somewhat of a clone of the laboratory grade robotics strategy, with offloading the processing to a more powerful device to produce real robotics. This comes with a slightly different approach to programming.

Unlike an Arduino or microcontroller, you're programing the computer/mobile and not the ez-b. So every time you ask the ez-b to do something, it's being done over a wifi communication using TCP. If you're REPEAT has ez-b commands in it, then you're asking the computer to do a huge pile of work which explains why the experience is different. Once you send data to the ez-b, there's a zillion things happening - specifically the TCP protocol waiting for an acknowledgement that the ez-b has received the command.

This approach makes EZ-Script appear slow - when it is actually doing way more than python or c++ when sending a command to the ezb v4.

Now you're question could have been easier to answer if you asked something like.... "why can't I flash an led 5,000 times a second or write to a neo pixel with Set() commands like I can with Arduino in a Repeat loop?"

Well, that answer is simple and you may need to re-read my entire response again to understand. But ez-robot is not a microcontroller. You can use the ez-robot as a controller to leverage the single-use high-speed instructions of a microcontroller such as arduino, ARM or Microchip PIC.

In short, EZ-Script is very very fast and efficient - however, what you're doing with it matters, such as communicating to an ez-b v4 over a wifi tcp connection:)

The last part I need to touch on since you're asking about how programming works is threading. Notice I'm unable to do much comparison with C++ or python because the question is wrong. That's like asking what is faster, the space shuttle or a bicycle? The question doesn't make sense due to the nature of "what you are doing with it". C++ will always be "faster" but than practically anything, unless you understand how to code in assembly more efficiently than the C++ compiler can compile to opcode. This is where the problem with your question arises because it introduces programming abilities into the equation, and why the question doesn't make sense.

Many people will answer and say well obviously c++ is faster than python, but that answer is lacking real-world scenarios that make the question irrelevant in the first place. Because the space shuttle will be much slower than a bicycle if you were behind it's console:) not knowing how to drive the thing, it most likely wouldn't move... leaving the guy on the bike plenty of time to cross the finish line.

Now back to the ARC way of programming. It's process driven with a multi-threaded approach that is handled for you. This is the most important statement, because multithreaded app development which scales as large as ARC offers in C++ is an absolute nightmare that may put you in the crazy house. ARC handles the multi threading approach for you, without you needing to know anything about it... hence, saving your sanity.

Each control that you see is a separate thread. And each control shares a communication channel to the ez-b, as well as each other. The ControlCommand() is what connects controls together. But each control must run at a managed speed to share resources AND not run faster than another. So all controls are speed limited with a heartbeat that keeps them in sync. This prevents one control from dominating the CPU and leaving your robot unresponsive. So in some cases, EZ-Script or something will appear slow but that's limited by design because it means something else you're doing is causing slowness - such as maybe your computer isn't fast enough for camera tracking.

I never ever ever want to provide a microcontroller programming ability. I never want to be involved in anyone programming a micro directly. This doesn't mean I don't encourage people to - I simply do not wish to participate in teaching people how to flash an LED with arduino because there are already 25 zillion options out there to learn that. Instead, I want people to use one of the 25 zillion options and learn how to leverage Arduino to be used with ez-b. There's never been a fight between ez-robot and Arduino, because they are different things. We're the Engine and Arduino is a Wheel.

Now, don't get me wrong - just because ez-robot doesn't have a fight with Arduino doesn't mean that Arduino doesn't have a fight with ez-robot:). That's a question you would have to ask those users, even though we have absolutely nothing to do with microcontroller programming - nor do we care to. What we care about is providing the high level tools to connect Arduinos, sensors, motors, cameras, etc... together to make robotics actually do something.

I did go a little off topic, but that's a little due to your actual lack of question:) because you're question implied a lack of programming understanding means the answer is much bigger!

#8  

FANTASTIC! Now we are getting somewhere, and somewhere fun!

I think I "get it". See if I'm correct:

  • From any IP host, I can open a tcp/socket to the EZ-B port 23.
  • To start a dialog, I have to send byte 0x55
  • I then send I/O commands where are port-then-value
  • I can do do many of those
  • I ultimately close the socket

Questions that are important to me:

  • Are all the values single-byte?
  • How can I "read"?
  • You must have a full list of all the commands/ports/values...?
  • I assume the motors run near-instantly and not block
  • Thus, is there any query to know if motors are stopped/completed?
  • Is there a way to tell a motor to move forever...until I tell it to stop?
  • One of the notes say 0x55 is responded by 0x04. Are there are other responses or a full list of the dialog?
  • Does it ever send data without solicitation? Alert/error/alarm etc?

If I can get the above, I can map this completely into my open-source javascript/html robot stack. http://www.meaowmeaow.com and I would LOVE to support this. Can I get a system on short-loan? A few weeks?