Limelight LED not coming on

We finally got turn to target to work if we came on with a pipeline that had the leds on and we kept them on. This of course is not practical (or legal) for competition.

We are having issues turning the limelight on in the code, seems easy enough, but we have tried two different ways. one by using the ledMode in the network table, and one by having 2 pipelines on with the led on and one off and neither seems to work, are network tables asynchronous and too slow to be used inside a command like that?

Here are the couple of things we tried.
2 Pipelines

public void setLedOn(boolean isOn) {
    if (isOn){
      this.table.getEntry("pipeline").setNumber(LimelightConstants.TARGET_PIPELINE);
    } else {
      this.table.getEntry("pipeline").setNumber(LimelightConstants.DEFAULT_PIPELINE);
    }
  }

led mode

public void setLedOn(boolean isOn) {
    if (isOn){
      this.table.getEntry("ledMode").setNumber(3);
    } else {
      this.table.getEntry("ledMode").setNumber(1);
    }
  }

Called like this from our turn to target

public void turnToTarget(Drivetrain drivetrain, Shooter shooter){
    SmartDashboard.putString("turnToTarget ","Started");
    setLedOn(true);
    double turn = 0;
    double min = ShooterConstants.MIN_TURN;
    boolean check = hasTarget();
    SmartDashboard.putString("Target ","" + check);
    SmartDashboard.putString("Initial TY","" + getAngleOfError());
    if(Math.abs(getAngleOfError()) >= 3 && hasTarget()){
      turn = getAngleOfError()*0.03;     
      if (Math.abs(turn) < min){
        turn = turn > 0 ? min:-min;
      }
      drivetrain.getDrive().tankDrive(-turn, turn);
      SmartDashboard.putString("Loop TY:",this.loop++ + ":" + getAngleOfError());
    }
    setLedOn(false);
    SmartDashboard.putString("Ending TY","" + getAngleOfError());
    SmartDashboard.putString("Turning Complete","Turning Complete");
  }

The ledMode entry code looks good, that’s how my team toggles them on and off. Do you set table to a value before this? Also, are the Network Tables for ledMode updating? You can check in Shuffleboard by looking under the limelight section of the Network Table sources tab.

2 Likes

Thanks for the tip on looking up the network tables, will have to get to that next chance we get the bot back.

Should the update of the network tables and turning on of the lights be fast enough that we can use it in the same method like that, turn in on and then expect it to be able to see the target nearly immediately?

I think I read in another thread that the flush period for network tables can have up to a 100ms delay in the worst case scenario from when a value is changed to when it is written across the network.

That is nearly immediately enough for human response, but could be up to 5 scheduler loops as you’re running your command.

1 Like

So breaking out the on/off function from the turn to target I was able to turn it on and off using the ledMode table setting. I suspect we were turning it off before it had a chance to come on.

Why do you say it is not practical or legal to just leave the LEDs on for the whole match? We considered turning them on and off like you are doing, but this does introduce delay. We flush the network table when changing pipeline or LED mode to avoid the flush queue latency (I believe the default is 1000ms, not 100ms), but it still takes time for the networktable entry to get to the Limelight, the limelight to turn on the LEDs, and then the camera to adjust. Is the goal to save a little power?

I believe ( I don’t have it handy) there are rules against blinding other drivers or bots with bright lights.

You’re probably referring to R8.

R8. ROBOT parts shall not be made from hazardous materials, be unsafe, cause an unsafe condition, or interfere with the operation of other ROBOTS

In the examples, it references high intensity lights:

m. High intensity light sources used on the ROBOT (e.g. super bright LED sources
marketed as ‘military grade’ or ‘self-defense’) may only be illuminated for a brief time
while targeting and may need to be shrouded to prevent any exposure to
participants. Complaints about the use of such light sources will be followed by reinspection and possible disablement of the device.

The Limelight LEDs are 400 lumens. That’s less than a 40-watt light bulb. I wouldn’t consider them to be hazardous.

I will say that last year at champs we were forced to either unplug our limelight or toggle the lights when we were aligning by the inspectors. We never had any issues at the events leading up to champs with the lights always on.

1 Like

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