440 likes | 535 Views
Wireless OEP Breakout Session. David Culler & Shankar Sastry University of California, Berkeley. Agenda. Additional Technical Background on HW/SW platform Additional Technical Background on Challenge Application Development Identify how each project will use the platform
E N D
Wireless OEP Breakout Session David Culler & Shankar Sastry University of California, Berkeley
Agenda • Additional Technical Background on HW/SW platform • Additional Technical Background on Challenge Application Development • Identify how each project will use the platform • Solicit platform requirement input in preparation for Aug. freeze • Identify components that projects will contribute NEST Wireless OEP Breakout
Challenge Application composition services coordination services synthesis services SW platform HW platform sensors processing communication storage actuators NEST Program Structure NEST Wireless OEP Breakout
Challenge Application composition services coordination services synthesis services SW platform HW platform sensors processing communication storage actuators NEST Program Structure – evolution Composition Open Platform initial low-power wireless Open Platform 100+ tiny devices for alg. dev. year 3 2 1 0 NEST Wireless OEP Breakout
Platform Background • material provided as reference • coverage directed by discussion NEST Wireless OEP Breakout
sensors actuators storage network Characteristics of Network Sens/Act • Small physical size and low power consumption • Concurrency-intensive operation • multiple flows, not wait-command-respond • Limited Physical Parallelism and Controller Hierarchy • primitive direct-to-device interface • Asynchronous and synchronous devices • Diversity in Design and Usage • application specific, not general purpose • huge device variation => efficient modularity => migration across HW/SW boundary • Robust Operation • numerous, unattended, critical => narrow interfaces NEST Wireless OEP Breakout
HW Platforms • Current: SmartDust MacroMOTE => Renes => • Phase 1: 6 months => algorithm studies • Mote++, MEMS sensors, TinyOS • more microcontroller • atmega163 => 2x storage • atmega103 => 128K flash, 4k ram • TIMSP430 => 60k flash, 2k ram, HW *, ... • many subtle factors • RFM with ASH • too early for bluetooth • 100+ nodes for < 20K$ • Phase 2: 30 months => composition of alg’s • ARM-power, Bluetooth physical • integrated system • OS?? NEST Wireless OEP Breakout
Isun Motherboard: Processor Core • Atmel AVR • Clock speed: 4 MHz • Memory • 8 Kbytes of program memory (flash) • 512 bytes of data RAM • 512 bytes of EEPROM on chip (write: 4 ms/byte) • 32 8 bit registers • IO capabilities • 32 general purpose IO lines • Some lines also serve more specialized purposes, e.g. UART • 10-bit 8-channel ADC • Connector interface means that the IO lines serve a more specific purposes • Interrupts • No interrupt queuing • 256K EEPROM secondary store over I2C NEST Wireless OEP Breakout
Radio Circuit • RFM Monolithics TR1000 916 MHz radio • On/off keying at 10 kbps (max. 19.2 kbps) • Capable of 115 kbps using amplitude shift keying • Capable of turning on in 30 us • Processor interface • Raw, unbuffered access to transmit (RFM TX) and receive (RFM RX) • TX current => signal strength • Requires DC balanced signal – an equal number of 1’s and 0’s in the signal • Sampling on reception and modulating on transmission done is software • Too much noise in received signal to use UART for sampling • Signal-strength Sensing and Control NEST Wireless OEP Breakout
Expansion Connector • Documented hardware interface • Swap components on either side of the connector while preserving investment in sensors or main boards • Sensor interfaces • 4 lines dedicated to switching components on and off • 7 analog voltage sensing lines • 2 I2C busses • SPI • UART lines • Debugging aids • All radio-related signals: RX, TX, base band, control signals, signal strength • Programming interfaces • SPI and reset signals for the main processor and the coprocessor • Ground, Vcc for both analog and digital circuits • 12 lines reserved for future use NEST Wireless OEP Breakout
Sensor Boards • Basic Sensor Proto • Photo resistor – PW1 and ADC1 • Thermistor – PW2 and ADC2 • Prototyping area • Vibration Sensor • Photo resistor: PW1 and ADC1 • Thermistor: PW4, ADC6 • 2 axis accelerometer: ADC2 and 3, PW2 • Digital temperature: I2C Bus 1 • 2 axis magnetometer • Convert magnetic fields into a differential output • Field range -2 to +2 gauss • Sensitivity 3.2mV/V/gauss • Resolution: 27gauss at 10Hz • Bandwidth: 5MHz NEST Wireless OEP Breakout
Panasonic CR2354 560 mAh Basic Power Breakdown… • But what does this mean? • Lithium Battery runs for 35 hours at peak load and year at minimum load! • A one byte transmission uses the same energy as approx 11000 cycles of computation. • Idleness is not enough, sleep! • short and long control loops * 10 uA for Dallas digital pot NEST Wireless OEP Breakout
A Operating System for Tiny Devices? • Traditional approaches • command processing loop (wait request, act, respond) • monolithic event processing • bring full thread/socket posix regime to platform • Alternative • provide framework for concurrency and modularity • never poll, never block • interleaving flows, events, energy management • allow appropriate abstractions to emerge NEST Wireless OEP Breakout
msg_rec(type, data) msg_send_done) Tiny OS Concepts • Scheduler + Graph of Components • constrained two-level scheduling model: threads + events • Component: • Commands, • Event Handlers • Frame (storage) • Tasks (concurrency) • Constrained Storage Model • frame per component, shared stack, no heap • Very lean multithreading • Efficient Layering Events Commands send_msg(addr, type, data) power(mode) init Messaging Component internal thread Internal State TX_packet(buf) Power(mode) TX_packet_done (success) init RX_packet_done (buffer) NEST Wireless OEP Breakout
Application = Component Graph Route map router sensor appln application Active Messages Serial Packet Radio Packet packet Temp photo SW HW UART Radio byte ADC byte Example: ad hoc, multi-hop routing of photo sensor readings clocks RFM bit NEST Wireless OEP Breakout
Storage Breakdown (C Code) 3450 B code 226 B data NEST Wireless OEP Breakout
DARPA 29 palms demo • UAV drops nodes along road, • hot-water pipe insulation for package • Nodes self configure into linear network • Calibrate magnetometers • Each detects passing vehicle • Share filtered sensor data with 5 neighbors • Each calculates estimated direction & velocity • Share results • As plane passes by, • joins network • upload as much of missing dataset as possible from each node when in range • 7.5 KB of code! NEST Wireless OEP Breakout
Radio Packet packet Radio byte byte RFM bit TOS Execution Model • commands request action • ack/nack at every boundary • call cmd or post task • events notify occurrence • HW intrpt at lowest level • may signal events • call cmds • post tasks • Tasks provide logical concurrency • preempted by events • Migration of HW/SW boundary data processing application comp message-event driven active message event-driven packet-pump crc event-driven byte-pump encode/decode event-driven bit-pump NEST Wireless OEP Breakout
Dynamics of Events and Threads bit event => end of byte => end of packet => end of msg send thread posted to start send next message bit event filtered at byte layer radio takes clock events to detect recv NEST Wireless OEP Breakout
Event-Driven Sensor Data char TOS_EVENT(SENS_OUTPUT_CLOCK_EVENT)(){ return TOS_CALL_COMMAND(SENS_GET_DATA)(); } char TOS_EVENT(SENS_DATA_READY)(int data){ return TOS_CALL_COMMAND(SENS_OUTPUT_OUTPUT)((data >> 2) &0x7); } • clock event handler initiates data collection • sensor signals data ready event • data event handler calls output command • common pattern NEST Wireless OEP Breakout
MAIN SENS_OUTPUT LED hardware.h CLOCK PHOTO Component Composition include modules{ MAIN; SENS_OUTPUT; INT_TO_LEDS; CLOCK; PHOTO; }; MAIN:MAIN_SUB_INIT SENS_OUTPUT:SENS_OUTPUT_INIT MAIN:MAIN_SUB_START SENS_OUTPUT:SENS_OUTPUT_START SENS_OUTPUT:SENS_OUTPUT_CLOCK_EVENT CLOCK:CLOCK_FIRE_EVENT SENS_OUTPUT:SENS_OUTPUT_SUB_CLOCK_INIT CLOCK:CLOCK_INIT SENS_OUTPUT:SENS_OUTPUT_SUB_OUTPUT_INIT INT_TO_LEDS:INT_TO_LEDS_INIT SENS_OUTPUT:SENS_OUTPUT_OUTPUT_COMPLETE INT_TO_LEDS:INT_TO_LEDS_DONE SENS_OUTPUT:SENS_OUTPUT_OUTPUT INT_TO_LEDS:INT_TO_LEDS_OUTPUT SENS_OUTPUT:SENS_DATA_INIT PHOTO:PHOTO_INIT SENS_OUTPUT:SENS_GET_DATA PHOTO:PHOTO_GET_DATA SENS_OUTPUT:SENS_DATA_READY PHOTO:PHOTO_DATA_READY INT_TO_LEDS NEST Wireless OEP Breakout
TinyOS Execution Contexts Tasks events commands Interrupts Hardware NEST Wireless OEP Breakout
Typical application use of tasks • event driven data acquisition • schedule task to do computational portion char TOS_EVENT(MAGS_DATA_EVENT)(int data){ struct adc_packet* pack = (struct adc_packet*)(VAR(msg).data); printf("data_event\n"); VAR(reading) = data; TOS_POST_TASK(FILTER_DATA); ... NEST Wireless OEP Breakout mags.c
Filter Magnetometer Data Task TOS_TASK(FILTER_DATA){ int tmp; VAR(first) = VAR(first) - (VAR(first) >> 5); VAR(first) += VAR(reading); VAR(second) = VAR(second) - (VAR(second) >> 5); VAR(second) += VAR(first) >> 5; VAR(diff) = VAR(diff)-(VAR(diff) >> 5); tmp = VAR(first) - VAR(second); if(tmp < 0) tmp = -tmp; VAR(diff) += tmp; if((VAR(diff) >> 5) > 85){ TOS_CALL_COMMAND(MAGS_LEDg_on)(); VAR(led_on) = 255; } } • 128 Hz sampling rate • simple FIR filter • dynamic software tuning for centering the magnetometer signal (1208 bytes) • digital control of analog, not DSP • ADC (196 bytes) NEST Wireless OEP Breakout
Tasks in low-level operation • transmit packet • send command schedules task to calculate CRC • task initiated byte-level datapump • events keep the pump flowing • receive packet • receive event schedules task to check CRC • task signals packet ready if OK • byte-level tx/rx • task scheduled to encode/decode each complete byte • must take less time that byte data transfer • i2c component • i2c bus has long suspensive operations • tasks used to create split-phase interface • events can procede during bus transactions NEST Wireless OEP Breakout
Active Messages • Sending • Declare buffer storage in a frame • Request Transmission • Naming a handler • Handle Completion signal • Receiving • Declare a handler • Firing a handler • automatic upon arrival of corresponding message • behaves like any other event • Buffer management • strict ownership exchange • tx: done event => reuse • rx: must rtn a buffer • built-in wrapper TOS_FRAME_BEGIN(INT_TO_RFM_frame) { char pending; TOS_Msg msg; } TOS_FRAME_END(INT_TO_RFM_frame); NEST Wireless OEP Breakout
access appln msg buffer cast to defined format application specific ready check build msg request transmission destination identifier get handler identifier mark busy Send Message char TOS_COMMAND(INT_TO_RFM_OUTPUT)(int val){ int_to_led_msg* message = (int_to_led_msg*)VAR(msg).data; if (!VAR(pending)) { message->val = val; if (TOS_COMMAND(INT_TO_RFM_SUB_SEND_MSG)(TOS_MSG_BCAST, AM_MSG(INT_READING), &VAR(msg))) { VAR(pending) = 1; return 1; } } return 0; } msg buffer NEST Wireless OEP Breakout
Completion Event • Underlying message layer notifies all sending components of completion event • may need to resume activity after other’s completion • provides reference to sent buffer to identify action • Here event propagated as output done char TOS_EVENT(INT_TO_RFM_SUB_MSG_SEND_DONE)(TOS_MsgPtr sentBuffer){ if (VAR(pending) && sentBuffer == &VAR(data)) { VAR(pending) = 0; TOS_SIGNAL_EVENT(INT_TO_RFM_COMPLETE)(1); return 1; } return 0; } NEST Wireless OEP Breakout
Challenge Application Developmetn • Specification of challenge application is a process • layout how coordination and synthesis services plug in • develop platform requirements • Consider sequence of applications • interactive spaces • flock of model cars • Multi-agent pursuit-evasion NEST Wireless OEP Breakout
Challenge App: pursuer/evader contest active markers • Terrain:with obstacles • not accurately mapped obstacles • UAVs (pursuers) capable of: • flying between obstacles • seeing a limited region • placing active markers UAVs • Active Markers: • form sensor field • Evader capable of: • moving between obstacles (possibly actively avoiding detection) evader NEST Wireless OEP Breakout
obstacles UAVs evader The “rules” of the game • Terrain: • with fixed obstacles • not accurately mapped • UAVs (pursuers) capable of: • flying between obstacles • seeing a region around them (limited by the occlusions) • Evader capable of: • moving between obstacles (possibly actively avoiding detection) Objective: find the evader in minimum time NEST Wireless OEP Breakout
? Strategies for pursuit-evasion games LaValle, Latombe, Guibas, et al. considered a similar problem but assume the map of the region is known, the pursuers have perfect sensors, and worst case trajectories for the evaders: How many UAVs are needed to win the game in finite time? 1 agent is sufficient 2 agents are needed (no matter what strategy a single pursuer chooses, there is a trajectory for the evader that avoids detection) NEST Wireless OEP Breakout
Exploring a region to build a map Deng, Papadimitriou, et al., study the problem of building a map (seeing all points in the region) traversing the smallest possible distance. standard “keep wall to the right” algorithm algorithm that takes better advantage of the cameras capabilities NEST Wireless OEP Breakout
? A two step solution… • exploration followed by pursuit is not efficient • sensors are imprecise • worst case assumptions the trajectories of the evaders leads to very conservative results exploration pursuit NEST Wireless OEP Breakout
? A different approach… Use a probabilistic framework to combine exploration and pursuit-evasion games. exploration • Non determinism comes from: • poorly mapped terrain • noise and uncertainty in the sensors • probabilistic models for the motion of the evader and the UAVs pursuit NEST Wireless OEP Breakout
xgoal 1 2 4 … 5 16 .1|right .7|right 3 4 1 2 .1|right … .1|right 5 6 Markov Decision Processes timet {1, 2, 3,…} statext X := {1 ,2 ,…, 16} actionut U := {up, down, left, right} transition probability function p(x,x’,u) = P(xt+1=x’|xt=x, ut=u) control policy (deterministic): XU ut = (xt) (almost surely) control policy (stochastic): UX[0,1] P(ut= u| xt=x, ) =(u,x) NEST Wireless OEP Breakout
xgoal 1 2 4 … 5 16 0 with .1|right .7|right 3 4 1 2 .1|right 1|- … 5 6 Ø 1|- Markov Decision Processes costJ = E[Tgoal | ] (to be minimize) where Tgoal := min {t : xt=xgoal} one can also write (additive) .1|right optimal control policy* J* = minJ NEST Wireless OEP Breakout
Sub-optimal policies greedy policy (+) pursuit policy that, at each instant, maximizes the probability of finding the evader at the next time instant Q: How does one evaluate which control action will maximize the probability of finding the evader? ? NEST Wireless OEP Breakout
Sub-optimal policies greedy policy (+) pursuit policy that, at each instant, maximizes the probability of finding the evader at the next time instant Q: How does one evaluate which control action will maximize the probability of finding the evader? A: By keeping track of the probability of the evader being at each possible position probabilistic map for the position of the evader NEST Wireless OEP Breakout
Map building Problem: For given paths of several UAVs, how to fuse the data sensed by each of them (in real-time) to build a global map? NEST Wireless OEP Breakout
Probabilistic map building Problem: For given paths of several UAVs, how to fuse the data sensed by each of them (in real-time) to build a global map? Bayes’ rule NEST Wireless OEP Breakout
How each project will use the platform • ... NEST Wireless OEP Breakout
What components will be contributed • ... NEST Wireless OEP Breakout
What you’d like to see in the platform • ... NEST Wireless OEP Breakout