Germany
Asked — Edited
Resolved Resolved by DJ Sures!

Ez-Sdk Sample Code For Jd :)

Hello, i am playing around with an JD-Robot and wanted to rogramm it in Linux. 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:) Thanks in advance, Patrick.


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!

PRO
Synthiam
#1  

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://synthiam.com/Products/ARC

#2  

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

Alan

#3  

Hi, @ thetechguru, thanks, just wanted to say that:)

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

PRO
Synthiam
#4  

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

Looks like he answered his own question:D

PRO
Synthiam
#5  

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



    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();
}

#6  

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

#7  

Can you pls give me a complete code?

#8  

Quote:

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

Not when I read it 4 hours ago:)

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

#9  

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