Project

General

Profile

Revision 94a3af93

ID94a3af939ae972b8fd14ebe94cc3d8b03f4b8b8a

Added by Priya about 12 years ago

Committing changes that were not previously committed. Also got rid of some confusing/unnecessary code.

View differences:

scout/libscout/CMakeLists.txt
29 29
#rosbuild_add_executable(example examples/example.cpp)
30 30
#target_link_libraries(example ${PROJECT_NAME})
31 31

  
32
rosbuild_add_executable(priya_behavior src/priya_behavior_process.cpp src/PriyaBehavior.cpp src/Behavior.cpp src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp)
32
rosbuild_add_executable(libscout src/Behavior.cpp src/behaviors/draw_cw_circle.cpp src/behaviors/draw_ccw_circle.cpp src/BehaviorList.cpp src/BehaviorProcess.cpp src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp)
scout/libscout/src/BehaviorList.cpp
1 1
#include "BehaviorList.h"
2 2

  
3
//draw_cw_circle* behavior1 = new draw_cw_circle(scoutname)
4

  
5 3
BehaviorList::BehaviorList(std::string scoutname)
6 4
{
7 5
  behavior_list.push_back((Behavior*)new draw_cw_circle(scoutname));
scout/libscout/src/BehaviorList.h
5 5
#include "behaviors/draw_cw_circle.h"
6 6
#include "behaviors/draw_ccw_circle.h"
7 7

  
8
#define NUM_BEHAVIORS 2
9
#define NUM_SCOUTS 1
10

  
11 8
class BehaviorList
12 9
{
13 10
  public:
scout/libscout/src/PriyaBehavior.cpp
1
/**
2
 * Copyright (c) 2011 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
 * @file PriyaBehavior.cpp
28
 * @brief A simple robot behavior, smart-runaround style, that uses
29
 * the behavior class
30
 * 
31
 * @author Colony Project, CMU Robotics Club
32
 * @author Alex Zirbel
33
 * @author Priyanka Deo
34
 */
35

  
36
#include "PriyaBehavior.h"
37

  
38
void PriyaBehavior::run()
39
{
40
    while(ok())
41
    {
42
        motors->set_sides(20, 80, MOTOR_ABSOLUTE);
43

  
44
        spinOnce();
45
        loop_rate->sleep();
46
    }
47
}
scout/libscout/src/PriyaBehavior.h
1
/**
2
 * Copyright (c) 2011 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
 * @file PriyaBehavior.h
28
 * @brief A simple behavior which drives the scout in a circle.
29
 * 
30
 * @author Colony Project, CMU Robotics Club
31
 * @author Priyanka Deo
32
 * @author Alex Zirbel
33
 **/
34

  
35
#ifndef _PRIYA_BEHAVIOR_H_
36
#define _PRIYA_BEHAVIOR_H_
37

  
38
#include "Behavior.h"
39

  
40
/**
41
 * @brief PriyaBehavior A simple robot behavior.
42
 *
43
 * Inherits Behavior class which contains all basic behavior
44
 * functionality.
45
 */
46
class PriyaBehavior : Behavior
47
{
48
    public:
49
        /// @todo Is this the best way to inherit the Behavior constructor?
50
        PriyaBehavior(std::string scoutname) : Behavior(scoutname) {};
51

  
52
        /** Actually executes the behavior. */
53
        void run();
54
};
55

  
56
#endif
scout/libscout/src/priya_behavior_process.cpp
1
/**
2
 * Copyright (c) 2011 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
 * @file Behavior.cpp
28
 * @brief A wrapper that executes PriyaBehavior as an executable.
29
 *
30
 * Should be auto-generated in the future.
31
 * 
32
 * @author Colony Project, CMU Robotics Club
33
 * @author Alex Zirbel
34
 */
35

  
36
#include <ros/ros.h>
37
#include "PriyaBehavior.h"
38

  
39
using namespace std;
40

  
41
int main (int argc, char **argv)
42
{
43
    string scoutname = "";
44

  
45
    // Running with no arguments only supports one scout. Check in case
46
    // the user meant to specify a scout in the arguments.
47
    if (argc != 2)
48
    {
49
        cout << "You have started this behavior in hardware mode." << endl
50
             << "To start in software mode, use: " << argv[0]
51
             << " <scoutname>" << endl;
52
    }
53
    else
54
    {
55
        // Use the provided scoutname for simulator messages
56
        scoutname = argv[1];
57
    }
58

  
59
    /// @todo Will using argc and argv cause problems? (I don't think so but..)
60
    ros::init(argc, argv, "priya_behavior");
61

  
62
    PriyaBehavior *behavior = new PriyaBehavior(scoutname);
63
    behavior->run();
64

  
65
    return 0;
66
}
scout/libscout/src/tags
1
LIB_ALL	constants.h	47
2
LIB_CLIFFSENSORS	constants.h	50
3
LIB_ERROR	constants.h	54
4
LIB_HEADLIGHTS	constants.h	51
5
LIB_MOTORS	constants.h	48
6
LIB_OK	constants.h	55
7
LIB_SONAR	constants.h	49
8
MOTOR_BL	libmotors.h	51
9
MOTOR_BR	libmotors.h	52
10
MOTOR_FL	libmotors.h	49
11
MOTOR_FR	libmotors.h	50
12
Mlibscout.cpp	libscout.cpp	/^int main(int argc, char **argv){$/
13
_CONSTANTS_H_	constants.h	40
14
_LIBMOTORS_H_	libmotors.h	41
15
_LIBSCOUT_H_	libscout.h	41
16
init	libscout.cpp	/^int init(int modules){$/
17
libmotors_init	libmotors.cpp	/^void libmotors_init(){$/
18
node	constants.h	58
19
motors_query	libmotors.cpp	/^int motors_query(char which){$/
20
motors_set	libmotors.cpp	/^void motors_set(int speed, char which){$/
21
motors_speed_set	libmotors.cpp	/^void motors_speed_set(int speed, char which){$/
22
query_motors_client	libmotors.h	56
23
set_motors_publisher	libmotors.h	55
scout/scoutsim/src/scout.h
59 59

  
60 60
#include <wx/wx.h>
61 61

  
62
#include "scout_constants.h"
62
//#include "scout_constants.h"
63 63

  
64 64
#define PI 3.14159265
65 65

  

Also available in: Unified diff