root / scout / encoders / src / encoders.h @ 7cb5de78
History | View | Annotate | Download (2.14 KB)
1 | 14241f84 | Lalitha Ganesan | /**
|
---|---|---|---|
2 | 7cb5de78 | Ben Wasserman | *Copyright (c) 2011 Colony Project
|
3 | 14241f84 | Lalitha Ganesan | *
|
4 | * Permission is hereby granted, free of charge, to any person
|
||
5 | * obtaining a copy of this software and associated documentation
|
||
6 | * files (the "Software"), to deal in the Software without
|
||
7 | * restriction, including without limitation the rights to use,
|
||
8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
9 | * copies of the Software, and to permit persons to whom the
|
||
10 | * Software is furnished to do so, subject to the following
|
||
11 | * conditions:
|
||
12 | *
|
||
13 | * The above copyright notice and this permission notice shall be
|
||
14 | * included in all copies or substantial portions of the Software.
|
||
15 | *
|
||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||
18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||
20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||
21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||
23 | * OTHER DEALINGS IN THE SOFTWARE.
|
||
24 | **/
|
||
25 | |||
26 | |||
27 | /**
|
||
28 | * @file encoders.h
|
||
29 | * @brief Contains encoder declarations and functions
|
||
30 | *
|
||
31 | * Contains functions and definitions for the use of
|
||
32 | * encoders.
|
||
33 | *
|
||
34 | * @author Colony Project, CMU Robotics Club
|
||
35 | **/
|
||
36 | |||
37 | #ifndef _ENCODERS_H_
|
||
38 | #define _ENCODERS_H_
|
||
39 | |||
40 | #include "encoders/query_encoders.h" |
||
41 | 7cb5de78 | Ben Wasserman | #include "encoders/encoders_state.h" |
42 | |||
43 | #define ENCODERS_TICKS 't' |
||
44 | #define ENCODERS_MM 'm' |
||
45 | #define ENCODERS_CM 'c' |
||
46 | #define ENCODERS_DEG 'd' |
||
47 | 14241f84 | Lalitha Ganesan | |
48 | 7cb5de78 | Ben Wasserman | #define NUM_TICKS 100 |
49 | #define WHEEL_RADIUS_MM 20 |
||
50 | #define PI 3.14159265 |
||
51 | 14241f84 | Lalitha Ganesan | |
52 | /** @brief Initialize the encoders module and driver **/
|
||
53 | int main(int argc, char **argv); |
||
54 | /** @brief Responds to topic to get encoder state **/
|
||
55 | 7cb5de78 | Ben Wasserman | void encoder_set_mode(const encoders::encoders_state::ConstPtr& msg); |
56 | /** @brief Publishes encoder state **/
|
||
57 | void encoders_state_publish();
|
||
58 | 14241f84 | Lalitha Ganesan | /** @brief Responds to service to query encoder data **/
|
59 | bool encoders_query(encoders::query_encoders::Request &req,
|
||
60 | encoders::query_encoders::Response &res); |
||
61 | 7cb5de78 | Ben Wasserman | /** @brief Converts encoder values to selected units **/
|
62 | int encoders_ticks_to_units(int ticks, char units); |
||
63 | 14241f84 | Lalitha Ganesan | |
64 | #endif |