Project

General

Profile

Revision c384dc7e

IDc384dc7e5c99254e07ef0d46bef2b9dfaf32e817

Added by Alex Zirbel over 12 years ago

Updated the Behavior definition and extensions.

The Behavior.cpp/h class now works and can be extended by simply implementing its run() method. However, the subclass must also be extantiated and used in an external executable. An example of this can be seen in PriyaBehavior.cpp/h, and the executable, priya_behavior_process.cpp. In the future, we should move all behaviors into a behaviors/ folder, and autogenerate the executable to be compiled.

I also changed Behavior and the MotorControl class to accept a scoutname string as a parameter so that each behavior only controls a single scout. This means when you call the priya_behavior_process executable, you pass it one argument (the name of the scout in scoutsim), and all control classes will prefix their output ROS messages with that scoutname so that only the scout you intended gets the messages.

I removed behavior files which do not use this new abstract behavior class.

View differences:

scout/libscout/src/MotorControl.h
76 76
{
77 77
    public:
78 78
        /** Set up the motor node and prepare to communicate over ROS */
79
        MotorControl(const ros::NodeHandle& libscout_node);
79
        MotorControl(const ros::NodeHandle& libscout_node,
80
                     std::string scoutname);
80 81

  
81 82
        /** Uses which to specify what to change, and sets all to same speed */
82 83
        void set(int which, float speed, char units=MOTOR_DEFAULT_UNIT);
......
112 113
        ros::ServiceClient query_motors_client;
113 114

  
114 115
        ros::NodeHandle node;
115

  
116 116
};
117 117

  
118 118
#endif

Also available in: Unified diff