Announcement

Collapse
No announcement yet.

Color sensor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Color sensor

    Considering the new game what we need two color centers in order to decide which side of the Beacon to capture or could we do it with one? We have never used color sensors before. Also, is there a difference between the adufruit color sensor and the modern robotics color sensor other than the modern robotics color server is $37

  • #2
    Originally posted by thensley View Post
    Considering the new game what we need two color centers in order to decide which side of the Beacon to capture or could we do it with one? We have never used color sensors before. Also, is there a difference between the adufruit color sensor and the modern robotics color sensor other than the modern robotics color server is $37
    If you do it with one, you will need to move the robot (or the sensor) to point at the different halves of the beacon. However, if you have skilled programmers, you can use a far more powerful sensor--your phone camera (which is a nice grid of a few million color sensors with a lens) and use that to detect the color on both sides.
    FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
    Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

    Comment


    • #3
      Sounds like our best bet would be two color sensors, we aren't very skilled at programming yet.

      Comment


      • #4
        We just used our phones last year with the camera. As for the programming portion of it... I have no clue.
        2015 FTC World Champion - Valley X Robotics 2844 - Founding Memeber

        Comment


        • #5
          Isn't the beacon by default one color on one side and the other on the other side in Autonomous? So if you knew one side was blue, you would know the other side is red?

          Comment


          • #6
            Originally posted by FTC8686 View Post
            Isn't the beacon by default one color on one side and the other on the other side in Autonomous? So if you knew one side was blue, you would know the other side is red?
            This is also my thinking...

            Comment


            • #7
              Overthinking as usual! Excellent point! Thank you

              Comment


              • #8
                Really curious how you got that to work. Can you give us a direction to look for programming help.

                Comment


                • #9
                  Well some pseudo code would be(assuming color sensor is on right side and you are on blue alliance) -
                  Code:
                  beaconcolor = (get color here)
                  if(beaconcolor=blue){
                  //Code to press right side
                  }else{
                  //Code to press the left side.
                  }
                  Say you were on the blue alliance. So if your color sensor was on the right side, and you received the color blue, then you know you need to press the right button. If the color sensor received the color red, then you know you need to press the left button.

                  Comment


                  • #10
                    This is our code last year. The logic to check the beacon color is in the PUSH_BUTTON state of the state machine.
                    https://github.com/trc492/Ftc2016Fir...utoBeacon.java

                    Comment


                    • #11
                      How did you link the camera to the program?

                      Comment


                      • #12
                        Originally posted by thensley View Post
                        How did you link the camera to the program?
                        If you decide to use the camera, you need to do some sort of blob detection. One way to do it is to use libraries such as OpenCV to do blob detection (if you know how to use OpenCV) or you can use the camera to capture a frame and read the pixels of the area of the screen that the beacon is supposed to be on. You need to average the color in the left area pixels and the right area pixels and see if the color is sort of red or sort of blue.

                        Comment


                        • #13
                          If you're unfamiliar with computer vision, this may be a useful library, https://github.com/lasarobotics/FTCVision. We never used it, but it seems like it works quite well.

                          Comment


                          • #14
                            Also, keep in mind that to use the camera, the phone needs to be positioned correctly to see the beacon.

                            Comment


                            • #15
                              Originally posted by mikets View Post
                              If you decide to use the camera, you need to do some sort of blob detection. One way to do it is to use libraries such as OpenCV to do blob detection (if you know how to use OpenCV) or you can use the camera to capture a frame and read the pixels of the area of the screen that the beacon is supposed to be on. You need to average the color in the left area pixels and the right area pixels and see if the color is sort of red or sort of blue.
                              We ended up not using blob detection in the end. A carefully designed weighted-averaging algorithm working on weighting based on both position and saturation/value and averaging hue gave us sufficiently good results for repeatability given some mechanical considerations (e.g. a wide button pushing attachment).
                              FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
                              Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

                              Comment

                              Working...
                              X