1 / 16

Multi-Robot Systems with ROS Lesson 11

Multi-Robot Systems with ROS Lesson 11. Teaching Assistant: Roi Yehoshua roiyeho@gmail.com. Agenda. TAO teamwork Creating TAO teams Shared memory. TAO Teamwork. Main classes (defined in teamwork namespace): Agent Teammate (inherits from Agent) Self (inherits from Agent)

brandy
Download Presentation

Multi-Robot Systems with ROS Lesson 11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multi-Robot Systems with ROS Lesson 11 Teaching Assistant: RoiYehoshua roiyeho@gmail.com

  2. Agenda • TAO teamwork • Creating TAO teams • Shared memory (C)2014 Roi Yehoshua

  3. TAO Teamwork • Main classes (defined in teamwork namespace): • Agent • Teammate (inherits from Agent) • Self (inherits from Agent) • Teammates (collection of Agents) • Team • SingleAgent (inherits from Team) • SharedMemory (C)2014 Roi Yehoshua

  4. Teams in TAO • Teams in TAO have an hierarchy structure (a team can contain subteams) • Team’s full name contains team hierarchy path • For example, /main/team1 • An agent can belong to more than one team • Each agent should define its own team and all its team members (team’s definition is not shared) (C)2014 Roi Yehoshua

  5. Creating a Team • Creating a top-level team: • db is a shared memory object • Teammates is a collection of agents that will be added to the team • Adding the team to the call context: • Defining the team as the current team: • teamwork::Team main_team = teamwork::createMainTeam(db, "main", teammates); • context.team(main_team.ptr()); • context.team(TAO_CURRENT_TEAM_NAME, main_team.ptr()); (C)2014 Roi Yehoshua

  6. Defining Teammates • Create an array of agents names: • Add current agent to the team: • Add other team members: • Set pointer to self agent (agent representing current robot) string agents[3] = {"r1", "r2", "r3"}; teamwork::Teammates teammates; teamwork::Agent::Ptrself_agent = teammates.add_self(agents[robotNum]); teammates.add(agents[(robotNum+1)%3]); teammates.add(agents[(robotNum+2)%3]); context.self(self_agent); (C)2014 Roi Yehoshua

  7. Getting Access to a Team • Inside TAO: • TAO_TEAM – returns a pointer to current team • TAO_CONTEXT.team(t_name) – returns a pointer to a team with name “t_name” • Outside TAO: • context.team(TAO_CURRENT_TEAM_NAME) – returns a pointer to current team • context.team(t_name) – returns a pointer to a team with name “t_name” (C)2014 Roi Yehoshua

  8. Team Class Methods (C)2014 Roi Yehoshua

  9. Team Class Methods (C)2014 Roi Yehoshua

  10. Team Class Methods (C)2014 Roi Yehoshua

  11. Context Methods Releated To Teams • Example: • TAO_CONTEXT.self()->name == "1" // am I robot 1? (C)2014 Roi Yehoshua

  12. Shared Memory • Stored in a database • Provides data replication across nodes • Provides data availability • Variables are kept within hierarchical team data • /main/x or /main/leader/x • Shared memory is for synchronized data only - Don't use it for other types of data. • To use shared memory, you have to run shared_memory node: • $ rosrun teamwork shared_memory (C)2014 Roi Yehoshua

  13. Shared Memory Access • ROS access • Topics • /SM/changes • Services • /SM/get and get_all • /SM/set and unset • C++ access • teamwork::SharedMemory db; • db[“x”], db.get(“x”), db.set(“x”,value), etc. (C)2014 Roi Yehoshua

  14. Saving Data To Shared Memory • Each team can use mem to save and share data • Shared memory has folder-like structure • For example, variable x in main team will be /main/x and stored through team structure: • Variable’s type must be one of ROS message types (to support serialization) • Int32 num; • num.data = 123; • TAO_TEAM->get_main_team()->mem("x") = num; (C)2014 Roi Yehoshua

  15. Team’s Variable Names • Each team stores a set of strings called var_names that contains the names of the variables stored in its shared memory • This enables fast search of variables in the team hierarchy (C)2014 Roi Yehoshua

  16. Team Utility Methods for Variable Names (C)2014 Roi Yehoshua

More Related