Asked — Edited
Resolved Resolved by DJ Sures!

Virtual Servos On Second Or Third Ezb?

Can we have virtual servos assigned to more then one EZB in a project? I'm trying to run a script pointing to watch a virtual assigned to a second EZB in my project. I get the following error:


Start
1: :start
2: WaitForServoMove(1.V1)
> Error on line 2: Missing String Quotes or Invalid Expression at index 1: .V
Done (00:00:00.0468763)

Here's my script:


:start
WaitForServoMove(1.V1) 
$ElbowPos = GetServo(1.V1)
#Commands for moving motor to position and
#speed based on the variable contents.  I'll
#emulate with print commands.
print("The Elbow position is " + $elbowpos)
sleep(150)
goto(start)


ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

#1  

Since they are virtual, I don't think assigning them to a specific EZB makes sense. I am away from my computer, so can't check, but I think there are over 100 virtual servos so you shouldn't run out.

#2  

OK, here's what I'm doing and finding out:

I want to trigger a DC motor that has feedback from a pot to move to a certain position through the Auto Position control. This motor is controlled with serial commands through a Uart port (through a Kangaroo X2) on EZB board 2 connection in ARC.This motor is part of several servos in my robot arm. All these servos and the DC motor is connected to the third EZB (board connection 2) in my robot. I'm trying to control all the servos and the DC motor with a AutoPosition control.

I've got a Virtual servo set up (V1) for the DC motor in the AP control along with the other 3 actual servos built into this arm. This AP Control is pointing to #2 EZB board connection because all the servos in that arm are connected to the third EZB.

I've also got a regular Vertical servo Control set up in the project pointing to this V1 virtual servo on board 2.

When I move the frame in this AP control I can see the other regular Vertical servo control assigned to the board 2, V1's value change so I know it's working.

However when I try to write a script pointing to the V1 servo (2.V1) on board 2 I get the error you see in my first post.

If I just write the script pointing to V1 (with no board designation) I get no errors. However the script does not see the position change on the board 2, V1 in the AP control when I run the frame.

Could it be that scripts being able to see virtual servos in AP controls running boards other then 0 is not supported? tired

#3  

Dave, if you re-read the post with my example, I point out that you can insert scripts directly into frames, so rather than using my script example that listens for the virtual servo position, just put the script statement right in the frame itself. (I would still use the virtual servo in the frame just to remind myself what I am having the script do, but it isn't actually required).

Let me know if this doesn't make sense and I will throw together another example.

Alan

PRO
USA
#4  

Dave,

1) Virtual Servos are associated to an EZB board.

When the code below is executed:


Servo(V1, 90)

the V1's position is stored in EZB[0].

  1. if your virtual servo is in EZB board 1, you need to address using the board prefix:

Servo(1.V1, 90)

  1. your code is correct:

WaitForServoMove(1.V1) 

it seems an EZ-Script Regular Expressions Parser Error/Bug.

@DJ: I think the regular expression is doing a partial group capture Please confirm if my assumption is correct.

#6  

Thanks guys!

@PTP, It's good to know the script is correct. It's Alan's script that he had shared with me so I was pretty sure it was OK. I just added the designation of the second EZB board. I got the error after I changed the board designation. Thanks for the confirmation. It's good to know a pro has my back. ;)

@DJ, Thanks for being open to having a look at this. I know you have a billion things going on. This may seem like a little thing but it will be good to both have things work in EZ Script as expected and also to have my selfish needs satisfied. LOL :D

@Alan, your continued help and advice is very welcomed and appreciated. Your nickname "thetechguru" is well deserved. Your explanation make perfect sense. Once I started writing/copying your scripts and setting up the AP control a light went on in my head and it was clear what you were trying to show me. Thanks again. I don't think there is any need for you to go to the trouble to make another example for me. Feel free though if you think it will help others.

I can see several ways to get this DC motor to work. Up until now to get my DC motor to move along with the other three servos in the AP control moving the arm I've placed it in a EZ script and created an Action from the frames found in the AP. A EZ Script for a movment would look like this:


#################################################################################
#Pair  AutoPosition frame(s) along with Command
#to start Move_Rt_Elbow Script below. State any Position & Speed values to set 
#Variables with each Move_Rt_Elbow CC so that script knows position & Speeds. 
#Pick any value between hi and low. Each pair makes an action.
#
#Elbow Kangaroo Values: 
#Position Varable is - $Rt_Elbow_Position ->  p3000 -Full up, p2468 -Center, p1885 -Full Down
#Speed Variable is - $Rt_Elbow_Speed -> s2000 -Full Speed, s0 -Dead Stop
###################################################################################
#---------------------------------------

##Start Auto Frame arm movements

$Rt_Elbow_Position = 3000
$Rt_Elbow_Speed = 800
Sleep(50)
ControlCommand("Amanation Arms", ScriptStart, "Move_Rt_Elbow")
Sleep(500)
ControlCommand("Auto Right Arm", AutoPositionFrame, "Attack, Claw Open", 25, 4, 0)

