FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Rototation servo continues after FCS stops match.

On our robot we set up a continuous rotation servo to run when a button was pressed and stop when not pressed. The code was generated by the schematic to do this. This worked fine during the match.

The problem came when we had the button pressed to run the continuous servo when the match ended.  The servo would keep spinning.

Looking at the code it used a DC controller motor block to run the continuous servo and used the same brake type block to stop at the end of the game as it did when the button was not pressed.

Any one know a way to stop this continuous servo after the match stops in this case because the generated code isn't working quite right?

Team 7070

High Tech Hilltoppers

0 Kudos
Message 1 of 6
(8,003 Views)

Going to need some more information to figure out what's going on here.

Can you explain what you mean by "The code was generated by the schematic," ?

Is this motor code in the Teleop VI? or Timed Tasks VI?

You mentioned that the FCS doesn't stop the motor, but if you disable the robot from the Driver Station, does it stop?

Is the servo controlled similarly to the method discussed in this tutorial: https://decibel.ni.com/content/docs/DOC-14723?

Did this happen durring competition last year? Or did you find the problem this year durring testing?

The FCS should be calling the Finish VI at the end of the match, which will close all references on the cRIO then exit out any of code still running on the cRIO.

Finish.PNG

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 2 of 6
(3,976 Views)

Interesting.   There was an update two(?) years ago that deliberately prevented servos for disabling after the end of the match and I'd bet that is what you are running into with the continuous rotation servo.  Doing something like the following should fix it (but it is untested)Screen Shot 2014-01-16 at 1.35.32 PM.png

0 Kudos
Message 3 of 6
(3,976 Views)

Another untested suggestion that might work for this seasons templates. (We are not using a CR Servo currently, but I have a team that I can try this with next week).

This is assuming that the FCS puts you into 'Disabled' mode at the end of the Driver Controlled period:

Open the .vi of your 'generated code' and look at the 'Disabled' case in the Case Structure. 

I noticed that the code 'generator' only listed the 2 DC Motors on our 1st Motor Controller. We have 4 Motor Controllers, and 7 DC Motors -- so, we added the others here.

I suggest putting the BRAKE on your CR Servo here too! (or doing some other kind of asssignment to the CR Servo that would stop it)

I have attached a jpg of a sample 'Disabled' case for you to view.

You may have noticed that they have you do this (BRAKE all motors) in the 'autonomous mode.vi' template also. This is new addition to the autonomy template this season.

I'd love to know if this works so I can recommend it to the teams I have using CR Servos

0 Kudos
Message 4 of 6
(3,976 Views)

Hi

I still maintain that a timing race condition exists whereby if the Field Control software halts the teleop program too soon after issuing the disable command, then the program does not have enough time to run all the disabling code before the program exits.  If this is the case then the last commands issued to the Motor and Servo controllers will continue to run.   I see this all the time, despite all the correct code being in place to shut down the motors etc.

Can anyone in NI comment on the delay between these two actions?...

This problem is aggravated by the occasional occurance when the commands to the motor/servo controllers get lost... so it may take two full cycles to ultimately shut down the outputs.

My tests have confirmed that a program with a single control loop and several motor/servo controllers can take upwards of half a second to complete a full cycle.

Not much we can do about this other than to keep our loop times short.  But this takes some creative programming.

Phil.

Get a life? This IS my life!
0 Kudos
Message 5 of 6
(3,976 Views)

We are a rookie team, no idea if it was a problem before this year.

Using the schematic and the controller setup, press generate code for the controller for Teleop.   No changes were made to this code once it was generated.

The only way we could get it to stop was to turn the robot off.

There was a brake for the servo in the 'Disabled' case, but it didn't seem to do anything.

We plan on switching to a dc motor, for speed, so we don't need to get this working, but there seems to be a bug with this particular type of setup with CR Servos

Team 7070

High Tech Hilltoppers

0 Kudos
Message 6 of 6
(3,976 Views)