Skip to content

Commit

Permalink
Merge branch 'master' into RoverFuncs
Browse files Browse the repository at this point in the history
  • Loading branch information
naoki-cpp authored Aug 16, 2019
2 parents efb820d + 3803760 commit 49c72cb
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 13 deletions.
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
# LYNCS-Noshiro2019
能代宇宙イベントのためのCanSatプログラム
[![Build Status](https://travis-ci.com/LYNCS-Keio/LYNCS-Noshiro2019.svg?branch=master)](https://travis-ci.com/LYNCS-Keio/LYNCS-Noshiro2019)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/LYNCS-Keio/LYNCS-Noshiro2019.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/LYNCS-Keio/LYNCS-Noshiro2019/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/LYNCS-Keio/LYNCS-Noshiro2019.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/LYNCS-Keio/LYNCS-Noshiro2019/context:python)

能代宇宙イベントのためのCanSatプログラム

```bash
cd raspberry_pi
```

```bash
sudo pigpio
```
```bash
python3 main.py
```
で実行できる。
# Dependencies
- opencv-python
- pynmea2
- smbus2
- pyserial
- RPI.GPIO
see [dependency graph](https://github.com/LYNCS-Keio/LYNCS-Noshiro2019/network/dependencies)
# Installation
pipenvでパッケージを再現できる。pipenvは次のコマンドでインストールできる。
```bash
pip install pipenv
```
パッケージのインストールには次のコマンドを使う。
```bash
pipenv install
```
パッケージの追加は次のようにしてできる。numpyをインストールする場合、
```bash
pipenv install numpy
```
のようにすればよい。
16 changes: 16 additions & 0 deletions raspberry_pi/lib/BME280/ave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

import core
import time

index = 1
pressure_sum = 0

try:
while True:
index += 1
pressure_sum += core.readData()[1]
time.sleep(0.001)

finally:
print(pressure_sum / index)
1 change: 1 addition & 0 deletions raspberry_pi/lib/DammyBME/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .core import *
48 changes: 48 additions & 0 deletions raspberry_pi/lib/DammyBME/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
#!usr/bin/python

import time

__all__ = ['readData']

def writeReg(reg_address, data):
pass


def get_calib_param():
pass

_dammy_bme_count = 0
_ascend_descend_flag = False ## False::上昇 True::降下
_dammy_gravity = 0.2

def readData():
global _dammy_bme_count
global _ascend_descend_flag
global _gnd_flag

mesure_high = _dammy_bme_count

if _ascend_descend_flag:
_dammy_bme_count -= _dammy_gravity

if not _ascend_descend_flag:
_dammy_bme_count += _dammy_gravity
if _dammy_bme_count >= 50:
_ascend_descend_flag = True

if _dammy_bme_count < 0:
_dammy_bme_count = 0

time.sleep(0.0005)
return [mesure_high, 0, 0]


if __name__ == '__main__':
try:
while True:
print(readData())
time.sleep(0.01)

except KeyboardInterrupt:
pass
2 changes: 1 addition & 1 deletion raspberry_pi/lib/capture/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ def __del__(self):
ca = capture()
time.sleep(2)
stream = ca.cap()
ca.flush(stream)
ca.flush()
del ca
1 change: 0 additions & 1 deletion raspberry_pi/lib/rover_gps/gpslist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
import time

pos = [None, None]
current_dir = os.path.dirname(os.path.abspath(__file__))

index = 0
Expand Down
9 changes: 4 additions & 5 deletions raspberry_pi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
current_dir = os.path.dirname(os.path.abspath(__file__))
pi = pigpio.pi()
pi.set_mode(PWM_pin, pigpio.OUTPUT)
duty_lock = 68500
duty_release = 62500
duty_lock = 85000
duty_release = 78500

mpu = MPU6050.MPU6050(0x68)

Expand All @@ -41,7 +41,6 @@
limit_bme = 10 #BMEがn回範囲内になったらbreak

bme_judge = RoverFuncs.BME_Judge()

try:
index = 0
filename = 'cameralog' + '%04d' % index
Expand All @@ -62,7 +61,7 @@

release_time = time.time()
time.sleep(2)
while 1:
while True:
height_BME = BME.readData()
row = [time.time()]
print(height_BME)
Expand Down Expand Up @@ -127,7 +126,7 @@

with open(current_dir + '/' + filename + '.csv', 'w') as c:
csv_writer = csv.writer(c, lineterminator='\n')
while 1:
while True:
pi.hardware_PWM(pinL, 50, int(dL))
pi.hardware_PWM(pinR, 50, int(dR))
if to_goal[0] < cam_dis:
Expand Down
27 changes: 27 additions & 0 deletions raspberry_pi/servo_adjust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-

import pigpio
import sys
import time

pi = pigpio.pi()


try:
DMUX_pin=[11,9,10]
DMUX_out = [1, 0, 0]
for pin in range(0, 2):
pi.set_mode(DMUX_pin[pin], pigpio.OUTPUT)
pi.write(DMUX_pin[pin], DMUX_out[pin])

args = sys.argv
pi.set_mode(13, pigpio.OUTPUT)

pi.hardware_PWM(13, 50, int(args[1]))
time.sleep(1)

finally:
pi.hardware_PWM(13, 0, 0)

for pin in range(0, 2):
pi.write(DMUX_pin[pin], 0)

0 comments on commit 49c72cb

Please sign in to comment.