How do I fire a solenoid the second the robot gets disabled?

Our robot’s climber has arns that grab onto the sides of the HAB level 3, but they must always let go before the end of the match. Is there a way to automatically release these the second the timer runs out?
Would it be something in the code or the way it is plumbed pneumatically?

Can they be in the same position at both the start and end of the match? If so, you can use a single-acting solenoid rather than a double-acting. Then the solenoid will always reset to the same position when the robot is disabled.

1 Like

Personal advice: don’t use the timer for this. Give the drivers a button.

Better to lose points due to clamping on than to lose a robot due to dropping it before it’s ready to hold itself on L3

4 Likes

Use a single solenoid, and plumb it such that when it is on, you are grabbing, and released when off. When you are disabled the signal to the solenoid will be set to off automatically, and a single solenoid will automatically actuate to its off position.

3 Likes

Might not work if the same cylinder has to hold the clamps into Starting Configuration. Depends on the design, though.

2 Likes

Spring return cylinders will also accomplish this.

1 Like

You could also call the method to close the solenoid in the disabled() method inside of robot.java. To make sure this is only called at the end of teleop and not auto, add a boolean in teleopInit which switches to true and only call the solenoid method if that boolean is true.

Not unless the solenoid is a single solenoid. If driven by a double solenoid, the solenoid is latched, will not change state when disabled, and air pressure in the system will keep the spring return from working.

This will also not work. In disabled mode all actuators are disabled / blocked so it is not possible to actuate anything, unless the actuation has to do with de-energizing (eg single acting solenoids).

OP: you can maintain your own timer that is kicked off at the beginning of teleop so you take action at that time in the match, but note this can drift a bit from the real match clock. You can keep this from happening in practice by checking isFMSAttached(). However, as others have mentioned, there are good reasons you might not want to do this (robot falling), so I would recommend you just manually actuate it.

[begin insanity]

Take a page out of 254’s book, and point a camera at the scoring screen and use OpenCV to decode the current time. Once it hits one second, call the method.

Maybe OpenCV isn’t your cup of tea. Instead, write a program that listens via the driver station microphone for the 30-second warning sound. Once you hear it, count down 30 seconds and I suspect you’ll be able to get it activated in time.

Ok, ok, image processing and audio processing is hard. Potentially unreliable too. Perhaps writing low level hardware stuff is your cup of tea?

What you do is write a Windows network filter driver that watches all of the packets coming from the FMS to the driver station and decodes them. When you see the disabled signal coming, I imagine it takes a few milliseconds for [1] the packet to make it to the DS software and [2] for it to forward that signal to the rio and [3] for the rio to register it. If your filter driver sends off a UDP packet to your robot as soon as it sees disable, I bet you’ll win that race.

[end insanity]

Probably should just use one of the other ideas in this thread. A manual button would work nicely.

5 Likes

Back a few years, my team rigged a couple of solenoids to fire at the end of the match, regardless of driver input. (Raising a defensive/locking mechanism that probably wouldn’t be legal these days.) After driving that robot in the offseason at demos, I finally figured out how it worked, because after about two minutes of demo driving, these mechanisms just refused to work.

There was a timer in the IFI controller that we’d set up to lock the solenoids to raised position after time X. You could not undo or override that action.

1 Like

I have not used it but in the command based model there is a

WaitUntilCommand - waits until an absolute game time. This will wait until the game clock reaches some value, then continue to the next command.

At the start of the game trigger a command group.

addSequential(new WaitUntilCommand(2));
addSequential(new openClamp());

NOTE:
/**

  • Return the approximate match time. The FMS does not send an official match time to the robots,
  • but does send an approximate match time. The value will count down the time remaining in the
  • current period (auto or teleop). Warning: This is not an official time (so it cannot be used to
  • dispute ref calls or guarantee that a function will trigger before the match ends) The
  • Practice Match function of the DS approximates the behaviour seen on the field.
  • @return Time remaining in current match period (auto or teleop) in seconds
    */

I agree with Mr_Lim, I think the easiest way to do this would be to plumb up the system using a single acting solenoid (if you have one on hand). Once the robot gets disabled, it will always automatically return to it’s off position, no code required. The only issue arises is if for some reason you don’t want to release when it gets disabled, there isn’t really much you can do.

Many solenoids have a manual button which can be used to toggle open/closed.

On the CKD valves sold by andymark there is a small lever under a little door as shown in this image.

Selection_099

The Festo valves that have come in the kit have a small blue button that can be pressed with a small screwdriver:

The catch with those is that you have to be at the robot to do it. Depending on your solenoid, it may or may not hold long enough for the match to start.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.