Sleep(4393)

#---------

$Rt_Elbow_Position = 1800
$Rt_Elbow_Speed = 2000
Sleep(50)
ControlCommand("Amanation Arms", ScriptStart, "Move_Rt_Elbow")
Sleep(300)
ControlCommand("Auto Right Arm", AutoPositionFrame, "Center", 25, 20, 0)

Sleep(1099)
#---------
$Rt_Elbow_Position = 2850
$Rt_Elbow_Speed = 2000
Sleep(50)
ControlCommand("Amanation Arms", ScriptStart, "Move_Rt_Elbow")
Sleep(300)
ControlCommand("Auto Right Arm", AutoPositionFrame, "Reach to Collar, Claw Open", , 25, 3, 0)

#--------------

$Rt_Elbow_Position = 2000
$Rt_Elbow_Speed = 800
Sleep(50)
ControlCommand("Amanation Arms", ScriptStart, "Move_Rt_Elbow")
Sleep(50)
ControlCommand("Auto Right Arm", AutoPositionFrame, "Attack, Claw Open", 25, 40, 0)

And so on.... Kinda clunky and I had to manually time the movements with sleep commands between frames. I had hoped by using Virtual servos and the Action feature of the AutoPosition control I could do away with the timing sleep() commands and let the AP do all that.

Now what I suspect I'll do if I don't use virtual servos in the AP Frame for the DC motor is just place the ControlCommand to start the script to move the elbow motor ("Move_Rt_Elbow", located in an outside script from the AP for threading purposes) in the AP frame script. This script sends the serial command for elbow position and speed to the Kangaroo X2 and Sabertooth to move the Elbow's DC motor.

I still need to decide if I want to use the Action feature of the AutoPostion control for stitching together multiple frames or script them in outside scripts like I posted just above. I'd love to just use the AP and EZ Script actions.

Looking over my EZB's I do see I have six Digital ports open on EZB - 0, If DJ can't get to this issue anytime soon, I could just move the six arm servos attached to EZB - 2 over to EZB - 0. That would solve not being able to have a EZ Script see a virtual servo running on a second or third EZB. However I really did want to keep my arms running off their own EZB because EZB - 0 is almost full. The second EZB the arm servos are connected to gives me the extra ADC and Uart ports I needed. I don't really know if there is any other benefit or penalty running the arms off a separate EZB Ver4/2 other than that.

Thoughts or suggestions? :)

Thanks again everyone!:)

PRO
Synthiam
#7  

It'll be in the new year, next week.

PRO
USA
#9  

Happy Winter Solstice... We are officially on winter.

@DJ,

Thanks for the fix. I'm working in a project and i will use the Virtual Servos. i'll do an open source custom plugin similar to the Dynamixel, i hope can help demo the SDK api methods.

@Dave,

Thanks for the kind words, although i don't feel like a pro, i'm not working for the Google Brain project:)

Alan is the man... When i grow up i would like to be like him:) patient and one thing at a time... I do multitasking and sometimes i miss simple things, going then for the big issues.

Thanks Alan

#10  

OK, I spent the afternoon moving all my robot arm servo and UART connections from EZB - 2 to the EZB - 0. I then spent a long time rewriting scripts pointing to the changes. My thinking was that it would be much more easy to code and keep things straight if everything was running off of EZB - 0. Seemed like the best thing to do considering I wanted to start using virtual servos and watch them with EZ scripts.

Well, this all sounded good on paper and in my head. As it usually turns out in this robot build of mine, reality is very different. Once I moved it all over I found lots of electronic squealing in my sound system attached to EZB - 0 when motors moved, jerky servos and general oddities all over including the voice neon flashing randomly. I took great care to balance and isolate my power supplies between the sound systems, motor systems and lights making sure the EZB's were on the same power systems as the things they controlled. The idea was to keep this electronic interference from happening. I guess I locked myself into using a separate EZB with the arms of my robot. Once I moved everything back to EZB - 2 and retrieved my old saved project all was right with the world again.

Now my two choices are to go back to the way of writing scripts as shown above to move the DC elbow motor along with the AutoPosition frames or just wait for DJ to look into this possible bug. I'll Probably do both. ;) I really want to see both my B9 robot arms waving around together as a set. :D

Enjoy the holidays! Relax and have fun! :P Happy building.

PRO
Synthiam
#11  

The bug is fixed and scheduled for the New Years release. It's a gigantic update for 2017. I do not recommend changing your build today to compensate. Hold off and you'll be happy in the new year.

#12  

Thank you DJ. All I can say is you're amazing. I don't know how you keep from getting too full of yourself with all you do and achieve. You're like a superhero! :)

Do you need a beta tester for this release? I'll happily do a little testing for you if you send me a copy of the new upgrade. ;)

#13  

I just found the update to EZ Robot with this support upgrade. Thanks so very much! :D:D

#14  

Virtual servos are working great now on other EZB's besides the first one. Thanks again!