Results 1 to 10 of 10

Thread: Controlling Dynamixel with Arbotix Commander

  1. #1

    Controlling Dynamixel with Arbotix Commander

    I,m trying to control one AX12+ Servo attached to an Arbotix Robot Controller through an Arbotix Commander Joystick. What I want to do is to use the values of the Joystick (-100 - 100) to move the servo back and fourth with different speed according to the value of the Joystick. My problem is, that I have no Idea how to do that. Can anybody help me doing this? I would be very thankful for any demo code.

  2. #2
    Join Date
    Feb 2010
    Location
    Silicon Valley, CA
    Posts
    321
    Images
    1
    Rep Power
    41

    Re: Controlling Dynamixel with Arbotix Commander

    What type of joystick do you want to use?
    As far as example of code goes, there's commander.py on ArbotiX website. It should get you started.

  3. #3
    Join Date
    Dec 2007
    Location
    Portland, OR
    Posts
    3,198
    Images
    952
    Rep Power
    141

    Re: Controlling Dynamixel with Arbotix Commander

    He's using a Commander and Arbotix, so I assume he's talking about the Commander's joysticks providing input to the Arbotix via xbee connection/Commander protocol. Shouldn't be any Python involved as this is Commander >> Arbotix interaction.

    This code could be a bit more compressed, but I feel it self-documents pretty well. This controls an Arbotix based pan/tilt using a single joystick from a Commander.

    Code:
    #include <Commander.h>
    #include <ax12.h>
    #include <BioloidController.h>
    
    BioloidController bioloid = BioloidController(1000000);
    Commander command = Commander();
    
    int rjoypan;
    int rjoytilt;
    int panservo;
    int tiltservo;
    
    void setup()
    {
    
      // setup serial
      Serial.begin(38400);
      SetPosition(1,512);
      SetPosition(2,512);
      delay(3000);
    }
    
    void loop()
    {
      if(command.ReadMsgs() > 0)
      {
        rjoypan = command.lookH;
        panservo = map(rjoypan, -128, 128, 0, 1024);
        rjoytilt = command.lookV;
        tiltservo = map(rjoytilt, -128, 128, 0, 1024);  
        SetPosition(1,panservo);
        SetPosition(2,tiltservo);
      }
    }
    Last edited by DresnerRobotics; 01-02-2011 at 11:57 AM.

  4. #4

    Re: Controlling Dynamixel with Arbotix Commander

    Yes, exactly that I was searching for! What exactly does the instruction map? Is there any documentation about?
    thanks a lot for your help!

  5. #5
    Join Date
    May 2008
    Posts
    2,228
    Images
    155
    Rep Power
    127

    Re: Controlling Dynamixel with Arbotix Commander

    Quote Originally Posted by Buell24 View Post
    Yes, exactly that I was searching for! What exactly does the instruction map? Is there any documentation about?
    thanks a lot for your help!
    http://www.arduino.cc/en/Reference/Map

    -Fergs

  6. #6

    Re: Controlling Dynamixel with Arbotix Commander

    Thank you for the documentation.
    I saw, that the instruction “map” is only to convert the data of the joystick. But that isn’t what I want to do.
    I’d like to control the speed of a servo using the value of the joystick. So that I can move the servo very fast and also very slow and precise. The value of the joystick should not be the absolute position.
    I think of a use like this: I want to reach a target with a pan/tilt cannon. The target is far away (in degrees). So I can make a full-scale deflection with the joystick to get very fast in the near of the target. Then I can go back with the joystick to move very slowly and precise over the target.
    Is something like that possible?

  7. #7
    Join Date
    Jul 2008
    Location
    South Sphincter Idaho
    Posts
    613
    Images
    104
    Rep Power
    68

    Re: Controlling Dynamixel with Arbotix Commander

    I don't know anything about these servos, but with hobby servos, it would be as simple as using the second joystick on the Commander, convert the position reading to a speed setting for the servo, and send it to the servo. I do something similar with my mech, but use a button to determine which speed setting it transmitted to the servo. The pan/tilt settings just work normally but at different speeds.

    Gary
    Team Maggot---Mechs. "Bheka" (retired), "Maggot Mk.3(A)"
    " Keep your stick on the ice ".... Red Green

  8. #8
    Join Date
    Dec 2007
    Location
    Portland, OR
    Posts
    3,198
    Images
    952
    Rep Power
    141

    Re: Controlling Dynamixel with Arbotix Commander

    Sounds like you're looking for some code that doesn't directly control the movement and won't auto-center.

    Try replacing your main loop with something like this:

    Code:
    void loop()
    {
      if(command.ReadMsgs() > 0)
      {
        panservo += - command.lookH/20;
        tiltservo -= - command.lookV/30;
        SetPosition(1,panservo);
        SetPosition(2,tiltservo);
      }
    }
    This will move the servo more quickly the further away from the center it is.

  9. #9

    Re: Controlling Dynamixel with Arbotix Commander

    Yes, that I was looking for. Can you tell me how the method SetPosition calculates the speed? Is there an interpolating routine behind? Is there no way to directly set a current speed to the servos?

  10. #10
    Join Date
    May 2008
    Posts
    2,228
    Images
    155
    Rep Power
    127

    Re: Controlling Dynamixel with Arbotix Commander

    Quote Originally Posted by Buell24 View Post
    Yes, that I was looking for. Can you tell me how the method SetPosition calculates the speed? Is there an interpolating routine behind? Is there no way to directly set a current speed to the servos?
    There is no speed control in SetPosition -- the servo will move as fast as possible to the desired location. By calling SetPosition over and over again with small incremental changes, we can approximate moving at a slower speed.

    There is a higher level interpolation system built into the BioloidController library -- using poses, see the ArbotiX wiki.

    There is also speed control on the AX-12s -- but you sacrifice torque to move at slower speeds. You'll have to do a "ax12SetRegister" command, see the ArbotiX wiki + AX12 datasheet.

    -Fergs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) Controlling AX or RX servos using arbotix
    By darkback2 in forum Software and Programming
    Replies: 34
    Last Post: 11-11-2011, 10:05 PM
  2. ArbotiX ROS Package 0.3.0
    By lnxfergy in forum ROS - Robot Operating System
    Replies: 233
    Last Post: 02-06-2011, 11:36 AM
  3. Question(s) A question about Arbotix python library
    By zzl1007 in forum Arbotix, Microcontrollers, Arduino
    Replies: 18
    Last Post: 11-24-2010, 02:18 PM
  4. Question(s) Newby Arbotix hassles
    By Slugman in forum Robot Computers
    Replies: 29
    Last Post: 11-15-2010, 08:52 AM
  5. Question(s) Arbotix Commander
    By elaughlin in forum Robotics General Discussion
    Replies: 2
    Last Post: 10-24-2010, 12:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •