Lining up with tape on ground for new game?

Since this year FIRST decided to have the reflective lines on the ground, our team is going to try to take advantage of that and use mecanum wheels to precisely line up with the line. Our only problem is to program the line tracing. I haven’t found any good cameras or good documentation on how we would try and line up with said line. Anyone have any ideas?

The tape on the ground is not retroreflective. It’s just common gaffers tape. In regards to tracing the line, I’d say maybe look at the PixyCam2 as a camera. It certainly seems fairly capable for the purpose. As for code, take a look at this. It’s designed to use OpenCV on a raspberry Pi, but I’m sure you can adapt it to the robot

I’ve seen docs on using opencv or other vision systems along with wpilib so we could work with that. Thank you!

Look at using 3 line sensors. This exact thing was a challenge for autonomous in 2011.

https://www.chiefdelphi.com/search?expanded=true&q=before%3A2012-01-01%20line%20follow%20track

also see: Line tracker Sensor 2019?

Provided you have sensor layout as follows (where the "o"s represent sensors in the direction of travel):

------------------------------------
|            o | o | o              |
|                                   |

To get to follow line (provided line is activating ANY sensor, sensors need to be suitably close together):

  1. Read sensor values in as a binary number from left to right (i.e. the leftmost sensor is in the “hundreds place”, middle in the “tenths place” rightmost in the “ones place” )
  2. Pipe that binary number into a switch/case statement
  3. a) If output of binary is [100] speed up right side of drivetrain slightly, if binary is [010] drive train as normal, If output of binary is [001] speed up left side of drivetrain slightly, if binary is [000] or [111] stop robot (off of line completely or sideways to line), if binary is [101] stop robot (erroneous input)

In pseudo code:

    array line = new array[3]
    while (alignButton.state()) {
        int leftDriveAccumulator = *left forward input*    // you will want these inputs to be as equal as possible
        int rightDriveAccumulator = *right forward input*
        line[0] = lineLeftSensor.get()
        line[1] = lineMiddleSensor.get()
        line[2] = lineRightSensor.get()
        switch(arrayToBinaryNumber(line)){
            case 100:
                leftDriveAccumulator += .10
               // robot needs slight right turn
            case 110:
                leftDriveAccumulator += .05
               // robot needs very slight right turn
            case 001:
                rightDriveAccumulator += .10
               // robot needs slight left turn
            case 011:
                rightDriveAccumulator += .05
               // robot needs very slight left turn
            case 010:
                // robot is straight
            case 000:
                leftDriveAccumulator *= 0
                rightDriveAccumulator *= 0
               // robot is not sensing a line to follow, stop machine
            case 111:
                leftDriveAccumulator *= 0
                rightDriveAccumulator *= 0
               // robot is sensing a line sideways, stop machine
            case 101:
                leftDriveAccumulator *= 0
                rightDriveAccumulator *= 0
               // robot is sensing erroneous input, stop machine
           }
    drive.tankdrive(leftDriveAccumulator,rightDriveAccumulator)
    }
4 Likes

