Skip to content

Commit

Permalink
Euler angles-based grid
Browse files Browse the repository at this point in the history
  • Loading branch information
stelian56 committed Feb 20, 2015
1 parent 025a0d8 commit 8fd0256
Show file tree
Hide file tree
Showing 11 changed files with 1,538 additions and 1,229 deletions.
11 changes: 3 additions & 8 deletions bmconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
"maxUpdateRate": 100,
"readings": [
{
"name": "quat",
"command": "getTaredOrientationAsQuaternion",
"components": ["q0", "q1", "q2", "q3"]
},
{
"name": "acc",
"command": "getCorrectedAccelerometerVector",
"components": ["x", "y", "z"]
"name": "angles",
"command": "getTaredOrientationAsEulerAngles",
"components": ["pitch", "yaw", "roll"]
}
]
},
Expand Down
21 changes: 12 additions & 9 deletions bmserver.py → bodymusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

config_file_name = "bmconfig.json"
log_dir = "log"
log_file_regex = re.compile(".+\.(.+)\.log")

class BMHttpHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def __init__(self, on_start, on_stop, on_playback, *args):
Expand Down Expand Up @@ -165,15 +164,19 @@ def __init__(self, config, update_rate, on_sensor_data, stop_event):
self.sensors = None

def create_log_file(self):
file_names = glob.glob("%s/*.log" % log_dir)
today = datetime.date.today()
file_names = glob.glob("%s/%s.*.log" % (log_dir, today))
file_count = len(file_names)
suffix = "1"
suffix = 1
if file_count > 0:
file_names.sort()
last_file_name = file_names.pop()
match = log_file_regex.match(last_file_name)
suffix = int(match.group(1)) + 1
file_path = "%s/%s.%s.log" % (log_dir, datetime.date.today(), suffix)
regex = re.compile(".+\.(.+)\.log")
suffixes = []
for file_name in file_names:
match = regex.match(file_name)
suffixes.append(int(match.group(1)))
suffixes.sort()
suffix = suffixes.pop() + 1
file_path = "%s/%s.%s.log" % (log_dir, today, suffix)
dir_name = os.path.dirname(file_path)
if not os.path.exists(dir_name):
os.makedirs(dir_name)
Expand All @@ -183,7 +186,6 @@ def init(self):
self.log_file = self.create_log_file()
if not self.log_file:
return False
print "Started logging to %s" % self.log_file.name
device_list = api.getComPorts(filter = api.TSS_FIND_DNG|api.TSS_FIND_WL)
for device_port in device_list:
com_port, device_name, device_type = device_port
Expand Down Expand Up @@ -231,6 +233,7 @@ def init(self):
eval(expression)
sensor.startStreaming()
print "Started sensors at update rate %dHz" % self.update_rate
print "Started logging to %s" % self.log_file.name
return True

def stop(self):
Expand Down
4 changes: 0 additions & 4 deletions css/bm.css

This file was deleted.

75 changes: 75 additions & 0 deletions css/bodymusic.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
body {
margin: 10px;
}
.bodymusic_ribbon {
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
}
.bodymusic_legendicon {
display: inline-block;
width: 15px;
height: 15px;
margin-left: 15px;
}
.bodymusic_legendlabel {
margin-left: 3px;
}
.bodymusic_staff {
position: relative;
width: 100%;
border: 1px solid black;
}
.bodymusic_plot {
position: relative;
width: 100%;
margin: -1px 0 0 0;
border: 1px solid black;
z-index: 1;
}
.bodymusic_veil {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
margin: 0;
background-color: black;
opacity: 0.3;
}
.bodymusic_tooltip {
position: absolute;
display: none;
padding: 5px;
background-color: #ffffcc;
border: 1px solid black;
z-index: 2;
}
svg {
width: 100%;
height: 100%;
}
line {
display: none;
}
circle {
display: none;
}
ellipse {
display: none;
}
text {
font-size: 0.9em;
}
.bodymusic_updaterate {
margin-left: 5px;
margin-right: 10px;
width: 60px;
}
.bodymusic_logfile {
margin-left: 10px;
margin-right: 10px;
}
.bodymusic_button {
margin-right: 10px;
}
26 changes: 0 additions & 26 deletions html/bm.html

This file was deleted.

11 changes: 11 additions & 0 deletions html/bodymusic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head>
<script src="/js/jquery-2.1.1.js"></script>
<script src="/js/bodymusic.js"></script>
<link rel="stylesheet" type="text/css" href="/css/bodymusic.css"/>
<title>Body Music</title>
</head>

<body/>

</html>
63 changes: 0 additions & 63 deletions html/play.html

This file was deleted.

77 changes: 0 additions & 77 deletions js/bm.js

This file was deleted.

Loading

0 comments on commit 8fd0256

Please sign in to comment.