Announcement

Collapse
No announcement yet.

MR Color Sensor as Proportional Line Follower

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

  • MR Color Sensor as Proportional Line Follower

    Hello,

    I am interested in using the MR Color Sensor as a proportional/smooth line follower (so that there would be smooth line following instead of jerking back and forth). However, there seems to be no way to get the reflected light like there was with Lego Mindstorms. I tried converting to HSV but that didn't seem to work well. Have any of you been able to successfully use the MR Color Sensor as a proportional line follower? Thanks!
    Programmer for Team 4997 Masquerade -- 2012 World Champions, 2014 - 2016 Division Finalists
    Founding Member of Team 6433 Neutrinos -- 2015 World Champions

    Check out my intro video to the new tech platform
    Check out my team's Robot Reveal for Res-Q

  • #2
    Hi

    If you want to do a smooth follow, you'll need to use either a legacy NXT light sensor, or the MR Optical Distance Sensor (since it really is only measuring reflected light energy).

    The NXT will need to have it's LED turned on. The ODS is always on.

    Phil.

    Comment


    • #3
      Originally posted by Varun Singh View Post
      Hello,

      I am interested in using the MR Color Sensor as a proportional/smooth line follower (so that there would be smooth line following instead of jerking back and forth). However, there seems to be no way to get the reflected light like there was with Lego Mindstorms. I tried converting to HSV but that didn't seem to work well. Have any of you been able to successfully use the MR Color Sensor as a proportional line follower? Thanks!
      What do you mean by "smooth line following"? Are you talking about fish tailing? If so, are you using PID control? PID control can be tuned to minimize fish tailing. The color sensor can give you the intensity of each color and even alpha. You can use these value in PID control.

      Comment


      • #4
        Originally posted by Varun Singh View Post
        Hello,

        I am interested in using the MR Color Sensor as a proportional/smooth line follower (so that there would be smooth line following instead of jerking back and forth). However, there seems to be no way to get the reflected light like there was with Lego Mindstorms. I tried converting to HSV but that didn't seem to work well. Have any of you been able to successfully use the MR Color Sensor as a proportional line follower? Thanks!
        I agree with Philbot that the MR Optical Distance Sensor would be the easiest way to do what you are asking, but if you don't have one of those you will need to use the color sensor as an I2C device instead of a default MR color sensor. The value I believe you are looking for is the white value which is found in the ninth register.

        Address Function
        0x03 Command
        0x04 Color Number
        0x05 Red Value
        0x06 Green Value
        0x07 Blue Value
        0x08 White Value

        Comment


        • #5
          I haven't used the ColorSensor class (actually Interface) but it has a method alpha() which says:
          Code:
          Get the amount of light detected by the sensor as an int.
          Should you be able use this to get the reflected light intensity?

          Comment


          • #6
            One thing to keep in mind is the effectiveness of a sensor for line following is somewhat dependent on the size of the illumination spot and the cone of sensitivity of the sensor.
            You can see the spot from an NXT line sensor and it's pretty small. I think the MR ODS is IR so you can't see it, but the WHITE LED on the color sensor is pretty broad.

            The larger the spot, the less distinct the grey to white transition will be, and the harder it is to see a narrow line (1").
            Take care when choosing (and mounting) a sensor for line tracking. The spot needs to be smaller than the object you are tracking to get a good edge.

            Phil.

            Comment

            Working...
            X