Canada
Asked — Edited

Sdk Implementation

Hi DJ,

I'm hoping you can clarify/verify a few questions I have regarding the EZ IDE vs SDK implementation. Since the EZ IDE only functions off a pc, I would expect the controller will only interact with the project while the IDE is running. I realize the project and all attached scripts are not uploaded to the controller as that's the case with most micro-controller boards. So to get to my main question, if I wanted to construct a fully autonomous robot with an embedded ITX board (to experiment with a very rudimentary AI), I would probably go the route of the SDK. Ie A completely hands off approach where everything was good to go once the robot powered up. Tie it into SQL, etc. Does the EZ-B sdk raise any events beyond what is noted in the online SDK or would a continuous loop be required to monitor the state of the servos/pins by polling through the appropriate methods. I suppose even a single event indicating that something has changed on the controller would be sufficient as the read/write methods incorporated in the sdk appear to cover everything. If there's a tutorial to cover this type of scenario, please let know as I may have missed it. As always, appreciate your time.


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

Canada
#1  

I just dl the sdk and found an answer of sorts by examining the C# tutorials. So it appears that using a timer control is the common means of polling the EZ-B. Do you think you might be introducing more event triggers down the road... touch sensors for example. If they're attached as bumpers or on extremities, I could see benefit in an event trigger so you could trigger an alternative movement or play a sound (ie a plush toy being squeezed...)

PRO
Synthiam
#2  

I avoided making trigger classes events. There's a reason and i'll tell you :)

In any "master query slave" communication structure, there is a lot of thread overhead with polling to execute an event. All similar communication protocols hide the "poll" in a timer thread and execute the event. Sure, that hides the complexity from you - but dramatically increases processor and bandwith resource.

There are two types of programming:

  • Code for Programmers
  • Code for Computers

Code For Programmers This is when programmers structure the code to be read easily by another programmer. For example, using a Foreach or For statement on an array is very pretty to the programmer - it is very taxing on the processor. Additionally, hiding a polling timer to "simulate" and event is pretty for the user - terribly taxing on the processor and communication bandwidth.

I do like pretty code that doesn't require hours to change one thing, so therefore I use arrays, etc. But for some standard programming models, I like to encourage people to plan their application efficiently.

There are two methods:

  1. Timer on current UI thread This is when you simply use a Timer which runs on the current thread. When the Tick event is launched, it is local to the current thread - which makes updating controls on the forum easy. Drawback is you receive lag in your UI. Benefit is it forces efficient and optimized code. You may also witness the lag in realtime, which makes it easier to diagnose issues.

  2. Timer on another thread This is when you use an advanced timer that the Tick event is launched on a seperate thread. The advantage is the UI does not depend on the event. Therefore, your UI is responsive. The drawback is every control update on the form from this thread needs to Invoke changes. That means using RequiresInvoke and having a Get/Set method for every control. It is a lot of code, but great for the user experience.

Either choice for using timers are great. There are benefits to either. I normally use the #1 Timer on Current Thread in tutorials because I am lazy. ARC has many threads and complexity to queue events by priority and blah blah blah. But that's a complicated subject :)

#3  

Hey bullet,

I have a very good machine learning neural network setup but it's in c++ need to convert it to C# or VB.net could you help

Canada
#4  

Hey Mike,

I apologize for my tardiness in replying. I'm still taking baby steps in these areas myself (vb.net & c#) as my job deals with a lot of legacy languages. I'd like to keep the thread open as your neural network project seems like something I'd be interested in once time permits.

And thanks DJ for your reply regarding timer control utilization. I'll keep it in mind when I start experimenting with the sdk.

Bullet