Upload
thomasina-rich
View
216
Download
1
Embed Size (px)
Citation preview
15-829B/18-849B/95-811A/19-729AInternet-Scale Sensor Systems: Design and Policy
Lecture 3 – Code Overview & Project Ideas
Lecture 3 201-21-03
Outline
Code Overview
Project Ideas
Lecture 3 301-21-03
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 CVS can’t check in code
Lecture 3 401-21-03
Mailing-lists
Class members [email protected]
Iriscode developers [email protected]
Managed by [email protected]
Lecture 3 501-21-03
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
Lecture 3 601-21-03
Building IrisNet
cd IRISNET export CVS_RSH=ssh cvs login
password = anonymous cvs up -d -P ./install
Should build without error Try test suite
cd ~/IRISNET/TestSuite; ./testall.sh
Lecture 3 701-21-03
Components
SA C-based Base SA code OpenCV CamStream webcam viewer
OA Java-based Base OA code Apache Xindice XML database
Logger NAM network simulation animator
Applications
Lecture 3 801-21-03
SA Architecture
Shared Memory
SA Daemon
Sensor Feed
Senselet
Senselet
Senselet
Network
Lecture 3 901-21-03
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
Lecture 3 1001-21-03
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
Lecture 3 1101-21-03
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
Lecture 3 1201-21-03
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
Lecture 3 1301-21-03
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
Lecture 3 1401-21-03
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
Lecture 3 1501-21-03
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> uploads the code for a senselet and places it in filesystem
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>
stop execution of a senselet
Lecture 3 1601-21-03
SA – SA Daemon
Starting cd SA/IrisSA/src ./runsa
Controlling Normally controlled by OA’s cd Util/SAControl ./SAControl to manually send commands
Lecture 3 1701-21-03
OA - Architecture
Xindice OA Daemon Network
Lecture 3 1801-21-03
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
Lecture 3 1901-21-03
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
Lecture 3 2001-21-03
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
Lecture 3 2101-21-03
OA – OA Daemon Messages
Query <srcPort> <id> <fragment #> <root> <Xpath query> Process the XPath query, id identifies source query made at root,
fragment identifies this particular subquery Reply <id> <fragment #> <replying OA> <response>
Answer to a query Take ownership <schema>
Start a new OA Delegate ownership <targetIP> <targetPort> <Xpath query>
Split an OA Delete database <database name> Load data from SA <num xupdates> <xupdates>
Used by SAs to add to database Update DNS <database name>
Use dynamic DNS
Lecture 3 2201-21-03
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
Lecture 3 2301-21-03
Logging
What are the OAs/SAs doing? Log all messages currently uses a central
server Challenge: how to order and playback log
messages Lamport clocks to ensure causal order ns-2 network animator (nam) used to playback
log What is nam?
Lecture 3 2401-21-03
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
Lecture 3 2501-21-03
Outline
Code Overview
Project Ideas
Lecture 3 2601-21-03
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 be posted on Web pages
Lecture 3 2701-21-03
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 Sensys – Apr 8th
Mobicom workshops – June middle
Lecture 3 2801-21-03
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
Auto traffic (traffic jams) Throughput of area (cars, people) - speed trap
Lecture 3 2901-21-03
Applications – Object Tracking
Person tracking Where did my child/pet go Advisor/advisee avoidance Location of my/someone else's car Inventory control
Lecture 3 3001-21-03
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 detection system
Lecture 3 3101-21-03
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
Lecture 3 3201-21-03
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
Lecture 3 3301-21-03
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
Long term trends – e.g., in parking space availability or waiting lines
Lecture 3 3401-21-03
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
Lecture 3 3501-21-03
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?
Lecture 3 3601-21-03
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 Can we anonymize raw sensor feed – e.g., by
blurring people in image
Lecture 3 3701-21-03
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?
Lecture 3 3801-21-03
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
Lecture 3 3901-21-03
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
Lecture 3 4001-21-03
Next Lecture
Image processing OpenCV library Assigned reading:
TBA