Transcript Lecture03

15-829B/18-849B/95-811A/19-729A
Internet-Scale Sensor Systems:
Design and Policy
Lecture 3 – Code Overview &
Project Ideas
Outline

Code Overview

Project Ideas
01-21-03
Lecture 3
2
Code Availability


http://www.intel-iris.net
Code accessible via CVS
 What


is CVS  version control system
Useful for group access to source code
Multiple people can edit the same file but conflicts may
occur
 Anonymous
01-21-03
CVS  can’t check in code
Lecture 3
3
Mailing-lists

Class members
 [email protected]

Iriscode developers
 [email protected]

Managed by [email protected]
01-21-03
Lecture 3
4
Using Laptop

Laptop setup
 irisnet and root account  passwords = irisnet

Feel free to customize account but don’t change password
IrisNet source code checked out in ~irisnet/IRISNET
 Redhat 8.0
Boot with camera attached
 Say configure at all the configuration prompts
Log in as irisnet
Start X server
Network configuration
 System settings  network
 Add…  wireless  lucent  SSID = CMU
 Activate
 Start browser with outside CMU URL  register wireless





01-21-03
Lecture 3
5
Building IrisNet



cd IRISNET
export CVS_RSH=ssh
cvs login
 password


cvs up -d -P
./install
 Should

= anonymous
build without error
Try test suite
 cd
01-21-03
~/IRISNET/TestSuite; ./testall.sh
Lecture 3
6
Components

SA





OA




Java-based
Base OA code
Apache Xindice XML database
Logger


C-based
Base SA code
OpenCV
CamStream webcam viewer
NAM network simulation animator
Applications
01-21-03
Lecture 3
7
SA Architecture
Sensor
Feed
Senselet
Shared
Memory
Senselet
Network
Senselet
SA Daemon
01-21-03
Lecture 3
8
SA – Sensor Feed

Read from sensor and place info in shared
memory
 One


process per sensor
Sensor readings are stored in circular buffer
Provides access to historical measurements
as space permits
01-21-03
Lecture 3
9
SA – Starting the Sensor Feed



cd SA/IrisWebcam
./runwebcam.sh to use real camera
./loadImage to load one image
 ./loadImage
images/pX.jpg 75
 X = number of full spots = 0..6
 75 = shared memory key for IrisNet


./loadImages to cycle through files in images
subdir
./showImage shows the current image
01-21-03
Lecture 3
10
SA – CamStream

CamStream provides an interface to
webcams and a bunch of useful tools
 E.g.,

webcam capture/record
Needs gcc 2.95 (not installed on laptops) to
compile completely
 Gcc
3.2 only compiles the few libraries critical to
IrisNet
01-21-03
Lecture 3
11
SA – Senselet

Senselet
 One
senselet per sensor service
 Each senselet runs as a separate process

Senselet typically does:
1) take sensor data from shared memory
2) processes data to produce result
3) Transmits result to configured OA
4) Results may be stored back in shared memory
01-21-03
Lecture 3
12
SA – Running Senselet

./SAControl 127.0.0.1 3456 “S 127.0.0.1
6789 parking” executes parking detection
senselet
 Need
to first run “Util/Portsink/portsink 6789” to
discard data
 Can load new images to see changes in result
 Can use similar technique to test your code for
mini-project
01-21-03
Lecture 3
13
SA – Example Senselet




cd Applications/parking/SA
parking.cc contains parking space senselet
Main function called Start(FilterParameter param)
Typical structure of main function

Open shared memory
 cvCreateImageHeader and cvSetImageData calls retrieve
video image
 openCV calls to process image data
 Send data to the OA
01-21-03
Lecture 3
14
SA – SA Daemon

Manages the execution of senselets


