Adding Scripts To Autoposition Frames

 
#1

Just to set up this conversation; the way I've learned the AutoPosition control it's basic setup is:
*You set an image of your robot.
*Create a frame and name it.
*In this Frame you add servos (or virtual servos) to each joint needing control.
*Then in this frame you move the wanted servos with the port setting to the needed positions and, thus pose the robot for a single movement.
*Hit the save button in the lower left corner.
* Then you repeat by making and naming a new frames and create a new single movement poses.
*Now you should have a set of different poses called Frames.
*Next to create a fluid dance; In the Action tab you then string the single frames together you created for each pose into the fluid moment or "Action" your looking to create.

Now my question; Can I add a script to each Frame I make?
Considering there are two different sections of the AP control to create movement (Frames and Actions), I was under the impression that we could add a script to each frame in a AutoPosition control. I can only find a way to add scripts to each Action in the AP control. I also found in the Settings tab a way to add a script to run when the entire AP starts to move and also run another script when it stops.

I ask this because I am trying to control a set of arms on my robot with a single AP control. Each of the two arms consists of 3 servos and a DC motor (DC motor has feedback to a Kangaroo X2 using a EZB Uart port and simple serial commands). I'm trying to control the DC motors in the AP by assigning a Virtual Servo to each of them in each Frame I create. I have a script written that watches these Virtual Servos to start moving. I then reads the position and then sends the speed and position serial commands to the Kangaroo so it (and the Sabertooth) can move the DC motor. I have this script running, watching and waiting for a Virtual Servos move but have it located outside the AP in an EZ Script. This complicates the settings for multiple moves to different positions of the DC motor and I'm having trouble conceiving a method or script that would let this one script located outside the AP frame transmit different position and speed settings to the Kangaroo. If I could attach a single script to each Frame in this AP I could place the position and speed commands for the Roo in there. I'm really hoping to use virtual servos for these DC motors and let the AP time them along with other hoped for benefits.

Am I missing something here or is there a better way to do this? Thanks in advance Smile

#2

User-inserted image

#3

OK, I guess I did miss something. Woops! Great news! Off I go down to the robot lab.
Thanks! Grin

Just to be clear; I need to start to create an Action before I can add a script to a single Frame?

#4
#5

@Dave,

This is what I was talking about when I said that the script example I created for you was not actually needed since you can attach a script to each frame. Initially I thought you could only attach a script to the entire action, but while I was investigating the virtual servos I found the script setting in the frames.

Alan

#6

Thanks gentlemen. Your guidance is appreciated and welcomed. I totally missed the entry point where I can attach a script to a single frame that DJ pointed to above.

Alan, your help with my education and examples of using virtual servos makes more sense now. I guess I just need a pointing finger once in awhile. It's slowly sinking in and I'm working through this new concept (new to me anyway. LOL). Smile I couldn't have gotten this far without you guys. Winky

#7

Quote:


I totally missed the entry point where I can attach a script to a single frame that DJ pointed to above.



I have made dozens of auto-actions, and I only noticed it when I was trying to make the sample for you. I think it is because it is only accessible when you add the frame to the action, not when you create the frame, so it is not totally intuitive.

Alan

#8

@djsures
It's a great feature having script per frame!

I'm using it to "move" JD's eyes via RGB animator when autoposition control is moving his head in a scanning action

Frank