ros-example

所属分类:C/C++基础
开发工具:CMake
文件大小:0KB
下载次数:0
上传日期:2021-05-07 10:05:24
上 传 者sh-1993
说明:  伟大的C++ROS示例-将以ROS为中心的功能与外部库集成,以访问远程API并与本地SQL数据库SQLite3交互
(The Great C++ ROS Example - integrate ROS centred functionality with external libraries for accessing remote API and for interacting with a local SQL database SQLite3)

文件列表:
.figures/ (0, 2021-05-07)
.figures/db.png (187361, 2021-05-07)
.figures/map.png (53188, 2021-05-07)
CMakeLists.txt (49, 2021-05-07)
LICENSE (1072, 2021-05-07)
api_handler/ (0, 2021-05-07)
api_handler/CMakeLists.txt (7373, 2021-05-07)
api_handler/package.xml (899, 2021-05-07)
api_handler/src/ (0, 2021-05-07)
api_handler/src/handler.py (3004, 2021-05-07)
db_handler/ (0, 2021-05-07)
db_handler/CMakeLists.txt (7609, 2021-05-07)
db_handler/include/ (0, 2021-05-07)
db_handler/include/db_handler/ (0, 2021-05-07)
db_handler/include/db_handler/db_handler.hpp (2255, 2021-05-07)
db_handler/launch/ (0, 2021-05-07)
db_handler/launch/run.launch (152, 2021-05-07)
db_handler/package.xml (2944, 2021-05-07)
db_handler/src/ (0, 2021-05-07)
db_handler/src/db_handler.cpp (4353, 2021-05-07)
db_handler/src/db_handler_main.cpp (247, 2021-05-07)
db_handler/test/ (0, 2021-05-07)
db_handler/test/db.test (277, 2021-05-07)
db_handler/test/test_db.cpp (1450, 2021-05-07)
geo_manager/ (0, 2021-05-07)
geo_manager/CMakeLists.txt (7289, 2021-05-07)
geo_manager/data/ (0, 2021-05-07)
geo_manager/data/cities.json (261, 2021-05-07)
geo_manager/include/ (0, 2021-05-07)
geo_manager/include/geo_manager/ (0, 2021-05-07)
geo_manager/include/geo_manager/city.hpp (757, 2021-05-07)
geo_manager/include/geo_manager/entity.hpp (467, 2021-05-07)
geo_manager/include/geo_manager/manager.hpp (1858, 2021-05-07)
... ...

# The Great C++ & Python Ros Example Catkin build status: [![Build Actions Status](https://github.com/vignif/ros-example/workflows/Build/badge.svg)](https://github.com/vignif/ros-example/actions) This repository wants to explore with a practical approach the paradigms in the middleware ROS (Robotic Operating System) while connecting ROS with external functionalities. A script can render a map with a marker per each city in the database. ![map](.figures/map.png) The information in the database can be explored with a software like [sqlite browser](https://sqlitebrowser.org/) obtaining something like: ![db](.figures/db.png) Note most of the postal entries are zero, this is due to the design of the API which is not returning the postal code. The value can be stored via providing it as input in a ros message. ## Information flow 1. When launching the main script `roslaunch geo_manager Manager.launch` - A database is created (if doesn't exist) and filled with proper table schema - A json file is parsed and propagated as an API request. The API response is handled and stored in the db. The user can append cities to the json file, and their information will be processed at startup time. If the json file is not present or empty, it will be skipped. 2. `Manager.launch` spins the following nodes: - `geo_manager` - `api_handler` - `show` 3. The user or a node can request to add a new city to the database via the topic `/RTCreateCity` with: ``` rostopic pub /RTCreateCity geo_manager/RTCityReq "city_name: 'New York' postal: 10001" ``` A unique constraint on the tuple (city - postal) is present. If the tuple (city - postal) is already present in the db, a warning will be returned to the user, otherwise a new row will be placed in the db. If the API is not able to retrieve the info for a city (i.e. wrong spell of the city or timeout), a warning is returned to the user. 4. Visualize in a browser the cities stored in the database with: ``` rostopic pub /render_cities std_msgs/Empty "{}" ``` ## Outside ROS The project also contains: - A wrapper class for an SQL database [SQLite3](https://www.sqlite.org/) - A JSON parser implemented using a cpp library [json](https://github.com/open-source-parsers/jsoncpp) - Interface to a remote API [nominatim](https://nominatim.openstreetmap.org) ## How to install Given your catkin workspace `~/ros_ws`, clone the current repository in it with: ``` cd ~/ros_ws git clone git@github.com:vignif/ros-example.git src ``` Check that your system has all the dependencies needed for the project with: ``` rosdep install --from-paths src --ignore-src -r -y ``` Build the project with catkin using: ``` catkin build ``` ## How to run Now that everything is built on your machine, you need to source the binaries with: in case you are using bash ``` source ~/ros_ws/devel/setup.bash ``` in case you are using zsh ``` source ~/ros_ws/devel/setup.zsh ``` Now you can spin the main nodes with: ``` roslaunch geo_manager Manager.launch ``` If you want to change the name of your database you can modify the entry of the `Manager.launch` file containing the db name. The schema of the table `cities` is fixed and is managed with the object `Manager`. ## Unit Tests Run the unit tests using the [Catkin Command Line Tools](http://catkin-tools.readthedocs.io/en/latest/index.html#) ``` catkin build db_handler --no-deps --verbose --catkin-make-args run_tests ``` ## Versioning We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/vignif/ros-example/tags). ## License [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org) **[MIT license](http://opensource.org/licenses/mit-license.php)** - Copyright 2021 Francesco Vigni

近期下载者

相关文件


收藏者