Project

General

Profile

Revision 15b7e607

ID15b7e607c9ec3704c7866011e2536b0f000777c4
Parent ce8c3190
Child cef78c70

Added by Priyanka Deo over 12 years ago

Chaned libscout sonar code so that it turned sonar on and off when necessary.

View differences:

scout/libscout/src/SonarControl.cpp
72 72
 */
73 73
void SonarControl::set_range(int start_pos, int end_pos)
74 74
{
75
    //TODO Enable some checks of start and end position
75
    /** Turn sonar on */
76
    sonar::sonar_toggle on_msg;
77
    on_msg.set_on = true;
78
    sonar_toggle_pub.publish(on_msg);
79

  
80
    /** Set scan range */
76 81
    sonar::sonar_set_scan msg;
77 82

  
83
    //TODO Enable some checks of start and end position
78 84
    msg.stop_l = start_pos;
79 85
    msg.stop_r = end_pos;
80 86

  
......
83 89
}
84 90

  
85 91
/**
92
 * @brief Turn off sonar readings
93
 *
94
 * Stops sonar from panning and taking readings.
95
 *
96
 * @return NONE
97
 */
98
float SonarControl::set_off()
99
{
100
    /** Turn sonar off */
101
    sonar::sonar_toggle on_msg;
102
    on_msg.set_on = false;
103
    sonar_toggle_pub.publish(on_msg);
104
}
105
/**
86 106
 * @brief Query the current front sonar readings
87 107
 *
88 108
 * Sends a request to the query_sonar service which will reply with the
scout/libscout/src/SonarControl.h
52 52
        void set(int position);
53 53

  
54 54
        /** Sets sonar to scan a range in 0-180 specified by input */
55
        void set_range(int start_pos, int end_pos);	
55
        void set_range(int start_pos, int end_pos);
56

  
57
	/** Stops sonar from panning and taking readings */
58
	void set_off();	
56 59

  
57 60
        /** Returns the distance readings of sonars */
58 61
        float query_front(void);

Also available in: Unified diff