Accepts commands from OAs to start/stop execution
Text-based command protocol (port #3456)

L <OA_IP> <OA_PORT> <senselet filename> <senselet
name> <senselet code>


S <OA_IP> <OA_PORT> <senselet name>


starts execution of a senselet and transmits output to
specified OA
U <OA_IP> <OA_PORT> <senselet name>

01-21-03
uploads the code for a senselet and places it in filesystem
stop execution of a senselet
Lecture 3
15
SA – SA Daemon

Starting
 cd
SA/IrisSA/src
 ./runsa

Controlling
 Normally
controlled by OA’s
 cd Util/SAControl
 ./SAControl to manually send commands
01-21-03
Lecture 3
16
OA - Architecture
Xindice
01-21-03
OA Daemon
Lecture 3
Network
17
OA – Xindice

What does it do?
 Local XML database engine
 Stores XML documents, handles Xpath 1.0 (mostly select and
update)
 Interfaces




Command line  enter Xpath
Java API
What doesn’t it do [well]
 Xquery, XSLT
 XSLT processing  done in separate Java library
 Image storage
How do we use it
 Each service has a single XML document that stores sensor
readings and static metadata
01-21-03
Lecture 3
18
OA – Starting Xindice


cd packages/xml-xindice-1.0
./xindice.server start
 Make



sure that config/xindice.pid does not exist
export XINDICE_HOME=`pwd`
cd packages/xml-xindice-1.0/bin
Run ./xinidiceadmin to control database
01-21-03
Lecture 3
19
OA – OA Daemon


Listens on port 6789
Handles processing/forwarding of queries
 Uses

XSLT to query Xindice database
Manages partitioning of database across
nodes
 DNS
entries
 Reaction to load
01-21-03
Lecture 3
20
OA – OA Daemon Messages

Query <srcPort> <id> <fragment #> <root> <Xpath query>


Reply <id> <fragment #> <replying OA> <response>



Split an OA
Delete database <database name>
Load data from SA <num xupdates> <xupdates>


Start a new OA
Delegate ownership <targetIP> <targetPort> <Xpath query>


Answer to a query
Take ownership <schema>


Process the XPath query, id identifies source query made at root,
fragment identifies this particular subquery
Used by SAs to add to database
Update DNS <database name>

01-21-03
Use dynamic DNS
Lecture 3
21
OA – OA Daemon

Running

cd OA/IrisOA
 Edit oa.cfg if needed
 make run

Controlling

make runcl


Type help to see interface
Running a Service

cd Applications/parking/OA
 Look at demodataone.xml
 Follow handout instructions to load xml document
01-21-03
Lecture 3
22
Logging

What are the OAs/SAs doing?
all messages  currently uses a central
server
 Log

Challenge: how to order and playback log
messages
 Lamport
clocks to ensure causal order
 ns-2 network animator (nam) used to playback
log

01-21-03
What is nam?
Lecture 3
23
Logging

Running the logger

cd logger/IrisLogger/src
 runnam.sh

Running NAM

cd logger/nam-1.0a11a_iris
 ./nam ../IrisLogger/src/logfile.6

Currently logging must be carefully tuned to the
application  manual steps involved:

Name and layout of nodes in animation
 Conversion of logfile node names to nam nodes identifiers
01-21-03
Lecture 3
24
Outline

Code Overview

Project Ideas
01-21-03
Lecture 3
25
Projects


2 or 3-person groups
IrisNet-based
 Mini-project

provides intro to IrisNet
Expectations
 10
page report + presentation
 Workshop quality results

Project ideas
 Will
01-21-03
be posted on Web pages
Lecture 3
26
Projects (cont.)

Generous donation from Intel



20 laptops + cameras
10 desktops
Each project group will receive 2 laptops and 3
cameras

Handed out TODAY in CMCL lab 3604 Wean Hall




Only to enrolled students, other students will need to wait
No replacements – take good care of them
No grade until you return them in good condition!
Interesting deadlines


01-21-03
Sensys – Apr 8th
Mobicom workshops – June middle
Lecture 3
27
Applications – Monitoring Interesting Places







At lunch places
At grad lounge foosball table
NSH Atrium
Find me a free conference rooms
Tennis/raquetball/etc. court avail
Desk area/terminal room availability
Car theft monitor


Call/email owner if thief is near car!
Traffic monitoring


01-21-03
Auto traffic (traffic jams)
Throughput of area (cars, people) - speed trap
Lecture 3
28
Applications – Object Tracking





Person tracking
Where did my child/pet go
Advisor/advisee avoidance
Location of my/someone else's car
Inventory control
01-21-03
Lecture 3
29
Other Service Types

Audio sensor-based applications
 Identify
language spoken
 Identify individual based on voice
 Triggered sensor applications


Record picture when car horn is heard
Network monitoring as an IrisNet application
 Intrusion
01-21-03
detection system
Lecture 3
30
Other Service Types – Environment
Modeling

Smart room support
 3d

positioning based on multiple sensors
Virtual reality tour
 Take
the sensor input to create parts of a virtual
reality

Weather monitoring
01-21-03
Lecture 3
31
Applications – General Challenges

Image processing
 How
do you identify objects of interest?
 Person/object counting techniques

Motion detection based
 Identifying
the same object in different views
 Handoff of tracking data from one sensor to next
01-21-03
Lecture 3
32
Applications – General Challenges


Privacy issues
 Access control to OA database
 How does a person opt out of a surveillance
Query processing
 What type of data schema for sensor readings?
 How are historic queries handled
 Data mining

01-21-03
Long term trends – e.g., in parking space availability or
waiting lines
Lecture 3
33
Infrastructure

Incorporating new sensor types in IrisNet
infrastructure
Sensor motes – how do you modify the SA programming
model to accommodate motes?
 Others: mobile sensors, public webcams, smart camera
phones


Making IrisNet infrastructure robust to failures

Replicating part of database

How to handle dynamic vs. static parts of database
Handling failures in routing of queries – e.g., due to
caching?
 Distributed monitoring of system and on-demand collection
of logs

01-21-03
Lecture 3
34
Infrastructure – Energy Constraints



Power management for local processing, e.g., how accurately
can we predict energy consumption?
What is the energy tradeoff between local processing of data vs.
sending the data to do remote processing?
Running a CPU, a sensor device, or a communication device in
sleep mode can save energy considerably. An approach for
saving power is thus to operate our devices mostly in sleep
mode, and have them turn on periodically.
 How much accuracy does our sensor data loose
given some duty cycle?
 Can we find more intelligent scheduling algorithms than simply
uniform duty cycles (on during 100ms each second)?
 What about using low-energy sensors to schedule more
power-hungry sensors?
01-21-03
Lecture 3
35
Infrastructure

Location-based services
 How
could we incorporate location-specific
information in our sensors?
 How could we establish or verify the location of a
sensor?


Using video landmarks
Image Processing
we anonymize raw sensor feed – e.g., by
blurring people in image
 Can
01-21-03
Lecture 3
36
Infrastructure – Policy/Security

How can a user ensure that a video feed has not
been “misused”?




E.g., monitor the output XML, perform test queries on
system
Assuming an open environment (i.e., no central
certificate authority everybody trusts), how can we
establish trust between unrelated entities?
How do we ensure that sensor data we receive is
trustworthy and originates from the correct sensor?
If anyone can make queries/program sensors, how
do we protect the system from a denial-of-service
attack?
01-21-03
Lecture 3
37
Infrastructure

DNS

Performance evaluation
 DHTs as an alternative

Code safety and resource allocation on SAs/OAs

How are services protected from each other
 How are nodes protected from malicious services that
consume resources

Storage use on SAs

Support for historic sensor reading retrieval
 Impact on result sharing
01-21-03
Lecture 3
38
Infrastructure

Push vs. Pull of data
 Impact
on monitoring of failed nodes
 Impact on caching/response time for queries

Handling aggregate fields in OA database
01-21-03
Lecture 3
39
Next Lecture



Image processing
OpenCV library
Assigned reading:
 TBA
01-21-03
Lecture 3
40