Skip to content
Snippets Groups Projects
Commit a3a0e3a0 authored by Erkan Karabulut's avatar Erkan Karabulut
Browse files

add comment lines and docker files

parent 33ccea92
No related branches found
No related tags found
No related merge requests found
node_modules
start_robot_coaty_agent.sh
# The Coaty MQTT Broker URL
# BROKER_URL=mqtt://localhost:1883
# BROKER_URL=mqtt://10.200.4.129:1883
# BROKER_URL=mqtt://broker.hivemq.com:1883
BROKER_URL=mqtt://10.0.33.39:1883
BROKER_USERNAME=iiotlabadmin
BROKER_PASSWORD=iiotlabadmin
FROM alpine:3.10
FROM ros:noetic-robot
WORKDIR /opt/thing
WORKDIR /opt/robot
# change local date time to Europe/Berlin
RUN apk add tzdata && \
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
echo "Europe/Berlin" > /etc/timezone
# update. upgrade packages
RUN apt-get update && \
apt-get upgrade -y
# update. upgrade packages and install nodejs and npm
RUN apk update && \
apk upgrade && \
apk add --no-cache linux-headers python3 py3-pip python3-dev make g++ nodejs npm curl sudo bash git && \
pip3 install setuptools wheel pyserial adafruit-io
# install required linux packages
RUN apt-get install -y apt-utils python3.8 python3-pip python3-dev make g++ nodejs npm curl \
sudo bash nano git python3-rospy libraspberrypi-bin libraspberrypi-dev
# copy sensor files
# install required python packages
RUN pip3 install --upgrade setuptools wheel pyserial adafruit-io \
numpy Pillow tflite_runtime matplotlib opencv-python
# copy files
COPY . .
RUN pip3 install -r python/requirements.txt
# run entrypoint file
RUN bash -c "chmod +x entrypoint.sh && ./entrypoint.sh"
# install dependencies, build and run the application
RUN npm install && \
npm run build
RUN npm install
RUN npm run build
CMD npm start
#!/bin/bash
# set ros network parameters
echo "export ROS_MASTER_URI=http://10.0.33.39:11311" >> ~/.bashrc && \
echo "export ROS_HOSTNAME=10.0.33.47" >> ~/.bashrc && \
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && \
source ~/.bashrc
# install raspicam_node ros node
cd ~ && \
mkdir -p catkin_ws && cd catkin_ws && mkdir -p src && cd src && \
source /opt/ros/noetic/setup.bash && \
git clone https://github.com/UbiquityRobotics/raspicam_node.git && \
echo "yaml https://raw.githubusercontent.com/UbiquityRobotics/rosdep/master/raspberry-pi.yaml" >> /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep update && \
cd .. && rosdep install --from-paths src --ignore-src --rosdistro=noetic -y && \
catkin_make
# install sensor_msgs ros package
roslocate info sensor_msgs > /tmp/sensor_msgs.rosinstall && \
rosinstall /opt/ros/noetic /tmp/sensor_msgs.rosinstall
sed -i 's/yaml.load/yaml.safe_load/g' /opt/ros/noetic/setup.sh
# source ros runnables
source /opt/ros/noetic/setup.bash
......@@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Mobile IoT thing",
"scripts": {
"build": "tsc ./src/**/**.ts --outDir ./build",
"build": "gulp build",
"lint": "gulp lint",
"lint:fix": "gulp lint:fix",
"start": "node -r dotenv/config dist/agent/agent.js"
......
......@@ -20,7 +20,6 @@ import {
Thing,
} from "@coaty/core/sensor-things";
import * as sensor_config from "../sensor";
import * as dhtSensorDriver from "node-dht-sensor";
/**
* Handles registration of sensor objects.
......@@ -110,7 +109,7 @@ export class SensorThingsController extends SensorSourceController {
metadata: {
building: {
name: "HT",
address: "Mies-van-der-Rohe-Straße 6, 80807 München"
address: "Mies-van-der-Rohe-Straße 6, 80807 München",
},
floor: "15",
room: "1",
......
......@@ -15,7 +15,6 @@ import time
import cv2
from object_detector import ObjectDetector
from object_detector import ObjectDetectorOptions
import utils
import rospy
import argparse
......@@ -69,6 +68,7 @@ def detect(image: Image) -> None:
person_count = person_count + 1
print(person_count)
sys.stdout.flush()
# Calculate the FPS
# if counter % fps_avg_frame_count == 0:
# end_time = time.time()
......
......@@ -2,14 +2,14 @@
* Copyright (C) 2021 fortiss GmbH
* @author Erkan Karabulut – {@link "karabulut@fortiss.org"}
* @version 1.0
* Describing an air quality sensor and reading data from it
* Describing an occupancy sensor and reading data from it
*/
import {ObservationTypes, Sensor, SensorEncodingTypes, SensorThingsTypes} from "@coaty/core/sensor-things";
import {spawn} from "child_process";
/**
* Describes the Grove air quality sensor and runs the sensor driver to read observations
* Describes the occupancy sensor and runs the sensor driver to read observations
*/
export class Occupancy {
_value: number = 0;
......@@ -19,11 +19,11 @@ export class Occupancy {
}
/**
* describe the air quality sensor
* describe the occupancy sensor
* @param parentObjectId: IoT thing object ID
*/
public _getSensorConfig(parentObjectId: string) {
const airQualitySensor: Sensor = {
const occupancySensor: Sensor = {
name: "Camera sensor",
objectId: "17f98945-4a78-41b0-84f0-bb9a4a807b13",
objectType: SensorThingsTypes.OBJECT_TYPE_SENSOR,
......@@ -45,7 +45,7 @@ export class Occupancy {
metadata: {},
};
return airQualitySensor;
return occupancySensor;
}
public _getValue() {
......@@ -58,9 +58,9 @@ export class Occupancy {
* @private
*/
private _listenSensorData() {
const airQualitySensor = spawn("python3", [__dirname + "/../../src/driver/occupancy/occupancy.py",
const occupancySensor = spawn("python3", [__dirname + "/../../src/driver/occupancy/occupancy.py",
"--model", __dirname + "/../../src/driver/occupancy/efficientdet_lite0.tflite"]);
airQualitySensor.stdout.on("data", (data) => {
occupancySensor.stdout.on("data", (data) => {
this._value = parseFloat(Buffer.from(data).toString());
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment