Project

General

Profile

Statistics
| Revision:

root / branches / simulator / projects / libdragonfly / include / move.h @ 891

History | View | Annotate | Download (3.62 KB)

1
/**
2
 * Copyright (c) 2007 Colony Project
3
 * 
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 move.h
29
 * @brief Contains definitions for controlling robot motion
30
 * 
31
 * This file offers higher-level functions for robot motion.
32
 *
33
 * @author Colony Project, CMU Robotics Club
34
 **/
35

    
36
#ifndef _MOVE_H_
37
#define _MOVE_H_
38

    
39
/**
40
 * @defgroup move Movement
41
 * @brief Functions fo controlling robot motion
42
 * Higher level functions to control the movement of robots.
43
 * 
44
 * @{
45
 **/
46

    
47

    
48
/** @brief Move forwards **/
49
#define FWD 0
50
/** @brief Move backwards **/
51
#define BCK 1
52

    
53
/** @brief A slow speed **/
54
#define SLOW_SPD 96
55
/** @brief Half of the full speed **/
56
#define HALF_SPD 128
57
/** @brief A normal speed **/
58
#define NRML_SPD 160
59
/** @brief A fast speed **/
60
#define FAST_SPD 192
61
/** @brief The maximum speed **/
62
#define FULL_SPD 255
63

    
64
/** @brief A slow turning speed **/
65
#define SLOW_TURN 64
66
/** @brief A medium turning speed **/
67
#define NRML_TURN 96
68
/** @brief A high turning speed **/
69
#define FAST_TURN 128
70

    
71
/**
72
 * @brief Move the robot at the specified velocity
73
 *
74
 * Causes the robot to move with the given translation and rotational velocities.
75
 * motors_init must be called before this function can be used.
76
 *
77
 * @param velocity the translational velocity of the robot, in the range -255 to 255.
78
 * A positive value indicates forward motion, while a negative value indicates
79
 * backwards motion.
80
 * 
81
 * @param omega the rotational velocity of the robot, in the range -255 to 255.
82
 * A positive value indicates a counterclockwise velocity, while a negative
83
 * value indicates a clockwise velocity.
84
 *
85
 * @see motors_init, motor1_set, motor2_set
86
 **/
87
void move(int velocity, int omega);
88

    
89
/**
90
 * @brief Move the robot while avoiding obstacles
91
 *
92
 * Moves the robot with the given translational and angular velocities
93
 * while avoiding obstacles. To be effective, this function must be
94
 * called repeatedly throughout the motion. It relies on the IR
95
 * rangefinders to detect obstacles. Before calling this function,
96
 * motors_init and range_init must be called.
97
 *
98
 * @param velocity the translational velocity of the robot, in the
99
 * range -255 to 255. A positive value indicates forward motion.
100
 *
101
 * @param omega the rotational velocity of the robot, in the range
102
 * -255 to 255. A positive value indicates a counterclockwise velocity.
103
 *
104
 * @param strength the strength of the avoid behavior, in the range
105
 * 0 to 100.
106
 *
107
 * @see motors_init, range_init, move
108
 **/
109
void move_avoid(int velocity, int omega, int strength);
110

    
111
/** @} **/
112

    
113
#endif
114