This repo contains scripts for collecting data from WiROS using AWS Services by BOTO3 Software Development Kit
data_collection/_CONST.py
- Configuration file to setup all parameters, including AWS credentials, DB names, data collector and reader configs, and etc.data_collection/collector.py
- Data collector using on monitoring devices. Listens to ROS topic/csi
and upload data to dynamoDB and S3bucket.data_collection/data_reader.py
- Data reader containing methods to query, download and parse data to local.
To get started with WiROS, follow the instructions on WiROS, especially the README in the CSI Node to configure your hardware and local setup.
- Create an AWS Account:
- If you don't already have an AWS account, create one by following the AWS sign-up process.
- Login and Select Your Server Region
- Interface options are on the top right corner of AWS console page.
-
Go to AWS Service ---> DynamoDB ---> Tables ---> Create Table
-
Configure the table with the following parameters
- Table name = your_table_name
- Partition key = txmac (string)
- Sort Key = time_stamp (number)
- Customize settings ---> Read/write capacity settings ---> On-demand
- maximum read >= 100
- maximum write >= 100 * number_of_devices
- Note: upscale these two if throughput limit reaches, remember to monitor your cost!
- Modify other settings if needed
- Create Table
-
Go to AWS Service ---> S3 ---> Buckets ---> Create Bucket
-
Table name = your_table_name
-
Create bucket with default settings (change configs if needed)
-
Go to AWS Service ---> IAM ---> User Groups ---> Create Group
-
Configure the table with the following parameters
- Group name = your_group_name
- Attach permissions policies
- Search and tick
AmazonS3FullAccess
andAmazonDynamoDBFullAccess
- Search and tick
- Create users
- For every data collector (e.g. RPi), create a new user
- User name = your_deivce_name
- Add user to group
- tick group
your_group_name
you just created
- tick group
- Go to users detail page by directly clicking the
user name
- In the summary section, click
Create access key
- Choose use case
Local code
and tick "I understand the above recommendation and want to proceed to create an access key." - Skip the tag section unless needed
- In the summary section, click
- Click
Create access key
, keep this key by other download the.csv
file or copy to your document for later access.
-
Clone this repo on your device for data collection:
git clone https://github.com/ucsdwcsng/wiros_data_collection.git
-
Go to the data_collection folder
cd wiros_data_collection/data_collection/
- Edit
_CONST.py
- Modify these fields to the previous set values
-
tip: you can find your server area code by where you select your server area
(e.g.
US West (N. California) us-west-1
)
-
DB_NAME = "your db name"
AWS_ACCESS_KEY_ID = "your access key"
AWS_SECRET_ACCESS_KEY = "your secret key"
BUCKET_NAME = "your bucket name"
SERVER_AREA = "your server area"
- Launch a CSI tool that will publish CSI messages on ROS topic
/csi
-
e.g.
cd YOUR_WIROS_FOLDER/src/wiros_csi_node/launch/ roslaunch basic.launch
-
Go to
data_collection
foldercd YOUR_COLLECTOR_FOLDER/wiros_data_collection/data_collection chmod +x ./run_collector.sh ./run_collector.sh
- If running first time, the bash script will install
boto3
, which is required for the collector
-
Repeat the first step here to start WiROS
-
Go to
data_collection
foldercd YOUR_COLLECTOR_FOLDER/wiros_data_collection/data_collection
-
modify the following fields of your
_CONST.py
PARTITION_KEY_VALUE = "mac_addr_of_your_target_device(e.g. 5e:3e:12:f4:3a:36)" SORT_KEY_UPPER_BOUND = 1722981112 SORT_KEY_UPPER_BOUND = 1722981152 DEVICE_NAME = "test" CSV_FOR_NEEDED_FILES = True DOWNLOAD_NEEDED_FILES = True
- Modify
SORT_KEY_UPPER_BOUND
andSORT_KEY_UPPER_BOUND
to change the query range - Tip: use time_stamp converter tools or APIs to translate to and from time_stamp to human-readable date. (e.g. Epoch Converter)
-
Run the example CSI visualizer
chmod +x ./run_reader.sh ./run_reader.sh
- get a user with
AWSIoTConfigAccess
permission - run the env set secrete access and access