If using line sensors, make sure they’re good for the ground clearance your robot will have. Many are only good for a small fraction of an inch (e.g. 1/4"), which is likely much less than the ground clearance you’ll want.

^^^. Using a camera to detect the lines is overkill. Line sensors will suffice.

Would it work? we have already ordered limelight.

No reason why a camera shouldn’t work, especially if you’re offloading the big processing. One advantage you’d have with a camera is that you can see not only where the line is, but what its orientation is (straight on, 30 degrees to left, 40 degrees to right, etc.). Added: that said, you may want to use the limelight in look-forward mode so you can use it to detect the retro tape as well as the line on the floor.

1 Like

Our team is also looking to follow the lines to the drop-points using sensors, and we are indeed having difficulty finding sensors with a longer range (for more ground clearance). Do you have any suggestions of suitable sensors? Or is camera the only option if we don’t want sensors a fraction of an inch off the ground?

The XL version of the Pololu QTR sensors might be useful then (with a range up to 80mm). I’m probably going to order a couple to test

Whoops, direct link here: https://www.pololu.com/product/4541

1 Like

I suggest these sensors - they were used in 2011: Allen-Bradley 42EF-P2MPB-F4 RightSight Photoelectric Sensor, 10.8-30V DC, 3m, A
(2011 KOP description: “photo sensor”)

https://www.plchardware.com/Products/RA-42EF-P2MPB-F4-A-NSS.aspx?gclid=Cj0KCQiAsdHhBRCwARIsAAhRhsnsd920RjgIxSFD0Qg7TnqcOj7vd0QArn432FHgRF2oK3OMrivN9N0aAh15EALw_wcB

Mfr. Part Number:
42EF-P2MPB-F4

https://ab.rockwellautomation.com/Sensors-Switches/General-Purpose-Photoelectric-Sensors/RightSight-Sensors#selection

Here is the list of similar PNs:
https://configurator.rockwellautomation.com/#/validate/42EF-P2JBB-A2
https://configurator.rockwellautomation.com/#/validate/42EF-P2JBB-F4
https://configurator.rockwellautomation.com/#/validate/42EF-P2KBB-A2
https://configurator.rockwellautomation.com/#/validate/42EF-P2KBB-F4
https://configurator.rockwellautomation.com/#/validate/42EF-P2MNB-F4
https://configurator.rockwellautomation.com/#/validate/42EF-P2MPB-F4
https://configurator.rockwellautomation.com/#/validate/42EF-P2MPB-A2
https://configurator.rockwellautomation.com/#/validate/42EF-P2MPB-Y4

They have quite a long sensing distance (up to 3 meters), so they can be mounted up & away from harm. Sourcing them may not be an easy task, but there should be a fair number of them laying around from teams that were around in 2011.

Wiring the thing:

Note because of the 10.8V minimum voltage spec on these sensors, you should plug these into the 12V ports of the VRM rather than directly to the PDP.

The voltage range can handle 10.8v-30.0v, but remember, all the links for these sensors in FRC applications are on the prior control system with the cRIO, RoboRIO, digital Sidecar, analog module, etc. Modifications to the wiring diagram of these sensors would be needed in order to bring it up to the spec that we are using for the current control system.

But good catch with the minimums, voltage drops could be sub 10.8v on the PDP.

yes, we will be using look forward

Is look-forward mode a special feature of the Limelight? Or do you mean pointing the camera forward?

AFAIK, it means pointing the camera forward instead of using a downward camera to detect the white on the black carpet.

1 Like

I don’t know how well those did or didn’t work in 2011, but with that specific Allen Bradley part I would be surprised if it works well this season. That part number is meant for polarized retroreflective use, which requires a reflector to shine against. Since this tape is normal gaffers tape it will not have reflective properties and a diffuse sensor would be a better choice.

The Allen Bradley products work well but are the Cadillacs of the automation industry, they are more expensive than what FRC teams probably need and a bit difficult to source if you don’t have local contacts with a distributor. Automation Direct sells comparable products fine for FRC use for quite a bit less and you can buy online. They even include a voucher in the KOP you can use!

Here are a list of some photoelectric sensors that could work this year (already filtered for plastic housings, NPN outputs for the RoboRio, 6 foot cable, and diffuse detection):
https://www.automationdirect.com/adc/shopping/catalog/sensors_-z-_encoders/photoelectric_sensors#Housing_Material_s=“Plastic”&start=0&Sensing_Method_s=(%20"Diffuse"%20"Diffuse%20with%20Background%20Suppression")&Switching_Output_s=(“NPN”)&Connection_ms=“Pigtail”&sort=price%20asc

Here is a specific sensor that would work for up to a 400mm range (you can add a mounting bracket for $3):
https://www.automationdirect.com/adc/shopping/catalog/sensors_-z_encoders/photoelectric_sensors/dc_rectangular/diffuse_(qm-z-cx-z-fe_series)/qmr7-0n-0a

2 Likes

Erm… are you sure about the sensor from 2011 not working? The docs say that ‘diffuse sensing’ works up to 20 inches. The polarized sensing feature is present as well just has longer range. We found our sensors from 2011 and the exact model/part number is 42ef-d1mnak-a2
Searching for it online gave a few vendors claiming to sell it and have some docs. This site had a link to detailed spec sheet:
https://www.reynoldsonline.com/2300904/Product/Allen-Bradley_42EF-D1MNAK-A2

Not sure if we will end up using this sensor or looking for something else.

I will refer you to the 2011 game manual - material specified for the “tracking lines”, these were the sensors provided in the KOP:

TRACKING LINES are marked on the carpet with 2 - inch wide grey gaffers tape (Pro Gaff Tape, “grey”).