Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Completed file and script cutting implementations, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Mar 30, 2017
2 parents 50f1817 + 51d9dc7 commit 96ca82d
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 57 deletions.
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
FROM python:2.7
FROM armhf/python:2.7
MAINTAINER Cem Gokmen <[email protected]>

COPY . /verne
WORKDIR /verne

RUN chmod +x install_git.sh
RUN ./install_git.sh

RUN chmod +x install_rtimulib.sh
RUN ./install_rtimulib.sh

RUN pip install -r requirements.txt

VOLUME /dev/uart
VOLUME /dev/i2c-0
VOLUME /dev/i2c-1
VOLUME /data

CMD python main.py
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ To run the project, a container must be created with this image and the correct
```
docker create \
--name=verne
-v /dev/ttyAMA0:/dev/uart \
-v /dev/i2c-1:/dev/i2c-1 \
--device /dev/ttyAMA0 \
--device /dev/i2c-1 \
-v /home/pi/vernedata:/data \
--restart=unless-stopped \
--restart=on-failure \
gtviples/verne
```

Expand Down
66 changes: 33 additions & 33 deletions RTIMULib.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# 8 = STM L3GD20H + LSM303DLHC
# 9 = Bosch BMX055
# 10 = Bosch BNX055
IMUType=0
IMUType=6

#
# Fusion type type -
Expand Down Expand Up @@ -48,7 +48,7 @@ SPISpeed=500000

#
# I2C slave address (filled in automatically by auto discover)
I2CSlaveAddress=0
I2CSlaveAddress=107

#
# IMU axis rotation - see RTIMU.h for details
Expand Down Expand Up @@ -82,13 +82,13 @@ I2CHumidityAddress=0
#

# Compass calibration settings
CompassCalValid=false
CompassCalMinX=0.000000
CompassCalMinY=0.000000
CompassCalMinZ=0.000000
CompassCalMaxX=0.000000
CompassCalMaxY=0.000000
CompassCalMaxZ=0.000000
CompassCalValid=true
CompassCalMinX=-59.988636
CompassCalMinY=-23.912876
CompassCalMinZ=-61.714367
CompassCalMaxX=47.611153
CompassCalMaxY=86.796547
CompassCalMaxZ=42.061466

# #####################################################################
#
Expand All @@ -101,40 +101,40 @@ compassAdjDeclination=0.000000
#

# Compass ellipsoid calibration
compassCalEllipsoidValid=false
compassCalOffsetX=0.000000
compassCalOffsetY=0.000000
compassCalOffsetZ=0.000000
compassCalCorr11=1.000000
compassCalCorr12=0.000000
compassCalCorr13=0.000000
compassCalCorr21=0.000000
compassCalCorr22=1.000000
compassCalCorr23=0.000000
compassCalCorr31=0.000000
compassCalCorr32=0.000000
compassCalCorr33=1.000000
compassCalEllipsoidValid=true
compassCalOffsetX=-0.523097
compassCalOffsetY=2.773693
compassCalOffsetZ=-1.804364
compassCalCorr11=0.980180
compassCalCorr12=0.010728
compassCalCorr13=0.001986
compassCalCorr21=0.010728
compassCalCorr22=0.992445
compassCalCorr23=-0.007001
compassCalCorr31=0.001986
compassCalCorr32=-0.007001
compassCalCorr33=0.979710

# #####################################################################
#

# Accel calibration
AccelCalValid=false
AccelCalMinX=0.000000
AccelCalMinY=0.000000
AccelCalMinZ=0.000000
AccelCalMaxX=0.000000
AccelCalMaxY=0.000000
AccelCalMaxZ=0.000000
AccelCalValid=true
AccelCalMinX=-0.992136
AccelCalMinY=-1.006543
AccelCalMinZ=-1.011658
AccelCalMaxX=1.011742
AccelCalMaxY=0.999970
AccelCalMaxZ=0.990727

# #####################################################################
#

# Saved gyro bias data
GyroBiasValid=false
GyroBiasX=0.000000
GyroBiasY=0.000000
GyroBiasZ=0.000000
GyroBiasValid=true
GyroBiasX=0.006298
GyroBiasY=0.044090
GyroBiasZ=-0.000801

# #####################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion install_git.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -ex #Fail if any line fails, print everything

apt-get update
Expand Down
2 changes: 1 addition & 1 deletion install_rtimulib.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -ex #Fail if any line fails, print everything

apt-get update
Expand Down
13 changes: 8 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def getCSVFilesFromModules(modules, missionTime, i):
f = open('/data/%s-%d.csv' % (m, i), 'wb')
writer = csv.writer(f, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL)

writer.writerow([missionTime])
printableMissionTime = missionTime - datetime.fromtimestamp(0)
writer.writerow([int(printableMissionTime.total_seconds() * 1000)])

csvs[m] = (f, writer)

Expand Down Expand Up @@ -61,7 +62,7 @@ def closeCSVFiles(csvs):
# Load the modules
modules = {}
modules['imu'] = IMUModule(logger.getChild("imu"))
modules['geiger'] = GeigerCounterModule(logger.getChild("geiger"), "/dev/uart", 9600)
modules['geiger'] = GeigerCounterModule(logger.getChild("geiger"), "/dev/ttyAMA0", 9600)

missionTime = datetime.now()
timeToKill = missionTime + timedelta(hours=killScriptAfterHours)
Expand Down Expand Up @@ -102,13 +103,15 @@ def closeCSVFiles(csvs):
for m in modules.keys():
data = modules[m].poll(missionElapsedTime)

if len(data) > 0:
writer = csvs[m][0]
if data is not None and len(data) > 0:
writer = csvs[m][1]

for datum in data:
writer.writerow([missionElapsedTime] + list(datum))

if killer.kill_now:
break

logger.info("The eagle has landed: stopping recording. Goodbye!")
closeCSVFiles(csvs)

logger.info("The eagle has landed: stopping recording. Goodbye!")
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pyserial==3.3
pyserial==3.3
PyYAML==3.12
10 changes: 5 additions & 5 deletions sensormodules/GeigerCounterModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def poll(self, dt):

data = self.sm.poll(dt)

retval = []
if data is not None:
retval = []
for c in data:
retval.append(c)

for c in data:
retval.append(c)

return retval
return retval
4 changes: 3 additions & 1 deletion sensormodules/IMUModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def __init__(self, logger):
imu.setCompassEnable(True)

self.imu = imu
self.pollInterval = imu.IMUGetPollInterval()
self.pollInterval = IMUModule.MILLISECOND_POLLING_INTERVAL
self.logger = logger
self.data = None
self.lastPoll = None

def poll(self, dt):
if self.imu.IMURead():
Expand Down

0 comments on commit 96ca82d

Please sign in to comment.