View Single Post
  #9   Spotlight this post!  
Unread 23-03-2016, 08:51
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Teleop Automated Sequences

Thank you for the screen shot. It's actually quite different from the example Mark gave. There's no way I could have understood what you were trying to do based on your previous descriptions.

Now for the second part of what I asked: what exactly are you wanting it to do, and with what timing? Give me a detailed script of which motor is supposed to run, at what power and direction, at each moment of the sequence.


Here's what I see the code doing:
  • Wait for a button to be pressed on the joystick (it might take up to 100 milliseconds for the code to notice the button).
  • Run the Kicker motor in reverse at 75% power for 100 ms.
  • Stop the Kicker motor and run both Shooter motors in reverse at full power for 1500 ms.
  • Leave the Shooter motors running and run the Kicker motor forward at full speed for 1000 ms.
  • Stop the Shooter 1 motor and leave the Kicker and Shooter 2 motors running for 100 ms.
  • Wait 1000 ms while the Kicker and Shooter 2 motors continue running.
  • Leave the Kicker and Shooter 2 motors running with Shooter 1 stopped while waiting for the joystick button to be pressed again.

Here's what I see that doesn't look quite right:
  • You have merged Mark's example with the existing 100ms loop in Periodic Tasks. That's probably okay, but it was intended to be its own loop.
  • You're continually calling the RefNum Get functions throughout the sequence. It'll work, but it's a lot cleaner (and less wasteful of CPU cycles) to do it with a single RefNum Get for each motor and tunnel the RefNum between sequence frames the way the example shows.
  • You are wiring the Error values as if to force sequential operation. I don't see anywhere that changes the code's behavior, although the Flat Sequence itself is meant to do sequencing (that's why it has the name it does).
  • Shooter 2 is only controlled once, to turn it on.
  • You are not turning off all the motors when the sequence finishes.

I don't see anything that matches your earlier mention of 5000 milliseconds.