Asked — Edited
Resolved Resolved by DJ Sures!

Autoposition - Dc Motors &Amp; Servos

I have to admit I have not tried the AutoPosition control. It's still a bit of a mystery to me but I plan on diving into it in a few days. I've been focused on building a 7 pound arm with 4 joints for my B9 Lost in Space robot. I've now got it working smoothly; twisting and turning and lifting the weight.

The first "elbow joint" lifts all the weight and only moves in the up and down direction. It's powered by a DC motor, feedback is a potentiometer and is controlled by a Sabertooth/Kangaroo with serial commands being sent through V4 EZB's Uart port.

The Second and third joints; The "wrist up and down joint" is powered by a servo City servo powered Gearbox. It's lifting the 3 pound claw section. The Gearbox is then directly attached to a standard servo for the horizontal wrist movement.

The last and 4th joint is the Claw "open and close" joint. This is powered by a mini servo.

So far I've just been writing crude test movement scripts with servo position and speed commands for the servos and serial Uart commands to the Kangaroo for the DC motor.

I'm wondering if I can include the serial Uart commands to the Kangaroo in the AutoPosition control to get the whole arm to move as one. I fear I'll have to build the frames in the AutoPosition for the servos and the elbow's dc motor serial movement commands in a separate script. confused

Thanks in advance for any insight into this! I'm looking forward to this challenge. Hopefully with a little help I can have this arm moving around like a snake very soon. :)


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

PRO
Synthiam
#1  

The Auto Position conyrol works with servos, it will not work with kangaroos. That sounded funny to type. No kangaroos:)

#2  

@Dave... As DJ mentioned, the auto positioner runs servos only... However indirectly, you might be able to have scripts (to control your Kangaroo) run at predetermined points as the Auto Position control runs your servo movements... Actions can run scripts so you could have an action run a servo movement and then that action can run a script (which would include your serial/Uart kangaroo code)... See the Action part of the auto positioner control to see what I mean...

#3  

Thanks guys. It's kinda what I thought. I'll probably start the DC motor moving with a script and in the same script start the Auto Position .

PRO
Synthiam
#4  

You can create a script that moves the motor into a position based upon the potentiometer (like you did with the waist of your B9). The variable that you will use to determine the position can be a Virtual servo (Any of the Vx servos).

That way the Auto Position will set the servo Vx and your script will move and monitor the DC Motor into the position.

Essentially, you will be creating a "virtual servo".

Your last option is to connect a servo PCB to a larger HBridge that moves your DC Motor with a potentiometer - and actually make it a real servo.

#5  

Sweet! Thanks DJ. :P This is just want I needed. You make this stuff seem so easy. Do you use smoke or mirrors?

PRO
Synthiam
#7  

PS, here's an idea of what your virtual servo script would look like...


:loop

waitforchange(GetServo(v0))

:innerLoop

# 0.7058823529411765 = 180 servo positions divided by 255 (8 bit adc)
$fakeServoPos = round(getADC(0) * 0.7058823529411765, 0)

IF ($fakeServoPos = GetServo(v0))
  
  # We are at the correct position so exit the inner loop
  goto(loop)
  
ELSEIF ($fakeServoPos < GetServo(v0))
  
  # Move HBridge to the right because we are less than the specified degrees
  Set(d0, on)
  Set(d1, off)

ELSE 
  
  # Move HBridge to the left because we are greater than the specified degrees
  Set(d0, off)
  Set(d1, on)

ENDIF 
  
sleep(50)

goto(innerloop)


#8  

Thanks again @DJ. Your such a help to us. Don't know what we'ed do if you started moving away from your hands on approach.

For some reason I didn't see the last post with your script till now (5 days later). It looks like just what I needed. I'm truly thankful for your help. :)