Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Ez-sdk Sample Code For Jd :)

Assistance Requested

Help patrick_c# with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

patrick_c# claims to have checked these sources:
 
#1

Hello,
i am playing around with an JD-Robot and wanted to rogramm it in Linux. And found this link:
https://www.ez-robot.com/EZ-Builder/mono
the small code works, and it print "HelloWorld" in the Terminal. But how can i make my JD move? Are there librarys, or just an sample code for movin JD would be enough Smile
Thanks in advance, Patrick.

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

OpenBot is a third party product and not supported by ez-robot. I have never actually used it, although I have seen some projects built with it. I have not seen a JD built with it because the code does not contain the Auto Position GAIT module.

If you are using Linux, I would recommend using the EZ-Mono SDK. The Mono SDK for EZ-Robot contains the Auto Position GAIT module, which will allow you to make JD walk. Here is a link to the Mono SDK: http://www.ez-robot.com/EZ-Builder/mono

#3

DJ, That is what he is trying to use. You posted the same link Patrick did.

Alan

#4

Hi,
@ thetechguru, thanks, just wanted to say that Smile

I want an sample code which moves my JD-Robot that i know how to use Mono with my EZ-Robot,
Patrick

#5

Alan, he edited the post - it was originally about OpenBot.

Looks like he answered his own question Grin

#6

To use the Auto Position, this is a cut and paste of how to move servos..

Code:



string ActionGUID1 = string.Empty;
string ActionGUID2 = string.Empty;

void InitPositions() {

// These are events from the auto positions
ezb.AutoPosition.OnComplete += AutoPosition_OnComplete;
ezb.AutoPosition.OnStartAction += AutoPosition_OnStartAction;
ezb.AutoPosition.OnStartFrame += AutoPosition_OnStartFrame;

// First we define the servos
ezb.AutoPosition.Config.AddServo(Servo.ServoPortEnum.D0); // 0
ezb.AutoPosition.Config.AddServo(Servo.ServoPortEnum.D1); // 1
ezb.AutoPosition.Config.AddServo(Servo.ServoPortEnum.D2); // 2
ezb.AutoPosition.Config.AddServo(Servo.ServoPortEnum.D3); // 3

// Add a frame. The number of positions must match the number of servos. First position is for the first servo, second position is for the second servo, etc..
// In this example, this frame sets all servos to position 90
string frame1 = ezb.AutoPosition.Config.AddFrame("Frame #1", new int[] { 90, 90, 90, 90 });

// Now we will add more frames...
string frame2 = ezb.AutoPosition.Config.AddFrame("Frame #1", new int[] { 70, 20, 40, 10 });
string frame3 = ezb.AutoPosition.Config.AddFrame("Frame #1", new int[] { 170, 140, 80, 160 });
string frame4 = ezb.AutoPosition.Config.AddFrame("Frame #1", new int[] { 20, 70, 150, 100 });

// Create an action by assigning a bunch of frames to it.
// Rather than a frame being assigned to an action directly, it gets wrapped in an ActionFrame which allows you to specify parameters
// the parameters are Delay, Steps and Speed
// The Delay is how long in MS to delay between steps
// The Steps is how large of a step to take (1 moves the servo 1 position per step, 2 moves the servo 2 positions per step, etc..)
// The Speed is how fast to set the ServoSpeed. A -1 means do not change the speed. 0 means move the speed to 0, etc...
ActionGUID1 = ezb.AutoPosition.Config.AddAction(new EZ_B.Classes.AutoPositionAction(
"Test Action 1",
true,
true,
new EZ_B.Classes.AutoPositionActionFrame[] {
new EZ_B.Classes.AutoPositionActionFrame(frame1, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame2, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame3, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame4, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame3, 35, 1, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame2, 35, 1, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame1, 35, 1, -1),
},
EZ_B.Classes.AutoPositionAction.ActionTypeEnum.NA));

// Let's create a second action
ActionGUID2 = ezb.AutoPosition.Config.AddAction(new EZ_B.Classes.AutoPositionAction(
"Test Action 2",
true,
true,
new EZ_B.Classes.AutoPositionActionFrame[] {
new EZ_B.Classes.AutoPositionActionFrame(frame1, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame3, 25, 3, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame3, 25, 5, -1),
new EZ_B.Classes.AutoPositionActionFrame(frame2, 25, 5, -1),
},
EZ_B.Classes.AutoPositionAction.ActionTypeEnum.NA));
}

void AutoPosition_OnStartFrame(AutoPosition sender, EZ_B.Classes.AutoPositionFrame frame, EZ_B.Classes.AutoPositionActionFrame actionFrame) {

Console.WriteLine("Frame {0} (Steps: {1}, Speed: {2}, Delay: {3})", frame.Title, actionFrame.Steps, actionFrame.ServoSpeed, actionFrame.Delay);
}

void AutoPosition_OnStartAction(AutoPosition sender, EZ_B.Classes.AutoPositionAction action) {

Console.WriteLine("Action Started: {0}", action.Title);
}

void AutoPosition_OnComplete(AutoPosition sender) {

Console.WriteLine("Action Stopped");
}

void StartAction1() {

ezb.AutoPosition.ExecAction(ActionGUID1);
}

void StartAction2() {

ezb.AutoPosition.ExecAction(ActionGUID2);
}

void StopAction() {

ezb.AutoPosition.Stop();
}

#7

Thanks, but when i try to compile it (gmcs HelloWorld.cs) there is an error:
HelloWorld.cs(2,0): error CS1525: Unexpected symbol `string'

#8

Can you pls give me a complete code?

#9

Quote:

Alan, he edited the post - it was originally about OpenBot.



Not when I read it 4 hours ago Smile

Maybe you opened it in a tab and only got to it after an edit? That sometimes happens when I am reading a bunch of new posts.

Alan

#10

@ DJ Sures,
can you please me an complete code for moving my robot? Not only pieces of it? *confused*