Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add a new segment to an existing animation #1361

Closed
jbdesbas opened this issue Jul 9, 2017 · 8 comments
Closed

Cannot add a new segment to an existing animation #1361

jbdesbas opened this issue Jul 9, 2017 · 8 comments
Assignees

Comments

@jbdesbas
Copy link

jbdesbas commented Jul 9, 2017

Hello,

I don't understand how to enqueue segments of animation. When I put a new segment with animation.enqueue(), then the entire animation is replaced by the new segment.

Can you help me please ?

Here is my code, only the leg of the second segment is moving :

m.tap=function(tapleg){
	anim.enqueue({
		target:s.r1f,
		duration:300,
		fps:25,
		cuePoints:[0,0.5,1],
		keyFrames:[null,{degrees: 50,easing:easeInOut},{degrees: 90,easing:easeInOut}]
	});
	anim.enqueue({
		target:s.r2f,
		duration:300,
		fps:25,
		cuePoints:[0,0.5,1],
		keyFrames:[null,{degrees: 50,easing:easeInOut},{degrees: 90,easing:easeInOut}]
	});
}

Board : Arduino ProMini 5V 16Mhz (ATmega 328)
Johnny5 : [email protected]
NodeJS : v4.2.6

@dtex
Copy link
Collaborator

dtex commented Jul 9, 2017

Is it your intent that these play at the same time?

@jbdesbas
Copy link
Author

jbdesbas commented Jul 9, 2017 via email

@dtex
Copy link
Collaborator

dtex commented Jul 9, 2017

I do think you've found a bug. While I track that down, I have a tip for making this work and be a little less code too...

s.femurs = new five.Servos([s.r1f, s.r2f]); // I'm guessing these are femurs

m.tap=function(tapleg){
	anim.enqueue({
		target:s.femurs,
		duration:600,
		fps:25,
		cuePoints:[0, 0.25, 0.5, 0.75, 1],
		keyFrames:[
                     [null,{degrees: 50,easing:easeInOut},{degrees: 90,easing:easeInOut}, null, null],
                     [null, null, null,{degrees: 50,easing:easeInOut},{degrees: 90,easing:easeInOut}]
                ]
	});
}

You can group any collection of Servos any way you like so creating a femurs group for an animation like this where you're just moving all the femurs makes sense. Servos can be in any number of groups.

@jbdesbas
Copy link
Author

jbdesbas commented Jul 9, 2017 via email

@dtex
Copy link
Collaborator

dtex commented Jul 9, 2017

I really don't understand why animation.enqueue() don't add a segment after the existing one

It's a bug.

@jbdesbas
Copy link
Author

jbdesbas commented Jul 9, 2017

OK, for information, I use "PCA9685" controller for servo

@dtex
Copy link
Collaborator

dtex commented Jul 9, 2017

Cool. Just FYI, another user has had some problems with sending multiple, concurrent commands to their PCA9685. It could turn out to be an issue for you too #1340

@dtex
Copy link
Collaborator

dtex commented Jul 9, 2017

We need to check and see if there is a segment already running before call next() here

@dtex dtex self-assigned this Aug 12, 2017
dtex added a commit to dtex/johnny-five that referenced this issue Aug 17, 2017
rwaldron pushed a commit that referenced this issue Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants