Project

General

Profile

Revision 1905324e

ID1905324ede544b0057161ba7a6ff8f31be9ebc45

Added by Priya almost 12 years ago

Trying to make the warehouse robot drive around

View differences:

scout/libscout/src/behaviors/line_follow.cpp
36 36
    {
37 37
        double line_loc = linesensor->readline();
38 38

  
39
        cout << "line_loc: " << line_loc << endl;
40

  
41 39
        motor_l = -MOTOR_BASE + SCALE * line_loc;
42 40
        motor_r = -MOTOR_BASE - SCALE * line_loc;
43 41

  
44 42
        motors->set_sides(motor_l, motor_r, MOTOR_ABSOLUTE);
45 43
    }
46 44
    halt();
45
    ROS_INFO("Intersection reached!");
47 46
}
48 47

  
49 48
void line_follow::turn_left()
......
56 55

  
57 56
    motors->set_sides(motor_l, motor_r, MOTOR_ABSOLUTE);
58 57

  
59
    double line_loc = linesensor->readline();
60
    cout << "line_loc: " << line_loc << endl;
61 58
    if(first)
62 59
    {
63 60
        loop_rate->sleep();
......
84 81

  
85 82
    motors->set_sides(motor_l, motor_r, MOTOR_ABSOLUTE);
86 83

  
87
    double line_loc = linesensor->readline();
88
    cout << "line_loc: " << line_loc << endl;
89 84
    if(first)
90 85
    {
91 86
        loop_rate->sleep();
......
97 92
  while(linesensor->readline());
98 93
}
99 94

  
100
void line_follow::run()
95
void line_follow::u_turn()
101 96
{
97
  turn_right();
102 98
  follow_line();
103 99
  turn_right();
100
}
101

  
102
void line_follow::run()
103
{
104 104
  follow_line();
105
  turn_left();
106 105
  follow_line();
107
  turn_right();
106
  /*
107
  follow_line();
108
  u_turn();
109
  follow_line();
110
  u_turn();
111
  follow_line();
112
  follow_line();
113
  u_turn();
108 114
  follow_line();
115
  */
109 116
}

Also available in: Unified diff