forked from ipa320/THMHO_heatmap_generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ipa320/main
Update readme and some pending commits
- Loading branch information
Showing
9 changed files
with
183 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
industrial_ci: | ||
strategy: | ||
matrix: | ||
env: | ||
- {ROS_DISTRO: melodic, ROS_REPO: main} | ||
- {ROS_DISTRO: noetic, ROS_REPO: main} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: 'ros-industrial/industrial_ci@master' | ||
env: ${{matrix.env}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Temporal Heat Map for Human Occupancy - Heatmap generation | ||
|
||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
[![Docker badge](https://img.shields.io/docker/pulls/ramp-eu/TTE.project1.svg)](https://hub.docker.com/r/<org>/<repo>/) | ||
<br/> | ||
|
||
[![Documentation Status](https://readthedocs.org/projects/thmho-lidar-node/badge/?version=latest)](https://thmho-heatmap-generator.readthedocs.io/en/latest/?badge=latest) | ||
[![CI](https://github.com/ramp-eu/TTE.project1/workflows/CI/badge.svg)](https://github.com/ramp-eu/TTE.project1/actions?query=workflow%3ACI) | ||
[![Coverage Status](https://coveralls.io/repos/github/ramp-eu/TTE.project1/badge.svg?branch=master)](https://coveralls.io/github/ramp-eu/TTE.project1?branch=master) | ||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/fce8e4a4dfe140bb9963b88aaf1a2b03)](https://www.codacy.com/gh/ramp-eu/THMHO_heatmap_generator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ramp-eu/THMHO_heatmap_generator&utm_campaign=Badge_Grade) | ||
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5132/badge)](https://bestpractices.coreinfrastructure.org/projects/5132) | ||
|
||
This project is part of [DIH^2](http://www.dih-squared.eu/). For more information check the RAMP Catalogue entry for the | ||
[components](https://github.com/ramp-eu). | ||
|
||
| :books: [Documentation](https://thmho-lidar-node.readthedocs.io/en/latest/README.html) | :whale: [Docker Hub](https://hub.docker.com) | | ||
| --------------------------------------------- | ------------------------------------------------------------- | | ||
|
||
## Contents | ||
|
||
- [Background](#background) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [API](#api) | ||
- [Testing](#testing) | ||
- [Feedback](#feedback) | ||
- [Contribution](#contribution) | ||
- [License](#license) | ||
|
||
## Background | ||
### Objective | ||
The objective of the package is to create the temporal heatmaps that show for each 1 m2, and each 1 hour of each workday the rate of human occupancy. | ||
|
||
## Install | ||
|
||
Information about how to install the `THMHO_heatmap_generator` can be found at the corresponding section of the [Installation & Administration Guide](docs/installationguide.md). | ||
|
||
## Usage | ||
|
||
Information about how to use the `THMHO_heatmap_generator` can be found in the [User & Programmers Manual](docs/usermanual.md). | ||
|
||
## Testing | ||
|
||
### Troubleshooting | ||
|
||
- Message `Requesting the map...` on terminal or `No map received` in RViz | ||
|
||
The file pointed by `sim_map_file` (for simulation) or `real_map_file` (for real laser scanners) in `factory_sim/launch/factory.launch` may not exist in the workspace. | ||
|
||
- No heatmap is vizualized in `RViz` | ||
|
||
If `Costmap` is not visualized as well, verify if the laser scan `topic` names specified in `factory_sim/config/costmap_params.yaml` are correct, and if the `tf` tree is published correctly. | ||
If `Costmap` is visualized, it should be noted that the first heatmap is published after the time specified by `aggregation_time` argument for `heatmap_generator` node in `factory_sim/launch/factory.launch`. The default value is 3600, i.e. 1 hour. | ||
|
||
|
||
## Feedback | ||
|
||
Any feedback and suggestions can be submitted by creating New issue in the Issues tab or by emailing the team. | ||
|
||
## Contribution | ||
|
||
In order to contribute you will have to request to be added to the project. | ||
|
||
## License | ||
|
||
The project is licensed under the [Apache-2](https://opensource.org/licenses/Apache-2.0) license. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
observation_sources: scan scan_2 scan_3 | ||
scan: {sensor_frame: sensor_laser, data_type: LaserScan, topic: /sensors/laser_scan, marking: true, clearing: true, | ||
expected_update_rate: 0.4, max_obstacle_height: 1.0, min_obstacle_height: 0.0, obstacle_range: 10.0} | ||
|
||
scan_2: {sensor_frame: sensor_laser_2, data_type: LaserScan, topic: /sensors/laser_scan_2, marking: true, clearing: true, | ||
expected_update_rate: 0.4, max_obstacle_height: 1.0, min_obstacle_height: 0.0, obstacle_range: 10.0} | ||
|
||
plugins: | ||
- {name: static_map, type: "costmap_2d::StaticLayer"} | ||
- {name: obstacles, type: "costmap_2d::ObstacleLayer"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python3 | ||
import rospy | ||
from nav_msgs.msg import OccupancyGrid | ||
from scipy.sparse import csr_matrix | ||
import numpy as np | ||
import requests | ||
import time | ||
from datetime import datetime | ||
import sys | ||
|
||
class HeatmapSaver(object): | ||
def __init__(self): | ||
self.url = 'http://localhost:5000/insert' | ||
self.urlsparse = 'http://localhost:5000/insparse' | ||
|
||
self.heatmap_subscriber = rospy.Subscriber( | ||
"/costmap_generator/costmap/costmap", OccupancyGrid, self.save_heatmap) | ||
|
||
costmap = rospy.wait_for_message("/map", OccupancyGrid, timeout=100) | ||
self.width = costmap.info.width | ||
self.height = costmap.info.height | ||
self.size = (self.height, self.width) | ||
self.mask = np.array(costmap.data).reshape(self.size).astype(bool) | ||
self.mask = (~self.mask).astype(int) | ||
self.mask = csr_matrix(self.mask) | ||
body = { | ||
'name': 'base_mask', | ||
'width': self.width, | ||
'height': self.height, | ||
'indices': self.mask.indices.tolist(), | ||
'indptr': self.mask.indptr.tolist(), | ||
} | ||
requests.post(self.urlsparse, json = body) | ||
self.mask = self.mask.toarray() | ||
|
||
def save_heatmap(self, msg): | ||
data = np.array(msg.data).reshape(self.size) | ||
try: | ||
masked_data = csr_matrix(data * self.mask) | ||
date = datetime.now().isoformat() | ||
body = { | ||
'date': date, | ||
'data': msg.data | ||
} | ||
body_csr = { | ||
'date': date, | ||
'indices': masked_data.indices.tolist(), | ||
'indptr': masked_data.indptr.tolist(), | ||
} | ||
requests.post(self.url, json = body) | ||
requests.post(self.urlsparse, json = body_csr) | ||
print(f"Inserted registry in both databases at {date}") | ||
except Exception as e: | ||
print(e) | ||
|
||
if __name__ == '__main__': | ||
rospy.init_node('heatmap_saver', anonymous=True) | ||
heatmap = HeatmapSaver() | ||
time.sleep(5) | ||
rospy.spin() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
site_name: <site-name> | ||
site_url: https://<site-url> | ||
repo_url: https://github.com/<repo_url> | ||
site_description: RAMP Documentation | ||
site_name: THMHO Heatmap Generator | ||
site_url: https://github.com/ipa320/THMHO_heatmap_generator | ||
repo_url: https://github.com/ipa320/THMHO_heatmap_generator | ||
site_description: THMHO Heatmap Generator Documentation | ||
docs_dir: docs | ||
site_dir: html | ||
edit_uri: edit/master/doc/ | ||
markdown_extensions: [toc,fenced_code] | ||
use_directory_urls: false | ||
theme: readthedocs | ||
pages: | ||
- Home: 'index.md' | ||
nav: | ||
- Home: 'README.md' | ||
- 'Getting Started' : 'getting-started.md' | ||
- 'User & Programmers Manual': | ||
- 'Architecture' : 'architecture.md' | ||
- 'API' : 'api.md' | ||
- 'User Guide': 'usermanual.md' | ||
- 'Installation & Administration Manual': | ||
- 'Installation Guide': 'installationguide.md' | ||
- 'Installation Guide': 'installationguide.md' |