Project

General

Profile

Revision 414d2b48

ID414d2b48e22681108c656cd57dbf2177efd5bbfc

Added by Alex Zirbel about 11 years ago

Updated line follow code to make turns for Lab 2.

Also upgraded at_destination and LineSensor::destination() for Intro Lab 2.

View differences:

scout/libscout/src/LinesensorControl.cpp
117 117

  
118 118
/**
119 119
 * We define a destination as two gaps of white between the line and patches
120
 * of 15-shade color (light grey) on either side.
121
 * I use 15-shade color in an attempt to not throw off the line localization.
120
 * of 95-shade color (dark grey) on either side.
121
 * I use 95-shade color in an attempt to not throw off the line localization.
122 122
 */
123 123
bool LinesensorControl::destination(vector<uint32_t> readings)
124 124
{
......
127 127
        return false;
128 128
    }
129 129

  
130
    ROS_INFO("Destination call. Readings: %d %d %d %d %d %d %d %d",
131
            readings[0], readings[1], readings[2], readings[3],
132
            readings[4], readings[5], readings[6], readings[7]);
133

  
134 130
    // Try to match this pattern to what we see
135
    int expected_pattern[] = {15, 0, 255, 0, 15};
131
    int expected_pattern[] = {95, 0, 255, 0, 95};
136 132
    int pat_idx = 0;
137 133

  
138 134
    for (int i = 0; i < 8; i++)
......
147 143
        // The whole pattern was found
148 144
        if (pat_idx > 4)
149 145
        {
150
            ROS_INFO("FOUND DESTINATION");
151 146
            return true;
152 147
        }
153 148
    }

Also available in: Unified diff