Download presentation
Presentation is loading. Please wait.
Published byIrene Webster Modified over 9 years ago
1
COLONYWIRELESS September 26, 2008
2
Outline 1.Motivation and Goals 2.Introduction to the XBee 3.The Wireless Library 4.Example Packet Group 5.The Token Ring 6.Questions
3
Why Wireless? Enables Cooperation Allows Sharing of Sensor Information – BOM readings for cooperative searching Synchronizes BOM flashes – Prevents interference from multiple robots Controls access to resources, such as charging stations External monitoring through ColoNet
4
XBee module ZigBee wireless protocol – Open industry standard – IEEE 802.15.4 – Low-cost, low-power – 2.4GHZ – Widely used in sensor networks XBee wireless module – www.maxstream.net www.maxstream.net – 30m indoor range / 100m outdoor range – Simple interface
5
5 Selected XBee Features 16-bit Addressing Personal Area Networks (PANs) – May send packets only to your PAN – Able to change PAN at any time 16 Channels – XBees in different channels cannot communicate API Mode – Provides more features Interference prevention
6
6 XBee Packets Send up to 100 bytes as a packet Send to a single robot, a PAN, or everyone Optionally set a frame number – Confirms reception of packets to single robots
7
7 Packet Types Robot to Robot – Send to a single XBee – Specified by 16-bit address – ACK confirms reception, matched with frame PAN – Send to all XBees in our current PAN Global – Send to all XBees in our channel
8
8 Wireless Library Simple Modular Functional #include int main() { dragonfly_init(ALL_ON); wl_init(); while (1) { wl_do(); do_stuff(); } return 0; }
9
9 Packet Groups Organize packets into groups with similar functions for modularity Examples: – Error Messages – Token Ring Each packet in a group shares a group code Individual packets have packet types Group and type uniquely identify a packet Packets can be of any length (< 100 bytes)
10
10 Packet Group Handlers Registered with the wireless library to receive packets from a specific group Contains – Group Code – Function to handle received packets – Function to handle ACKs or failures – Function to call on timer tick – Function to call when the packet group is removed
11
11 C Programming: Function Pointers Variables which point to the address of a function When called, call the function they point to void foo(void) { printf(“Hello World!”); } void bar(void) { printf(“Goodbye World!”); void (*func)(void) = &foo; func(); >> Hello World! func = &bar; func(); >> Goodbye World!
12
12 Packet Group Handlers (contd.) typedef struct { unsigned int groupCode; void (*timeout_handler) (void); void (*handle_response) (int frame, int received); void (*handle_receive) (char type, int source, unsigned char* packet, int length); void (*unregister) (void); } PacketGroupHandler; Register packet groups with wl_packet_group_register
13
13 Packet Group Handler Example Creating a packet group to control robots through ColoNet Only need to respond to commands, so will only implement handle_receive
14
14 ColoNet Example (contd.) void colonet_receive (char type, int source, unsigned char* packet, int length) { switch (type) { case BEEP: buzzer_chirp(1000, 200); break; case HUNT_RON: find_ron(); ram_ron(); break; case SELF_DESTRUCT: self_destruct(); break; }
15
15 ColoNet Example (contd.) PacketGroupHandler colonetHandler = {COLONET_GROUP, NULL, NULL, &colonet_receive, NULL} int main() { dragonfly_init(ALL_ON); wl_init(); wl_register_packet_group(&colonetHandler); while (1) wl_do(); } This program will obey all of ColoNet’s commands.
16
16 Sending Packets Now we are able to receive packets But how do we send packets? Simply call these functions in wireless.h void wl_send_robot_to_robot_global_packet (char group, char type, char *data, int len, int dest, char frame) Send a packet to a specific robot in any PAN. void wl_send_robot_to_robot_packet (char group, char type, char *data, int len, int dest, char frame) Send a packet to a specific robot in our PAN. void wl_send_global_packet (char group, char type, char *data, int len, char frame) Send a packet to all robots. void wl_send_pan_packet (char group, char type, char *data, int len, char frame) Send a packet to all robots in our PAN.
17
17 Colonet Example We can receive wireless packets, but we still need to send them void send_beep(int robot) { wl_send_robot_to_robot_global_packet(COLONET_GROUP, BEEP, NULL, 0, robot, 0) } void hunt_ron() { wl_send_global_packet(COLONET_GROUP, HUNT_RON, NULL, 0, 0); }
18
18 Colonet Example void bomb_squad() { wl_send_global_packet(COLONET_GROUP, SELF_DESTRUCT, NULL, 0, 0); }
19
19 Colonet Example Now, ColoNet is able to control robots using the ColoNet packet group.
20
Bearing and Orientation Module (BOM) IR emitter/detector ring Emitter mode – All emitters are powered simultaneously (beacon) Detector mode – Detectors can be polled for analog intensity readings Used for localization – Determining relative directions of robots – Seeking charging station
21
21 Why do we need a token ring? If more than one BOM flashes at once, other robots won’t know which is which Only one BOM can flash at a time Token ring controls which BOM can flash
22
22 Token Ring Only robot with “token” may flash BOM Once BOM is flashed, the robot with the token passes it to the next robot (determined by XBee ID) Sends BOM readings for the other robots with token, so that each robot has a sensor matrix of all BOM readings
23
23 Sensor Matrix Each robot passes its own sensor readings with the token All robots form a sensor matrix, storing relative location of all robots Various applications, including – Seeking a charging station – Cooperative Maze Solving – Following another robot
24
24 Ad-hoc Network If a robot does not pass the token quickly enough, or dies, the previous robot removes it from the network and it must rejoin Robots can freely join and leave the network, and the token continues to be passed To join the token ring, a robot sends a join request Preceding robot in ring adds the robot, and sends the token to him next time
25
25 Ad-hoc Network Advantages Leaderless Network Stable when robots die New robots can join easily
26
26 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token
27
27 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token
28
28 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token
29
29 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token
30
30 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token
31
31 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token Bot1 has been eliminated by ColoNet!
32
32 Token Ring Example Ron Bot 1 Bot 2 Bot 3 - Token Bot1 has been eliminated by ColoNet! Bot1 does not respond, so Ron realizes it is dead. He sends the token to Bot2 instead.
33
33 Using the Token Ring #include int main() { dragonfly_init(ALL_ON); wl_init(); wl_token_ring_register(); while (1) wl_do(); } To use the wireless library, set USE_WIRELESS = 1 in the Makefile
34
34 Summary Packet Groups to add wireless functionality Token Ring to find relative locations of robots
35
35 Troubleshooting Connect to dongle at 9600 Baud '+++' enters command mode Only XBees with the latest firmware support the wireless library (ATVR) Xbee ID ('ATMY' to read, 'ATMY num' to set) 0 < ID < XBEE_MAX_ID, must be unique Default Channel should be C (ATCH) ATWR to save settings Running the motors may cause interference
36
36 Wireless Applications Tag / Lemmings Cooperative Maze Solving Marching Band Task Allocation Wireless monitoring and control with Colonet Autonomous Recharging Mapping
38
Joke Even bytes get lonely for a little bit.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.