Skip to content
This repository was archived by the owner on Jan 18, 2019. It is now read-only.

Commit 474696b

Browse files
committed
in progress updates
1 parent e6314dd commit 474696b

36 files changed

+84
-570
lines changed

setup.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from setuptools import setup, find_packages
2+
from codecs import open
3+
from os import path
4+
5+
here = path.abspath(path.dirname(__file__))
6+
7+
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
8+
long_description = f.read()
9+
10+
setup(
11+
name="spacecraft",
12+
version="0.1.0",
13+
description="SpaceCRAFT - A module for rendering astro pi data in Minecraft",
14+
long_description=long_description,
15+
url="https://github.com/martinohanlon/SpaceCRAFT",
16+
author="Martin O'Hanlon",
17+
author_email="[email protected]",
18+
license="BSD",
19+
classifiers=[
20+
"Development Status :: 4 - Beta",
21+
"Programming Language :: Python :: 2",
22+
"Programming Language :: Python :: 3",
23+
"Topic :: Scientific/Engineering :: Astronomy",
24+
"Topic :: Scientific/Engineering :: Atmospheric Science",
25+
"Topic :: Education",
26+
"Intended Audience :: Education",
27+
"Intended Audience :: Science/Research",
28+
"License :: OSI Approved :: BSD License",
29+
30+
],
31+
keywords=[
32+
"raspberrypi",
33+
"astro pi",
34+
"astro pi hat",
35+
"sense hat",
36+
"minecraft",
37+
"spacecraft",
38+
],
39+
packages=find_packages(exclude=["poc", "scripts"]),
40+
install_requires=["astro-pi"],
41+
)

spacecraft/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

spacecraft/mcastroplayback.py

+42-34
Original file line numberDiff line numberDiff line change
@@ -42,52 +42,60 @@ def run(self):
4242
if apr.rowcount > 0:
4343

4444
#create connection to minecraft
45-
#mc = Minecraft.create()
45+
mc = Minecraft.create()
4646

4747
#find the position of where to put the ISS tower display
48-
#pos = mc.player.getTilePos()
49-
#pos.z -= 10
50-
#pos.y = mc.getHeight(pos.x, pos.z)
51-
52-
#create the iss tower display
53-
#isstowerdisplay = ISSTowerMinecraftDisplay(mc, pos)
54-
55-
#loop until its stopped
56-
found_row = True
57-
while self.stopped == False and found_row == True:
58-
#get the time started
59-
real_time_start = time()
60-
last_row_time = apr.get_time()
61-
62-
#update the ISS dispay with the data
63-
#isstowerdisplay.update(
64-
# apr.get_time(),
65-
# apr.get_cpu_temperature(),
66-
# apr.get_temperature(),
67-
# apr.get_humidity(),
68-
# apr.get_pressure(),
69-
# apr.get_orientation(),
70-
# apr.get_joystick())
48+
pos = mc.player.getTilePos()
49+
pos.z -= 10
50+
pos.y = mc.getHeight(pos.x, pos.z)
51+
52+
try:
53+
#create the iss tower display
54+
isstowerdisplay = ISSTowerMinecraftDisplay(mc, pos)
55+
56+
#loop until its stopped
57+
found_row = True
58+
while self.stopped == False and found_row == True:
59+
#get the time started
60+
real_time_start = time()
61+
last_row_time = apr.get_time()
62+
63+
#update the ISS dispay with the data
64+
isstowerdisplay.update(
65+
apr.get_time(),
66+
apr.get_cpu_temperature(),
67+
apr.get_temperature(),
68+
apr.get_humidity(),
69+
apr.get_pressure(),
70+
apr.get_orientation(),
71+
apr.get_joystick())
72+
73+
#move onto the next row
74+
found_row = apr.next()
75+
76+
#wait until the next row time
77+
if found_row:
78+
#wait until the time in the real world is greater than the time between the rows
79+
while (time() - real_time_start) < ((apr.get_time() - last_row_time) / self.speed) :
80+
sleep(0.001)
81+
finally:
82+
isstowerdisplay.clear()
83+
print("Playback {} finished".format(self.filename))
7184

72-
#move onto the next row
73-
found_row = apr.next()
74-
75-
#wait until the next row time
76-
if found_row:
77-
#wait until the time in the real world is greater than the time between the rows
78-
while (time() - real_time_start) < ((apr.get_time() - last_row_time) / self.speed) :
79-
sleep(0.001)
80-
85+
else:
86+
print("{} contained no data".format(self.filename))
87+
88+
#catch failed to open file error
8189
except IOError:
8290
print("Failed to open file '{}'.".format(self.filename))
8391
print(sys.exc_info()[1])
8492

93+
#catch any other error
8594
except:
8695
print(sys.exc_info()[0])
8796
print(sys.exc_info()[1])
8897

8998
finally:
90-
print("Playback {} finished".format(self.filename))
9199
self.running = False
92100
self.stopped = True
93101

spacecraft/mcpi/__init__.py

Whitespace-only changes.

spacecraft/mcpi/__init__.pyc

-134 Bytes
Binary file not shown.
-138 Bytes
Binary file not shown.
-143 Bytes
Binary file not shown.
-3.82 KB
Binary file not shown.
-3.26 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1.52 KB
Binary file not shown.
-1.18 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-863 Bytes
Binary file not shown.
-658 Bytes
Binary file not shown.
-4.96 KB
Binary file not shown.
-3.72 KB
Binary file not shown.

spacecraft/mcpi/block.py

-91
This file was deleted.

spacecraft/mcpi/block.pyc

-3.68 KB
Binary file not shown.

spacecraft/mcpi/connection.py

-81
This file was deleted.

spacecraft/mcpi/connection.pyc

-3.23 KB
Binary file not shown.

spacecraft/mcpi/event.py

-32
This file was deleted.

spacecraft/mcpi/event.pyc

-1.36 KB
Binary file not shown.

spacecraft/mcpi/exceptions.py

-5
This file was deleted.

spacecraft/mcpi/exceptions.pyc

-425 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)