Project

General

Profile

01-24-12

Go over Behavior Code

  • Discuss abstract class
    • Hides all the ROS stuff
    • Initializes ROS
    • Creates wrappers for ROS functions
    • Declares all the library control objects
      class Behavior
      {
          public:
              // Initializes ROS for behavior
              Behavior(std::string scoutname);
      
              /// Extended by subclasses to actually run the behavior.
              virtual void run() = 0;
      
          protected:
              ros::NodeHandle node;
      
              ros::Rate *loop_rate;
      
              // Declare all used library controls
              MotorControl * motors;
              ButtonControl * buttons;
              SonarControl * sonar;
      
              // Wrappers for ROS functions
              bool ok();
              void spin();
              void spinOnce();
      };
      
  • Discuss BehaviorList and BehaviorProcess
  • BehaviorList
    • Behavior list instantiates all the behaviors.
    • Initialized with scoutname.
    • Destructs behavior objects when deconstructor is called (no mem leaks!)
  • BehaviorProcess
    • contains main function
    • initializes BehaviorList for each scout
    • Assigns each scout a behavior.
class BehaviorList
{
  public:
  std::vector<Behavior*> behavior_list;

  //Constructor. Initializes behavior_list
  BehaviorList(std::string scoutname);
  //Destructor. Frees behavior_list;
  ~BehaviorList();
};
int main (int argc, char **argv)
{
    string scoutname = "";
    int behavior_num;

    // Running with no arguments only supports one scout. Check in case
    // the user meant to specify a scout in the arguments.
    if (argc != 3)
    {
        cout << "You have started this behavior in hardware mode." << endl
             << "To start in software mode, use: " << argv[0]
             << " <scoutname> <behavior#>" << endl;
    }
    else
    {
        // Use the provided scoutname for simulator messages
        scoutname = argv[1];
        behavior_num = atoi(argv[2]);

        ros::init(argc, argv, "priya_behavior");

        BehaviorList* list = new BehaviorList(scoutname);
        vector<Behavior*> behavior_list = list->behavior_list;

        if (behavior_num < (int)behavior_list.size())
        {
            (behavior_list[behavior_num])->run();
        }
        else
        {
            cout << "There is no behavior number" << behavior_num
              << ". There are only " << (int)behavior_list.size() << "behaviors." 
              << endl;
        }

        delete list;
    }

    return 0;
}
  • Discuss How to Create new Behavior
    • Create new.cpp and new.h file in /scout/libscout/src/behaviors

Goals for This Semester

Robot Planner (Driving Robots)
  1. Follow a preset path (line following?)
  2. Intersection Behavior?
  3. Creating/Representing/Storing Map of world
  4. Path Planning (Shortest Path)
  5. Interfacing with Scheduler
Scheduler (Status Bot)
  1. Determining Method for Scheduling Tasks
  2. Write Scheduler (assume fixed robots and fixed tasks)
    • Find "optimal" way to assign tasks to robots
    • Find "optimal" order to do tasks
  3. Interface with robots
  4. Growing/changing list of tasks

Assign tasks for next week

Week Robot Planner Scheduler
1 Port over linefollowing and intersection behavior code(low-level) Determine Scheduler Algorithm.
2 Higher level intersection code and map representation Write Easy PQ implementation
3 Finish code if not finished. Define robot-scheduler interface. Expand to include stack A to stack B (does not go back home case). Define robot-scheduler interface.
4 Path planning (A* or wavefront) Expand to multiple palates?

Week 1:
Robot Planner Assignees: Dan, Leon, Jon, Priya, Lalitha, James, Ben. Meeting Sunday @3
Scheduler Assignees: Dan, Jeff, Prashant, Priya(ish). Meeting on own time. Meeting Monday to fix scheduler algorithm.