
Mickey666Maus

Hey guys, I was trying to script some animation for my robot...trying to figure out how to make smooth animations which will run correctly timed and without getting jumpy servos!
I experienced that my script is running smooth if it is the only thing running, once I start the camera the movement gets really choppy/jumpy...is this because the camera takes too much bandwidth, is the communication to the board being flooded? It does not happen if I use the Laptops Webcam!
How do I workaround this?
Is my approach of scripting animation wrong? My idea was to animate 30FPS and point out the specific servo position for every frame, followed by a pause...
like this
ServoSpeed(D8,0) ServoSpeed(D6,0)
Servo(D8,39.417) Servo(D6,96.2251) Sleep(33.3333) Servo(D8,35.6368) Servo(D6,99.7181) Sleep(33.3333) Servo(D8,30.7226) Servo(D6,104.559) Sleep(33.3333) Servo(D8,25.8083) Servo(D6,109.944) Sleep(33.3333)
etc...
@fxrtst Any and all ideas welcome, thanks.
@Mickey666Maus
That's good to hear since it may take a few revisions in the software and what goes into the control string before it all works satisfactorily. Yes. However, you could make all the movements from keyframe to keyframe absolute if that is easier. It's up to you. Yes, that seems right.The need for knowing where a given servo is as it is moving from one position to another is one that cannot be fulfilled with the EZB servos. At least not without modifications. This is because there is no feedback available to tell where the servo is at any given moment in time as it is moving. Any sleep time you put in is, at best, a guess. You could calculate about what it may be, based on whatever servo Speed is currently programmed in. Additionally, the maximum rate at which the servo can move is also affected by whatever load is on it. That load can even change as it is moving. As mentioned before, the actual time a sleep timer takes to execute can vary a lot, especially at small times. I think, however, that the longer the sleep period, the more accurate will be the timing. A 250ms time will be more accurate than a 33ms time, and a 500ms time more accurate still.
Fundamentally, there is no easy way to pinpoint how long it will take for a given servo to move a given distance. Therefore the sleep period needed for it to do so has to be an estimate with a bit extra thrown in to be sure enough time is allotted to the action, even in varying conditions.
Some other ideas I had on this method would be to allow for things like running Frames or Actions from a Auto Position control via additional commands to the reader. For instance, to run an Action is basically done with a Command control. Such as: CommandControl("Auto Position", AutoPositionAction, "Bow") (From JD). To make this a command in the string could be done like this: "C|AP|Auto Position|AutoPositionAction|Bow" This Could be handled in EZ-Script something like this:
Unfortunately the command in the Command Control for the Auto Position control can't be a string like the other arguments, so we have to spell out each possibility in an If-ElseIf list. The same method can be used to run scripts. Likewise to run Say and SayEZB commands. No doubt many other useful Script commands as well.
Finally, it occurred to me that the commands could be made board (connection) dependent as well by using the same notation as is normally used to select a specific board when specifying a servo instruction for example. This is done in the Script by prefixing the board number on the servo port. Such as: Servo(1.D0,100) to send that instruction to whatever is being accessed through Connection 1. I'll leave out that level of complexity for now though. As well as leave out the Command control additions for now.
Sounds good to me.@WBS00001 After a night of sleep and my morning coffee something else crossed my mind... 3ds max only knows the absolute position of the servos at any given keyframe, so I would need to calculate the relative positions according to the absolute position to run the script properly! This could also be done in 3ds max but I would surely have to grind my brains to get it coded right, so it would be of great help if this could be implemented in the code you gave me!


@fxrtst Giving readable motion to my robot is what I am aiming for...of course any other way to create or transfer motion is of interest to me! The most believable gestures are those ones resembling our own motion, those are the ones which will draw us emotionally closer to the animated object! Good timing and knowing how motion works is the key!
I also want to transfer Mocap data to my robot, either way directly wired or just animating it by hand and using the Mocap as a reference, lets see...
I came across a good TED Talk a while ago which describes what I am trying to achieve!
@WBS00001
This would be awesome...3ds max obviously only stores the absolute position in every frame, I guess there are other options but this could end up getting messy on my side! I am superslow at scripting!And yes, this is what I hope for using your method...longer sleep periods to equal out variations which could cause erratic servo movements!
Anything that would let me run other scripts from within this movement script would be highly appreciated!
To address different boards would be a good aim for the future, e.g. for those that might have an InMoov or any other type of robot using a bunch of servos!
Thanks man, you are awesome, this is great help!
@Mickey666Maus
That's not a problem. Just use the absolute position notation for every frame. That is to say, the notation which uses the Vertical Line Character. Such as: D0|10 or D1|35. Don't bother with the relative notation at all. That way every position change will be an absolute position automatically. No modification to the code will be necessary.Using the previous example: D0|10, D1|30, S+1000, D0+10, D1+15, S+1000, D0-10. Would instead be: D0|10, D1|30, S+1000, D0|20, D1|45, S+1000, D0|10.
Either would make the servos move in the same pattern. Also, if you find it more convenient, the S+1000 (Sleep) notation could be S|1000 instead to make it more like the servo notation. That would be a very easy change. Just let me know.
Just read your latest post. You are quite welcome. I enjoy the challenge. Programming is my thing. If it becomes necessary I can also create Windows programs outside of ARC for specialty functions. So far I don't think that will be necessary, however. Especially since DJ has made changes to how the scripts are executed that has sped them up considerably. So, even though a given script may seem lengthy, it will still execute fast.
Feel free to ask questions any time.
@WBS00001 Thanks a lot, this should work like a charm!
I was at work until now and will be traveling to Berlin tonight where I will stay for a little over than a week, but this got me really excited...so I figured as I will be taking my laptop anyways, I could also just take the EZ-B with me to do some testing!
I will let you know how it goes!
Actually it would be of great help if you could take a look at the terrible coding I did to connect 3ds max to ARC, there is still some stuff that I would want to change...since I had trouble putting my variables in a string and reading them back out, I had to manually spell them out one by one. Also I guess there is a lot of stuff that could be improved.
I could share my code here, or if this would be too off topic I could also send it to you directly?
Great help! Should I leave the red lantern hanging for a bit or just close this as resolved!
@Mickey666Maus Sure, no problem, I'll be happy to look at your code.
Probably the best thing to do is close this thread and start a new one with a name more descriptive of what you are doing now. In fact, I'll just do that now. I'll call it Robot Design and Control Using 3ds Max and ARC and I'll put in a link to this thread. You can close this one. Then you could start things off by putting your 3ds code in the next post in the new thread. Perhaps also a description of how it is supposed to work.
@WBS00001 Was on my way to Berlin Yesterday....good idea to re-open! I will close this one and see you over at the other thread!
Thanks again for all the support!