Revision 85538662
Updated the sonar module prototype.
The biggest change to the proposed node is a restructuring of the sonar code style. Two services (sonar_toggle and sonar_set_scan) allow another node to turn the sonar on and off. The sonar constantly scans, keeps track of its position, and publishes all its readings in the topic sonar_direction.msg.
Added the appropriate message and service files, and the code skeleton.
The most obvious missing part of the code is the part which controls the movement of the sonar sensor, which should constantly scan between two ranges without user intervention.
scout/sonar/src/sonar.h | ||
---|---|---|
34 | 34 |
* @author Colony Project, CMU Robotics Club |
35 | 35 |
**/ |
36 | 36 |
|
37 |
/* Author: Ben Wasserman |
|
38 |
*/ |
|
39 |
|
|
40 | 37 |
#ifndef _SONAR_H_ |
41 | 38 |
#define _SONAR_H_ |
42 | 39 |
|
43 | 40 |
/** @brief Initialize the sonar in the library module **/ |
44 | 41 |
void sonar_init(void); |
42 |
|
|
45 | 43 |
/** @brief Initialize the sonar module and drivers **/ |
46 | 44 |
void sonar_module_init(void); |
45 |
|
|
47 | 46 |
/** @brief Read raw sonar data from the sonar module. Takes stepper |
48 | 47 |
** position and sensor to read **/ |
49 | 48 |
int sonar_read_raw(int direction, int sensor); |
49 |
|
|
50 | 50 |
/** @brief Wrapper for reading sonar data (angle in degrees and distance in |
51 | 51 |
** cm) **/ |
52 | 52 |
int sonar_read(int direction); |
53 |
|
|
53 | 54 |
/** @brief Subscribe function to sonar topic **/ |
54 | 55 |
void sonar_subscribe(int *function()); |
55 | 56 |
|
Also available in: Unified diff