;
17 |
18 | /**
19 | * @brief Virtual destructor
20 | */
21 | virtual ~Condition()
22 | {
23 | }
24 |
25 | /**
26 | * @param parent pointer to user's node
27 | * @param name The name of this condition
28 | * @param tf A pointer to a TF buffer
29 | */
30 | virtual void configure(const rclcpp_lifecycle::LifecycleNode::WeakPtr& parent, const std::string& name) = 0;
31 |
32 | /**
33 | * @brief Method to cleanup resources used on shutdown.
34 | */
35 | virtual void cleanup() = 0;
36 |
37 | /**
38 | * @brief Method to activate Condition and any threads involved in execution.
39 | */
40 | virtual void activate() = 0;
41 |
42 | virtual bool getState(dc_interfaces::msg::StringStamped msg) = 0;
43 |
44 | virtual void publishActive() = 0;
45 |
46 | /**
47 | * @brief Method to deactivate Condition and any threads involved in execution.
48 | */
49 | virtual void deactivate() = 0;
50 | };
51 | } // namespace dc_core
52 |
53 | #endif // DC_CORE_CONDITION_HPP_
54 |
--------------------------------------------------------------------------------
/dc_core/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_core
5 | 0.1.0
6 | A set of headers for plugins core to the DC stack
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake
11 |
12 | nlohmann-json-dev
13 | pluginlib
14 | rclcpp
15 | rclcpp_lifecycle
16 | tf2_ros
17 | dc_common
18 |
19 | ament_lint_auto
20 | ament_lint_common
21 |
22 |
23 | ament_cmake
24 |
25 |
26 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/__init__.py
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/.streamlit/config.toml:
--------------------------------------------------------------------------------
1 | [server]
2 | enableStaticServing = true
3 | headless = true
4 |
5 | [theme]
6 | primaryColor="#2DACE1"
7 | base="dark"
8 | font="sans serif"
9 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/Streamlit_ROS_2.py:
--------------------------------------------------------------------------------
1 | import pathlib
2 |
3 | import streamlit as st
4 | from pages import Header, Sidebar
5 |
6 |
7 | def set_intro_text():
8 | current_file_path = pathlib.Path(__file__).parent.resolve()
9 | with open(f"{current_file_path}/static/html/welcome.html") as f:
10 | st.markdown(f.read(), unsafe_allow_html=True)
11 |
12 |
13 | def main():
14 | st.set_page_config(page_title="ROS 2 Data Collection - Home", layout="wide")
15 | st.title("ROS 2 Data collection")
16 | Header()
17 | Sidebar()
18 | set_intro_text()
19 |
20 |
21 | if __name__ == "__main__":
22 | main()
23 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/__init__.py
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/backend/__init__.py:
--------------------------------------------------------------------------------
1 | from .minio import minio_client
2 | from .pgsql import PGSQLService
3 |
4 | __all__ = ["minio_client", "PGSQLService"]
5 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/backend/minio.py:
--------------------------------------------------------------------------------
1 | import minio
2 | from config import config
3 |
4 | # Create a Minio client
5 | minio_client = minio.Minio(
6 | config.MINIO_URL,
7 | access_key=config.MINIO_ACCESS_KEY,
8 | secret_key=config.MINIO_SECRET_KEY,
9 | secure=False,
10 | )
11 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/lib/__init__.py:
--------------------------------------------------------------------------------
1 | from .common import resample
2 | from .pgsql import PGBase, pgsql_session
3 | from .section import Section
4 |
5 | __all__ = ["Header", "PGBase", "pgsql_session", "Section", "resample"]
6 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/lib/common.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 |
4 | def get_tz() -> str:
5 | """Get local timezone from localtime information."""
6 | return "/".join(os.path.realpath("/etc/localtime").split("/")[-2:])
7 |
8 |
9 | def resample(df, default: str = "30S"):
10 | # calculate the length of the data in minutes
11 | if df.empty:
12 | return df
13 | data_length = (df["Date"].max() - df["Date"].min()).total_seconds() / 60
14 | if data_length == 0:
15 | return df
16 | df.set_index("Date", inplace=True)
17 |
18 | # Decide which resampling frequency to use based on the data length
19 | # > 24 hours -> Resample to daily data
20 | if data_length > 24 * 60:
21 | df_resampled = df.resample("D").mean()
22 | # > 2h -> resample to hourly data
23 | elif data_length > 2 * 60:
24 | df_resampled = df.resample("10T").mean()
25 | # Resample to 5 minutes data
26 | else:
27 | df_resampled = df.resample(default).mean()
28 |
29 | return df_resampled
30 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/lib/pgsql.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import json
3 |
4 | from config import config
5 | from sqlalchemy import create_engine
6 | from sqlalchemy.orm import declarative_base, sessionmaker
7 |
8 |
9 | class DatetimeEncoder(json.JSONEncoder):
10 | def default(self, obj: datetime.datetime):
11 | try:
12 | return super().default(obj)
13 | except TypeError:
14 | return obj.isoformat()
15 |
16 |
17 | engine = create_engine(config.READER_DB_URL_DATA, json_serializer=DatetimeEncoder)
18 |
19 | PGBase = declarative_base()
20 |
21 | SessionLocal = sessionmaker(bind=engine)
22 |
23 | pgsql_session = SessionLocal()
24 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/models/__init__.py:
--------------------------------------------------------------------------------
1 | from .robot_data import RobotData
2 |
3 | __all__ = ["RobotData"]
4 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/models/robot_data.py:
--------------------------------------------------------------------------------
1 | from config import config
2 | from lib import PGBase
3 | from sqlalchemy import Column, DateTime
4 | from sqlalchemy.dialects.postgresql import JSON
5 |
6 |
7 | class RobotData(PGBase):
8 | __tablename__ = config.PGSQL_TABLE
9 |
10 | time = Column(DateTime, nullable=False, primary_key=True)
11 | data = Column(JSON, nullable=False)
12 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/pages/5_Congrats.py:
--------------------------------------------------------------------------------
1 | import pathlib
2 |
3 | import streamlit as st
4 |
5 |
6 | def set_congrats_text():
7 | current_file_path = pathlib.Path(__file__).parent.resolve()
8 | with open(f"{current_file_path}/../static/html/congrats.html") as f:
9 | st.markdown(f.read(), unsafe_allow_html=True)
10 |
11 |
12 | def main():
13 | st.set_page_config(page_title="ROS 2 Data Collection - End", layout="wide")
14 | st.title("Thanks!")
15 | set_congrats_text()
16 |
17 |
18 | if __name__ == "__main__":
19 | main()
20 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/css/logo.css:
--------------------------------------------------------------------------------
1 | #logo-dc {
2 | display: block;
3 | margin: auto;
4 | height: 150px;
5 | }
6 |
7 | .sidebar-scrollbox {
8 | top: 150px !important;
9 | }
10 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.eot
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.ttf
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.woff
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/static/fonts/lineicons.woff2
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/html/sidebar.html:
--------------------------------------------------------------------------------
1 |
4 | Documentation: https://minipada.github.io/ros2_data_collection
6 | Source code: https://github.com/minipada/ros2_data_collection
8 |
10 |
12 |
15 |
--------------------------------------------------------------------------------
/dc_demos/dc_demos/streamlit_dashboard/static/images/dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/dc_demos/streamlit_dashboard/static/images/dc.png
--------------------------------------------------------------------------------
/dc_demos/include/dc_demos/plugins/measurements/uptime_custom.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DEMOS__PLUGINS__MEASUREMENTS__UPTIME_CUSTOM_HPP_
2 | #define DC_DEMOS__PLUGINS__MEASUREMENTS__UPTIME_CUSTOM_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "dc_measurements/measurement.hpp"
8 | #include "dc_measurements/plugins/measurements/uptime.hpp"
9 |
10 | namespace dc_demos
11 | {
12 | using json = nlohmann::json;
13 |
14 | class UptimeCustom : public dc_measurements::Uptime
15 | {
16 | protected:
17 | void onFailedValidation(json data_json) override;
18 | void setValidationSchema() override;
19 | };
20 |
21 | } // namespace dc_demos
22 |
23 | #endif // DC_DEMOS__PLUGINS__MEASUREMENTS__UPTIME_CUSTOM_HPP_
24 |
--------------------------------------------------------------------------------
/dc_demos/measurement_plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | dc_measurement_uptime_custom
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/dc_demos/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_demos
5 | 0.1.0
6 | DC demo packages
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | dc_measurements
11 | launch
12 | nlohmann-json-dev
13 | nlohmann_json_schema_validator_vendor
14 | pluginlib
15 |
16 | aws_robomaker_small_warehouse_world
17 | geometry_msgs
18 | dc_bringup
19 | dc_simulation
20 | nav2_bringup
21 | nav2_simple_commander
22 | rclpy
23 | xacro
24 |
25 |
26 | ament_cmake
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/dc_demos/params/uptime_custom_stdout.yaml:
--------------------------------------------------------------------------------
1 | destination_server:
2 | ros__parameters:
3 | flb:
4 | flush: 1
5 | flb_grace: 1
6 | log_level: "info"
7 | storage_path: "/var/log/flb-storage/"
8 | storage_sync: "full"
9 | storage_checksum: "off"
10 | storage_backlog_mem_limit: "1M"
11 | scheduler_cap: 200
12 | scheduler_base: 5
13 | http_server: true
14 | http_listen: "0.0.0.0"
15 | http_port: 2020
16 | in_storage_type: "filesystem"
17 | in_storage_pause_on_chunks_overlimit: "off"
18 | destination_plugins: ["flb_stdout"]
19 | flb_stdout:
20 | plugin: "dc_destinations/FlbStdout"
21 | inputs: ["/dc/measurement/uptime_custom"]
22 | time_format: "double"
23 | time_key: "date"
24 | debug: false
25 |
26 | measurement_server:
27 | ros__parameters:
28 | measurement_plugins: ["uptime_custom"]
29 | run_id:
30 | enabled: false
31 | uptime_custom:
32 | plugin: "dc_demos/UptimeCustom"
33 | group_key: "uptime"
34 | topic_output: "/dc/measurement/uptime_custom"
35 | polling_interval: 5000
36 | enable_validator: true
37 | tags: ["flb_stdout"]
38 | init_collect: true
39 |
--------------------------------------------------------------------------------
/dc_demos/plugins/measurements/json/uptime_custom.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Uptime Custom",
4 | "description": "Time the system has been up. Intentionally failing to demonstrate customization and callback",
5 | "properties": {
6 | "time": {
7 | "description": "Time the system has been up",
8 | "type": "integer",
9 | "maximum": 0
10 | }
11 | },
12 | "type": "object"
13 | }
14 |
--------------------------------------------------------------------------------
/dc_demos/plugins/measurements/uptime_custom.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_demos/plugins/measurements/uptime_custom.hpp"
2 |
3 | namespace dc_demos
4 | {
5 |
6 | void UptimeCustom::onFailedValidation(json data_json)
7 | {
8 | (void)data_json;
9 | RCLCPP_INFO(logger_, "Callback! Validation failed for uptime custom");
10 | }
11 |
12 | void UptimeCustom::setValidationSchema()
13 | {
14 | if (enable_validator_)
15 | {
16 | validateSchema("dc_demos", "uptime_custom.json");
17 | }
18 | }
19 |
20 | } // namespace dc_demos
21 |
22 | #include "pluginlib/class_list_macros.hpp"
23 | PLUGINLIB_EXPORT_CLASS(dc_demos::UptimeCustom, dc_core::Measurement)
24 |
--------------------------------------------------------------------------------
/dc_demos/resource/dc_demos:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_demos/resource/dc_demos
--------------------------------------------------------------------------------
/dc_demos/setup.cfg:
--------------------------------------------------------------------------------
1 | [develop]
2 | script_dir=$base/lib/dc_demos
3 | [install]
4 | install_scripts=$base/lib/dc_demos
5 |
--------------------------------------------------------------------------------
/dc_description/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | project(dc_description)
3 |
4 | find_package(ament_cmake REQUIRED)
5 |
6 | install(
7 | DIRECTORY urdf
8 | DESTINATION share/${PROJECT_NAME}
9 | )
10 |
11 | ament_package()
12 |
--------------------------------------------------------------------------------
/dc_description/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_description
5 | 0.1.0
6 | Description files for DC
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | realsense2_description
11 | urdf
12 | xacro
13 |
14 |
15 |
16 | ament_cmake
17 |
18 |
19 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/flb_file.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_FILE_HPP_
2 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_FILE_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "dc_destinations/destination_server.hpp"
9 | #include "dc_destinations/flb_destination.hpp"
10 |
11 | namespace dc_destinations
12 | {
13 |
14 | class FlbFile : public dc_destinations::FlbDestination
15 | {
16 | public:
17 | FlbFile();
18 | ~FlbFile() override;
19 |
20 | protected:
21 | /**
22 | * @brief Configuration of behavior action
23 | */
24 | void initFlbOutputPlugin() override;
25 | void onConfigure() override;
26 |
27 | std::string path_;
28 | std::string file_;
29 | std::string format_;
30 | std::string delimiter_;
31 | std::string label_delimiter_;
32 | std::string template_;
33 | bool mkdir_;
34 | };
35 |
36 | } // namespace dc_destinations
37 |
38 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_FILE_HPP_
39 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/flb_kinesis_streams.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_KINESIS_STREAMS_HPP_
2 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_KINESIS_STREAMS_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "dc_destinations/destination_server.hpp"
9 | #include "dc_destinations/flb_destination.hpp"
10 |
11 | namespace dc_destinations
12 | {
13 |
14 | class FlbKinesisStreams : public dc_destinations::FlbDestination
15 | {
16 | public:
17 | FlbKinesisStreams();
18 | ~FlbKinesisStreams() override;
19 |
20 | protected:
21 | /**
22 | * @brief Configuration of behavior action
23 | */
24 | void initFlbOutputPlugin() override;
25 | void onConfigure() override;
26 |
27 | std::string region_;
28 | std::string stream_;
29 | std::string role_arn_;
30 | std::string time_key_;
31 | std::string time_key_format_;
32 | std::string log_key_;
33 | std::string endpoint_;
34 | bool auto_retry_requests_;
35 | };
36 |
37 | } // namespace dc_destinations
38 |
39 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_KINESIS_STREAMS_HPP_
40 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/flb_null.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_NULL_HPP_
2 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_NULL_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "dc_destinations/destination_server.hpp"
10 | #include "dc_destinations/flb_destination.hpp"
11 | #include "dc_interfaces/msg/string_stamped.hpp"
12 |
13 | #pragma GCC diagnostic push
14 | #pragma GCC diagnostic ignored "-Wpedantic"
15 | #pragma GCC diagnostic ignored "-Wunused-parameter"
16 | #pragma GCC diagnostic ignored "-Wparentheses"
17 | #pragma GCC diagnostic ignored "-Wsign-compare"
18 | #include
19 | #pragma GCC diagnostic pop
20 |
21 | namespace dc_destinations
22 | {
23 |
24 | class FlbNull : public dc_destinations::FlbDestination
25 | {
26 | public:
27 | FlbNull();
28 | ~FlbNull() override;
29 |
30 | protected:
31 | /**
32 | * @brief Configuration of behavior action
33 | */
34 | void initFlbOutputPlugin() override;
35 | void onConfigure() override;
36 | };
37 |
38 | } // namespace dc_destinations
39 |
40 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_NULL_HPP_
41 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/flb_slack.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_SLACK_HPP_
2 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_SLACK_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "dc_destinations/destination_server.hpp"
10 | #include "dc_destinations/flb_destination.hpp"
11 | #include "dc_interfaces/msg/string_stamped.hpp"
12 |
13 | #pragma GCC diagnostic push
14 | #pragma GCC diagnostic ignored "-Wpedantic"
15 | #pragma GCC diagnostic ignored "-Wunused-parameter"
16 | #pragma GCC diagnostic ignored "-Wparentheses"
17 | #pragma GCC diagnostic ignored "-Wsign-compare"
18 | #include
19 | #pragma GCC diagnostic pop
20 |
21 | namespace dc_destinations
22 | {
23 |
24 | class FlbSlack : public dc_destinations::FlbDestination
25 | {
26 | public:
27 | FlbSlack();
28 | ~FlbSlack() override;
29 |
30 | protected:
31 | /**
32 | * @brief Configuration of behavior action
33 | */
34 | void initFlbOutputPlugin() override;
35 | void onConfigure() override;
36 |
37 | std::string webhook_;
38 | };
39 |
40 | } // namespace dc_destinations
41 |
42 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_SLACK_HPP_
43 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/flb_stdout.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_STDOUT_HPP_
2 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_STDOUT_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "dc_destinations/destination_server.hpp"
10 | #include "dc_destinations/flb_destination.hpp"
11 | #include "dc_interfaces/msg/string_stamped.hpp"
12 |
13 | #pragma GCC diagnostic push
14 | #pragma GCC diagnostic ignored "-Wpedantic"
15 | #pragma GCC diagnostic ignored "-Wunused-parameter"
16 | #pragma GCC diagnostic ignored "-Wparentheses"
17 | #pragma GCC diagnostic ignored "-Wsign-compare"
18 | #include
19 | #pragma GCC diagnostic pop
20 |
21 | namespace dc_destinations
22 | {
23 |
24 | class FlbStdout : public dc_destinations::FlbDestination
25 | {
26 | public:
27 | FlbStdout();
28 | ~FlbStdout() override;
29 |
30 | protected:
31 | /**
32 | * @brief Configuration of behavior action
33 | */
34 | void initFlbOutputPlugin() override;
35 | void onConfigure() override;
36 |
37 | std::string format_;
38 | std::string json_date_key_;
39 | std::string json_date_format_;
40 | };
41 |
42 | } // namespace dc_destinations
43 |
44 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__FLB_STDOUT_HPP_
45 |
--------------------------------------------------------------------------------
/dc_destinations/include/dc_destinations/plugins/rcl.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_DESTINATIONS__PLUGINS__DESTINATIONS__RCL_HPP_
3 | #define DC_DESTINATIONS__PLUGINS__DESTINATIONS__RCL_HPP_
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #include "dc_core/destination.hpp"
10 | #include "dc_destinations/destination.hpp"
11 | #include "dc_destinations/destination_server.hpp"
12 |
13 | namespace dc_destinations
14 | {
15 |
16 | class Rcl : public dc_destinations::Destination
17 | {
18 | public:
19 | Rcl();
20 | ~Rcl() override;
21 |
22 | protected:
23 | /**
24 | * @brief Configuration of destination
25 | */
26 | void sendData(dc_interfaces::msg::StringStamped::SharedPtr msg) override;
27 | };
28 |
29 | } // namespace dc_destinations
30 |
31 | #endif // DC_DESTINATIONS__PLUGINS__DESTINATIONS__RCL_HPP_
32 |
--------------------------------------------------------------------------------
/dc_destinations/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_destinations
5 | 0.1.0
6 | Send all data to destination plugins
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake_ros
11 |
12 | ament_index_cpp
13 | dc_core
14 | dc_interfaces
15 | dc_lifecycle_manager
16 | dc_util
17 | fluent_bit_vendor
18 | nav2_util
19 | nlohmann-json-dev
20 | pluginlib
21 | rclcpp
22 |
23 | fluent_bit_plugins
24 | systemd
25 |
26 |
27 | ament_cmake
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/dc_destinations/plugins/flb_null.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_destinations/plugins/flb_null.hpp"
2 |
3 | namespace dc_destinations
4 | {
5 |
6 | FlbNull::FlbNull() : dc_destinations::FlbDestination()
7 | {
8 | }
9 |
10 | void FlbNull::onConfigure()
11 | {
12 | }
13 |
14 | void FlbNull::initFlbOutputPlugin()
15 | {
16 | out_ffd_ = flb_output(ctx_, "null", NULL);
17 | if (out_ffd_ == -1)
18 | {
19 | flb_destroy(ctx_);
20 | throw std::runtime_error("Cannot initialize Fluent Bit output null plugin");
21 | }
22 | }
23 |
24 | FlbNull::~FlbNull() = default;
25 |
26 | } // namespace dc_destinations
27 |
28 | #include "pluginlib/class_list_macros.hpp"
29 | PLUGINLIB_EXPORT_CLASS(dc_destinations::FlbNull, dc_core::Destination)
30 |
--------------------------------------------------------------------------------
/dc_destinations/plugins/flb_slack.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_destinations/plugins/flb_slack.hpp"
2 |
3 | namespace dc_destinations
4 | {
5 |
6 | FlbSlack::FlbSlack() : dc_destinations::FlbDestination()
7 | {
8 | }
9 |
10 | void FlbSlack::onConfigure()
11 | {
12 | auto node = getNode();
13 |
14 | nav2_util::declare_parameter_if_not_declared(node, destination_name_ + ".webhook", rclcpp::PARAMETER_STRING);
15 | node->get_parameter(destination_name_ + ".webhook", webhook_);
16 | }
17 |
18 | void FlbSlack::initFlbOutputPlugin()
19 | {
20 | out_ffd_ = flb_output(ctx_, "slack", NULL);
21 | flb_output_set(ctx_, out_ffd_, "webhook", webhook_.c_str(), NULL);
22 | if (out_ffd_ == -1)
23 | {
24 | flb_destroy(ctx_);
25 | throw std::runtime_error("Cannot initialize Fluent Bit output slack plugin");
26 | }
27 | }
28 |
29 | FlbSlack::~FlbSlack() = default;
30 |
31 | } // namespace dc_destinations
32 |
33 | #include "pluginlib/class_list_macros.hpp"
34 | PLUGINLIB_EXPORT_CLASS(dc_destinations::FlbSlack, dc_core::Destination)
35 |
--------------------------------------------------------------------------------
/dc_destinations/plugins/rcl.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_destinations/plugins/rcl.hpp"
2 |
3 | #include
4 | #include
5 |
6 | namespace dc_destinations
7 | {
8 |
9 | Rcl::Rcl() : dc_destinations::Destination()
10 | {
11 | }
12 |
13 | void Rcl::sendData(dc_interfaces::msg::StringStamped::SharedPtr msg)
14 | {
15 | json data = json::parse(msg->data);
16 | data["date"] =
17 | std::stod(std::to_string(msg->header.stamp.sec) + std::string(".") + std::to_string(msg->header.stamp.nanosec));
18 | data.erase("tags");
19 |
20 | RCLCPP_INFO(logger_, "%s", data.dump().c_str());
21 | }
22 |
23 | Rcl::~Rcl() = default;
24 |
25 | } // namespace dc_destinations
26 |
27 | #include "pluginlib/class_list_macros.hpp"
28 | PLUGINLIB_EXPORT_CLASS(dc_destinations::Rcl, dc_core::Destination)
29 |
--------------------------------------------------------------------------------
/dc_destinations/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "dc_destinations/destination_server.hpp"
4 | #include "rclcpp/rclcpp.hpp"
5 |
6 | int main(int argc, char** argv)
7 | {
8 | rclcpp::init(argc, argv);
9 | rclcpp::executors::MultiThreadedExecutor executor;
10 | auto destination_node = std::make_shared();
11 |
12 | executor.add_node(destination_node->get_node_base_interface());
13 | executor.spin();
14 | rclcpp::shutdown();
15 |
16 | return 0;
17 | }
18 |
--------------------------------------------------------------------------------
/dc_group/dc_group/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_group/dc_group/__init__.py
--------------------------------------------------------------------------------
/dc_group/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_group
5 | 0.1.0
6 | DC Group node
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake_python
11 | message_filters
12 | dc_interfaces
13 | rclpy
14 | rclpy_message_converter
15 |
16 |
17 | ament_python
18 |
19 |
20 |
--------------------------------------------------------------------------------
/dc_group/resource/dc_group:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_group/resource/dc_group
--------------------------------------------------------------------------------
/dc_group/setup.cfg:
--------------------------------------------------------------------------------
1 | [develop]
2 | script_dir=$base/lib/dc_group
3 | [install]
4 | install_scripts=$base/lib/dc_group
5 |
--------------------------------------------------------------------------------
/dc_group/setup.py:
--------------------------------------------------------------------------------
1 | """Setup file."""
2 |
3 | import os
4 | from glob import glob
5 |
6 | from setuptools import find_packages, setup
7 |
8 | package_name = "dc_group"
9 |
10 | setup(
11 | name=package_name,
12 | version="0.1.0",
13 | packages=find_packages(),
14 | data_files=[
15 | (
16 | "share/ament_index/resource_index/packages",
17 | ["resource/" + package_name],
18 | ),
19 | (f"share/{package_name}", ["package.xml"]),
20 | (
21 | os.path.join("share", package_name, "launch"),
22 | glob("launch/*launch.py"),
23 | ),
24 | (os.path.join("share", package_name, "config"), glob("config/*.yaml")),
25 | ],
26 | install_requires=["setuptools"],
27 | zip_safe=True,
28 | author="David Bensoussan",
29 | author_email="david.bensoussan@brisa.tech",
30 | maintainer="David Bensoussan",
31 | maintainer_email="david.bensoussan@brisa.tech",
32 | keywords=["ROS"],
33 | classifiers=[
34 | "Intended Audience :: Developers",
35 | "Programming Language :: Python",
36 | "Topic :: Software Development",
37 | ],
38 | description="Collect data and group it",
39 | license="Proprietary",
40 | tests_require=["pytest"],
41 | entry_points={
42 | "console_scripts": [
43 | "group_server = dc_group.group_server:main",
44 | ],
45 | },
46 | )
47 |
--------------------------------------------------------------------------------
/dc_interfaces/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(dc_interfaces)
3 |
4 |
5 | set(dependencies
6 | builtin_interfaces
7 | rosidl_default_generators
8 | sensor_msgs
9 | std_msgs
10 | )
11 | find_package(ament_cmake REQUIRED)
12 | foreach(Dependency IN ITEMS ${dependencies})
13 | find_package(${Dependency} REQUIRED)
14 | endforeach()
15 |
16 |
17 | rosidl_generate_interfaces(
18 | ${PROJECT_NAME}
19 | "msg/Barcode.msg"
20 | "msg/Condition.msg"
21 | "srv/DetectBarcode.srv"
22 | "srv/DrawImage.srv"
23 | "srv/SaveImage.srv"
24 | "msg/StringStamped.msg"
25 | DEPENDENCIES "${dependencies}"
26 | )
27 |
28 | ament_package()
29 |
--------------------------------------------------------------------------------
/dc_interfaces/msg/Barcode.msg:
--------------------------------------------------------------------------------
1 | string data
2 | string type
3 | uint16 top
4 | uint16 left
5 | uint16 width
6 | uint16 height
7 |
--------------------------------------------------------------------------------
/dc_interfaces/msg/Condition.msg:
--------------------------------------------------------------------------------
1 | bool data
2 |
--------------------------------------------------------------------------------
/dc_interfaces/msg/StringStamped.msg:
--------------------------------------------------------------------------------
1 | std_msgs/Header header
2 |
3 | string data
4 | string group_key
5 |
--------------------------------------------------------------------------------
/dc_interfaces/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_interfaces
5 | 0.1.0
6 | Package containing data collection interfaces.
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake
11 |
12 | builtin_interfaces
13 | rosidl_default_generators
14 |
15 | rosidl_default_runtime
16 |
17 | sensor_msgs
18 |
19 | rosidl_interface_packages
20 |
21 |
22 | ament_cmake
23 |
24 |
25 |
--------------------------------------------------------------------------------
/dc_interfaces/srv/DetectBarcode.srv:
--------------------------------------------------------------------------------
1 | sensor_msgs/Image frame
2 | ---
3 | Barcode[] barcodes
4 |
--------------------------------------------------------------------------------
/dc_interfaces/srv/DrawImage.srv:
--------------------------------------------------------------------------------
1 | sensor_msgs/Image frame
2 | string shape
3 | uint16 box_top
4 | uint16 box_left
5 | uint16 box_height
6 | uint16 box_width
7 | uint16 box_thickness
8 | uint16[] color
9 | uint16[] polygon
10 | uint16 font_txt
11 | uint16 font_thickness
12 | float32 font_scale
13 | string text
14 | ---
15 | sensor_msgs/Image frame
16 | bool success
17 |
--------------------------------------------------------------------------------
/dc_interfaces/srv/SaveImage.srv:
--------------------------------------------------------------------------------
1 | sensor_msgs/Image frame
2 | string path
3 | ---
4 | bool success
5 |
--------------------------------------------------------------------------------
/dc_lifecycle_manager/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "dc_lifecycle_manager/lifecycle_manager.hpp"
4 | #include "rclcpp/rclcpp.hpp"
5 |
6 | int main(int argc, char** argv)
7 | {
8 | rclcpp::init(argc, argv);
9 | auto node = std::make_shared();
10 | rclcpp::spin(node);
11 | rclcpp::shutdown();
12 |
13 | return 0;
14 | }
15 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/bool_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__BOOL_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__BOOL_EQUAL_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class BoolEqual : public dc_conditions::Condition
15 | {
16 | public:
17 | BoolEqual();
18 | ~BoolEqual() override;
19 |
20 | protected:
21 | std::string key_;
22 | double value_;
23 | bool getState(dc_interfaces::msg::StringStamped msg) override;
24 | void onConfigure() override;
25 | };
26 |
27 | } // namespace dc_conditions
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__BOOL_EQUAL_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/double_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_EQUAL_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class DoubleEqual : public dc_conditions::Condition
15 | {
16 | public:
17 | DoubleEqual();
18 | ~DoubleEqual() override;
19 |
20 | protected:
21 | std::string key_;
22 | double value_;
23 | bool getState(dc_interfaces::msg::StringStamped msg) override;
24 | void onConfigure() override;
25 | };
26 |
27 | } // namespace dc_conditions
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_EQUAL_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/double_inferior.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_INFERIOR_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_INFERIOR_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class DoubleInferior : public dc_conditions::Condition
15 | {
16 | public:
17 | DoubleInferior();
18 | ~DoubleInferior() override;
19 |
20 | protected:
21 | std::string key_;
22 | double value_;
23 | bool include_value_;
24 | bool getState(dc_interfaces::msg::StringStamped msg) override;
25 | void onConfigure() override;
26 | };
27 |
28 | } // namespace dc_conditions
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_INFERIOR_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/double_superior.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_SUPERIOR_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_SUPERIOR_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class DoubleSuperior : public dc_conditions::Condition
15 | {
16 | public:
17 | DoubleSuperior();
18 | ~DoubleSuperior() override;
19 |
20 | protected:
21 | std::string key_;
22 | double value_;
23 | bool include_value_;
24 | bool getState(dc_interfaces::msg::StringStamped msg) override;
25 | void onConfigure() override;
26 | };
27 |
28 | } // namespace dc_conditions
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__DOUBLE_SUPERIOR_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/exist.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__EXIST_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__EXIST_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class Exist : public dc_conditions::Condition
17 | {
18 | public:
19 | Exist();
20 | ~Exist() override;
21 |
22 | protected:
23 | std::string key_;
24 | bool getState(dc_interfaces::msg::StringStamped msg) override;
25 | void onConfigure() override;
26 | };
27 |
28 | } // namespace dc_conditions
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__EXIST_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/integer_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_EQUAL_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class IntegerEqual : public dc_conditions::Condition
15 | {
16 | public:
17 | IntegerEqual();
18 | ~IntegerEqual() override;
19 |
20 | protected:
21 | std::string key_;
22 | int value_;
23 | bool getState(dc_interfaces::msg::StringStamped msg) override;
24 | void onConfigure() override;
25 | };
26 |
27 | } // namespace dc_conditions
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_EQUAL_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/integer_inferior.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_INFERIOR_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_INFERIOR_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class IntegerInferior : public dc_conditions::Condition
15 | {
16 | public:
17 | IntegerInferior();
18 | ~IntegerInferior() override;
19 |
20 | protected:
21 | std::string key_;
22 | int value_;
23 | bool include_value_;
24 | bool getState(dc_interfaces::msg::StringStamped msg) override;
25 | void onConfigure() override;
26 | };
27 |
28 | } // namespace dc_conditions
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_INFERIOR_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/integer_superior.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_SUPERIOR_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_SUPERIOR_HPP_
3 |
4 | #include "dc_core/condition.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/condition.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "dc_util/string_utils.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class IntegerSuperior : public dc_conditions::Condition
15 | {
16 | public:
17 | IntegerSuperior();
18 | ~IntegerSuperior() override;
19 |
20 | protected:
21 | std::string key_;
22 | int value_;
23 | bool include_value_;
24 | bool getState(dc_interfaces::msg::StringStamped msg) override;
25 | void onConfigure() override;
26 | };
27 |
28 | } // namespace dc_conditions
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__INTEGER_SUPERIOR_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/list_bool_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_BOOL_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_BOOL_EQUAL_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class ListBoolEqual : public dc_conditions::Condition
17 | {
18 | public:
19 | ListBoolEqual();
20 | ~ListBoolEqual() override;
21 |
22 | protected:
23 | std::string key_;
24 | std::vector value_;
25 | bool order_matters_;
26 | bool getState(dc_interfaces::msg::StringStamped msg) override;
27 | void onConfigure() override;
28 | };
29 |
30 | } // namespace dc_conditions
31 |
32 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_BOOL_EQUAL_HPP_
33 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/list_double_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_DOUBLE_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_DOUBLE_EQUAL_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class ListDoubleEqual : public dc_conditions::Condition
17 | {
18 | public:
19 | ListDoubleEqual();
20 | ~ListDoubleEqual() override;
21 |
22 | protected:
23 | std::string key_;
24 | std::vector value_;
25 | bool order_matters_;
26 | bool getState(dc_interfaces::msg::StringStamped msg) override;
27 | void onConfigure() override;
28 | };
29 |
30 | } // namespace dc_conditions
31 |
32 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_DOUBLE_EQUAL_HPP_
33 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/list_integer_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_INTEGER_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_INTEGER_EQUAL_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class ListIntegerEqual : public dc_conditions::Condition
17 | {
18 | public:
19 | ListIntegerEqual();
20 | ~ListIntegerEqual() override;
21 |
22 | protected:
23 | std::string key_;
24 | std::vector value_;
25 | bool order_matters_;
26 | bool getState(dc_interfaces::msg::StringStamped msg) override;
27 | void onConfigure() override;
28 | };
29 |
30 | } // namespace dc_conditions
31 |
32 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_INTEGER_EQUAL_HPP_
33 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/list_string_equal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_STRING_EQUAL_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_STRING_EQUAL_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class ListStringEqual : public dc_conditions::Condition
17 | {
18 | public:
19 | ListStringEqual();
20 | ~ListStringEqual() override;
21 |
22 | protected:
23 | std::string key_;
24 | std::vector value_;
25 | bool order_matters_;
26 | bool getState(dc_interfaces::msg::StringStamped msg) override;
27 | void onConfigure() override;
28 | static bool compareFunction(const std::string& a, const std::string& b);
29 | void sortStringVector(std::vector& str_vector);
30 | };
31 |
32 | } // namespace dc_conditions
33 |
34 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__LIST_STRING_EQUAL_HPP_
35 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/moving.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__MOVING_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__MOVING_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_measurements/condition.hpp"
8 | #include "nav2_util/node_utils.hpp"
9 | #include "nav_msgs/msg/odometry.hpp"
10 |
11 | namespace dc_conditions
12 | {
13 |
14 | class Moving : public dc_conditions::Condition
15 | {
16 | public:
17 | Moving();
18 | ~Moving() override;
19 |
20 | private:
21 | std::string odom_topic_;
22 | void odomCb(const nav_msgs::msg::Odometry& msg);
23 | void onConfigure() override;
24 | rclcpp::Subscription::SharedPtr subscription_;
25 |
26 | float speed_threshold_;
27 | int count_limit_;
28 | int count_hysteresis_;
29 | int moving_count_{ 0 };
30 | };
31 |
32 | } // namespace dc_conditions
33 |
34 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__MOVING_HPP_
35 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/same_as_previous.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__SAME_AS_PREVIOUS_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__SAME_AS_PREVIOUS_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "dc_core/condition.hpp"
9 | #include "dc_interfaces/msg/string_stamped.hpp"
10 | #include "dc_measurements/condition.hpp"
11 | #include "dc_util/json_utils.hpp"
12 | #include "dc_util/string_utils.hpp"
13 | #include "nav2_util/node_utils.hpp"
14 |
15 | namespace dc_conditions
16 | {
17 |
18 | class SameAsPrevious : public dc_conditions::Condition
19 | {
20 | public:
21 | SameAsPrevious();
22 | ~SameAsPrevious() override;
23 |
24 | protected:
25 | std::vector exclude_;
26 | std::vector keys_;
27 | std::vector keys_hash_;
28 | std::vector previous_keys_hash_;
29 | std::string topic_;
30 | bool getState(dc_interfaces::msg::StringStamped msg) override;
31 | void onConfigure() override;
32 | json previous_json_;
33 | bool file_hash_same_{ true };
34 | };
35 |
36 | } // namespace dc_conditions
37 |
38 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__SAME_AS_PREVIOUS_HPP_
39 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/conditions/string_match.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__CONDITION__STRING_MATCH_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__CONDITION__STRING_MATCH_HPP_
3 |
4 | #include
5 |
6 | #include "dc_core/condition.hpp"
7 | #include "dc_interfaces/msg/string_stamped.hpp"
8 | #include "dc_measurements/condition.hpp"
9 | #include "dc_util/json_utils.hpp"
10 | #include "dc_util/string_utils.hpp"
11 | #include "nav2_util/node_utils.hpp"
12 |
13 | namespace dc_conditions
14 | {
15 |
16 | class StringMatch : public dc_conditions::Condition
17 | {
18 | public:
19 | StringMatch();
20 | ~StringMatch() override;
21 |
22 | protected:
23 | std::string key_;
24 | std::string regex_;
25 | bool getState(dc_interfaces::msg::StringStamped msg) override;
26 | void onConfigure() override;
27 | };
28 |
29 | } // namespace dc_conditions
30 |
31 | #endif // DC_MEASUREMENTS__PLUGINS__CONDITION__STRING_MATCH_HPP_
32 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/cmd_vel.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CMD_VEL_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CMD_VEL_HPP_
4 |
5 | #include "dc_core/measurement.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "dc_util/json_utils.hpp"
8 | #include "geometry_msgs/msg/twist.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 | #include "rclcpp/rclcpp.hpp"
11 | #include "rclcpp/serialization.hpp"
12 |
13 | namespace dc_measurements
14 | {
15 |
16 | class CmdVel : public dc_measurements::Measurement
17 | {
18 | public:
19 | CmdVel();
20 | ~CmdVel() override;
21 | dc_interfaces::msg::StringStamped collect() override;
22 |
23 | private:
24 | void cmdVelCb(const geometry_msgs::msg::Twist& msg);
25 | rclcpp::Subscription::SharedPtr subscription_;
26 | dc_interfaces::msg::StringStamped last_data_;
27 | std::string cmd_vel_topic_;
28 |
29 | protected:
30 | /**
31 | * @brief Configuration of behavior action
32 | */
33 | void onConfigure() override;
34 | void setValidationSchema() override;
35 | };
36 |
37 | } // namespace dc_measurements
38 |
39 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CMD_VEL_HPP_
40 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/cpu.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CPU_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CPU_HPP_
4 |
5 | #include "dc_core/measurement.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "dc_measurements/system/linux_parser.hpp"
8 | #include "dc_measurements/system/system.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_measurements
12 | {
13 |
14 | class Cpu : public dc_measurements::Measurement
15 | {
16 | public:
17 | Cpu();
18 | ~Cpu() override;
19 | dc_interfaces::msg::StringStamped collect() override;
20 |
21 | private:
22 | System system_;
23 | int max_processes_;
24 | float cpu_min_;
25 |
26 | protected:
27 | /**
28 | * @brief Configuration of behavior action
29 | */
30 | void onConfigure() override;
31 | void setValidationSchema() override;
32 | void setProcessesUsage(json& data_json);
33 | void setAverageCpu(json& data_json);
34 | void setValidationSchema(json& data_json);
35 | };
36 |
37 | } // namespace dc_measurements
38 |
39 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CPU_HPP_
40 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/distance_traveled.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DISTANCE_TRAVELED_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DISTANCE_TRAVELED_HPP_
3 |
4 | #include "dc_core/measurement.hpp"
5 | #include "dc_measurements/measurement.hpp"
6 | #include "nav2_util/node_utils.hpp"
7 | #include "nav2_util/robot_utils.hpp"
8 |
9 | namespace dc_measurements
10 | {
11 |
12 | class DistanceTraveled : public dc_measurements::Measurement
13 | {
14 | public:
15 | DistanceTraveled();
16 | ~DistanceTraveled() override;
17 | dc_interfaces::msg::StringStamped collect() override;
18 |
19 | protected:
20 | /**
21 | * @brief Configuration of behavior action
22 | */
23 | void onConfigure() override;
24 | void setValidationSchema() override;
25 |
26 | std::string global_frame_;
27 | std::string robot_base_frame_;
28 | float transform_timeout_;
29 | long double distance_traveled_ = 0.0;
30 | float last_x_ = 0.0;
31 | float last_y_ = 0.0;
32 | };
33 |
34 | } // namespace dc_measurements
35 |
36 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DISTANCE_TRAVELED_HPP_
37 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/dummy.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DUMMY_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DUMMY_HPP_
3 |
4 | #include "dc_core/measurement.hpp"
5 | #include "dc_measurements/measurement.hpp"
6 | #include "nav2_util/node_utils.hpp"
7 |
8 | namespace dc_measurements
9 | {
10 |
11 | class Dummy : public dc_measurements::Measurement
12 | {
13 | public:
14 | Dummy();
15 | ~Dummy() override;
16 | dc_interfaces::msg::StringStamped collect() override;
17 |
18 | protected:
19 | /**
20 | * @brief Set validation schema used to confirm data before collecting it
21 | */
22 | void setValidationSchema() override;
23 | void onConfigure() override;
24 | std::string record_;
25 | };
26 |
27 | } // namespace dc_measurements
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__DUMMY_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/ip_camera.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__IP_CAMERA_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__IP_CAMERA_HPP_
4 |
5 | #include
6 |
7 | extern "C" {
8 | #include
9 | }
10 |
11 | #include "dc_core/measurement.hpp"
12 | #include "dc_measurements/measurement.hpp"
13 | #include "dc_util/string_utils.hpp"
14 | #include "nav2_util/node_utils.hpp"
15 | #include "nav2_util/robot_utils.hpp"
16 |
17 | namespace dc_measurements
18 | {
19 |
20 | class IpCamera : public dc_measurements::Measurement
21 | {
22 | public:
23 | IpCamera();
24 | ~IpCamera() override;
25 | dc_interfaces::msg::StringStamped collect() override;
26 | std::string getAbsolutePath(const std::string& param_reference);
27 |
28 | private:
29 | std::string input_;
30 | bool video_;
31 | bool audio_;
32 | bool segment_;
33 | int segment_time_;
34 | std::string ffmpeg_log_level_;
35 | bool ffmpeg_banner_;
36 | std::string save_path_;
37 | std::string storage_dir_;
38 | std::thread ffmpeg_thread_;
39 | std::string bitrate_video_;
40 | std::string bitrate_audio_;
41 |
42 | protected:
43 | /**
44 | * @brief Configuration of behavior action
45 | */
46 | void setValidationSchema() override;
47 | void onConfigure() override;
48 | };
49 |
50 | } // namespace dc_measurements
51 |
52 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__IP_CAMERA_HPP_
53 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/memory.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__MEMORY_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__MEMORY_HPP_
4 |
5 | #include "dc_core/measurement.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "dc_measurements/system/linux_parser.hpp"
8 | #include "dc_measurements/system/system.hpp"
9 |
10 | namespace dc_measurements
11 | {
12 | // using MemoryMsg = dc_interfaces::msg::Memory;
13 |
14 | class Memory : public dc_measurements::Measurement
15 | {
16 | public:
17 | Memory();
18 | ~Memory() override;
19 | dc_interfaces::msg::StringStamped collect() override;
20 |
21 | protected:
22 | /**
23 | * @brief Configuration of behavior action
24 | */
25 | void setValidationSchema() override;
26 | };
27 |
28 | } // namespace dc_measurements
29 |
30 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__CPU_HPP_
31 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/os.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__OS_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__OS_HPP_
3 |
4 | #include "dc_core/measurement.hpp"
5 | #include "dc_measurements/measurement.hpp"
6 | #include "dc_measurements/system/linux_parser.hpp"
7 | #include "dc_measurements/system/system.hpp"
8 |
9 | namespace dc_measurements
10 | {
11 |
12 | class OS : public dc_measurements::Measurement
13 | {
14 | public:
15 | OS();
16 | ~OS() override;
17 | dc_interfaces::msg::StringStamped collect() override;
18 |
19 | protected:
20 | /**
21 | * @brief Configuration of behavior action
22 | */
23 | void setValidationSchema() override;
24 | unsigned long long getTotalSystemMemory();
25 | };
26 |
27 | } // namespace dc_measurements
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__OS_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/permissions.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__PERMISSIONS_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__PERMISSIONS_HPP_
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | #include "dc_core/measurement.hpp"
17 | #include "dc_measurements/measurement.hpp"
18 | #include "dc_util/string_utils.hpp"
19 | #include "nav2_util/node_utils.hpp"
20 |
21 | namespace dc_measurements
22 | {
23 |
24 | class Permissions : public dc_measurements::Measurement
25 | {
26 | public:
27 | Permissions();
28 | ~Permissions() override;
29 | dc_interfaces::msg::StringStamped collect() override;
30 |
31 | private:
32 | struct stat getOwner(const std::string& path);
33 | std::string formatPermissions(const mode_t& perm, const std::string& format);
34 | std::string path_;
35 | std::string full_path_;
36 | std::string permission_format_;
37 |
38 | protected:
39 | /**
40 | * @brief Configuration of behavior action
41 | */
42 | void onConfigure() override;
43 | void setValidationSchema() override;
44 | };
45 |
46 | } // namespace dc_measurements
47 |
48 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__PERMISSIONS_HPP_
49 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/position.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__POSITION_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__POSITION_HPP_
4 |
5 | #include "dc_core/measurement.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "nav2_util/node_utils.hpp"
8 | #include "nav2_util/robot_utils.hpp"
9 |
10 | namespace dc_measurements
11 | {
12 |
13 | class Position : public dc_measurements::Measurement
14 | {
15 | public:
16 | Position();
17 | ~Position() override;
18 | dc_interfaces::msg::StringStamped collect() override;
19 |
20 | protected:
21 | /**
22 | * @brief Configuration of behavior action
23 | */
24 | void onConfigure() override;
25 | void setValidationSchema() override;
26 |
27 | std::string global_frame_;
28 | std::string robot_base_frame_;
29 | float transform_timeout_;
30 | };
31 |
32 | } // namespace dc_measurements
33 |
34 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__POSITION_HPP_
35 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/speed.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__SPEED_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__SPEED_HPP_
4 |
5 | #include "dc_core/measurement.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "nav2_util/node_utils.hpp"
8 | #include "nav_msgs/msg/odometry.hpp"
9 |
10 | namespace dc_measurements
11 | {
12 |
13 | class Speed : public dc_measurements::Measurement
14 | {
15 | public:
16 | Speed();
17 | ~Speed() override;
18 | dc_interfaces::msg::StringStamped collect() override;
19 |
20 | protected:
21 | /**
22 | * @brief Configuration of behavior action
23 | */
24 | void onConfigure() override;
25 | void setValidationSchema() override;
26 | void odomCb(const nav_msgs::msg::Odometry& msg);
27 |
28 | std::string odom_topic_;
29 | rclcpp::Subscription::SharedPtr subscription_;
30 | dc_interfaces::msg::StringStamped last_data_;
31 | };
32 |
33 | } // namespace dc_measurements
34 |
35 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__SPEED_HPP_
36 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/storage.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STORAGE_HPP_
3 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STORAGE_HPP_
4 |
5 | #include
6 |
7 | #include "dc_core/measurement.hpp"
8 | #include "dc_measurements/measurement.hpp"
9 | #include "dc_util/string_utils.hpp"
10 | #include "nav2_util/node_utils.hpp"
11 | #include "rclcpp/rclcpp.hpp"
12 |
13 | namespace dc_measurements
14 | {
15 |
16 | class Storage : public dc_measurements::Measurement
17 | {
18 | public:
19 | Storage();
20 | ~Storage() override;
21 | dc_interfaces::msg::StringStamped collect() override;
22 |
23 | private:
24 | std::string path_;
25 | std::string full_path_;
26 |
27 | protected:
28 | /**
29 | * @brief Configuration of behavior action
30 | */
31 | void onConfigure() override;
32 | void setValidationSchema() override;
33 | };
34 |
35 | } // namespace dc_measurements
36 |
37 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STORAGE_HPP_
38 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/string_stamped.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STRING_STAMPED_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STRING_STAMPED_HPP_
3 |
4 | #include "dc_core/measurement.hpp"
5 | #include "dc_interfaces/msg/string_stamped.hpp"
6 | #include "dc_measurements/measurement.hpp"
7 | #include "nav2_util/node_utils.hpp"
8 |
9 | namespace dc_measurements
10 | {
11 |
12 | class StringStamped : public dc_measurements::Measurement
13 | {
14 | public:
15 | StringStamped();
16 | ~StringStamped() override;
17 | dc_interfaces::msg::StringStamped collect() override;
18 | void dataCb(const dc_interfaces::msg::StringStamped& msg);
19 | void onConfigure() override;
20 |
21 | protected:
22 | /**
23 | * @brief Set validation schema used to confirm data before collecting it
24 | */
25 | void setValidationSchema() override;
26 | dc_interfaces::msg::StringStamped last_data_;
27 | std::string topic_;
28 | rclcpp::Subscription::SharedPtr subscription_;
29 | bool timer_based_;
30 | };
31 |
32 | } // namespace dc_measurements
33 |
34 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__STRING_STAMPED_HPP_
35 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/tcp_health.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__TCP_HEALTH_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__TCP_HEALTH_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "dc_core/measurement.hpp"
8 | #include "dc_measurements/measurement.hpp"
9 | #include "nav2_util/node_utils.hpp"
10 |
11 | namespace dc_measurements
12 | {
13 |
14 | class TCPHealth : public dc_measurements::Measurement
15 | {
16 | public:
17 | TCPHealth();
18 | ~TCPHealth() override;
19 | dc_interfaces::msg::StringStamped collect() override;
20 | bool getPortHealth(unsigned short port);
21 |
22 | protected:
23 | /**
24 | * @brief Configuration of behavior action
25 | */
26 | void onConfigure() override;
27 | void setValidationSchema() override;
28 | std::string host_;
29 | std::string name_;
30 | unsigned short port_;
31 | };
32 |
33 | } // namespace dc_measurements
34 |
35 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__TCP_HEALTH_HPP_
36 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/plugins/measurements/uptime.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__UPTIME_HPP_
2 | #define DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__UPTIME_HPP_
3 |
4 | #include "dc_core/measurement.hpp"
5 | #include "dc_measurements/measurement.hpp"
6 | #include "dc_measurements/system/linux_parser.hpp"
7 | #include "dc_measurements/system/system.hpp"
8 |
9 | namespace dc_measurements
10 | {
11 |
12 | class Uptime : public dc_measurements::Measurement
13 | {
14 | public:
15 | Uptime();
16 | ~Uptime() override;
17 | dc_interfaces::msg::StringStamped collect() override;
18 |
19 | protected:
20 | /**
21 | * @brief Set validation schema used to confirm data before collecting it
22 | */
23 | void setValidationSchema() override;
24 | System system_;
25 | };
26 |
27 | } // namespace dc_measurements
28 |
29 | #endif // DC_MEASUREMENTS__PLUGINS__MEASUREMENTS__UPTIME_HPP_
30 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/system/process.hpp:
--------------------------------------------------------------------------------
1 | #ifndef PROCESS_HPP
2 | #define PROCESS_HPP
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | /********* Process class *******
9 | * Initializes a queue structure, preparing it for usage.
10 | */
11 | class Process
12 | {
13 | public:
14 | Process(int pid);
15 | int pid();
16 | std::string user();
17 | std::string command();
18 | float cpuUtilization() const;
19 | std::string cpuPretty(int precision) const;
20 | int ram();
21 | unsigned int upTime();
22 | bool operator<(Process const& that) const;
23 | bool operator>(Process const& that) const;
24 | void updateCpuData();
25 |
26 | private:
27 | int pid_{ 0 };
28 | std::string user_ = "";
29 | std::string command_ = "";
30 | long start_time_{ 0 };
31 |
32 | void addValue(int jiffy_type, long value);
33 | std::vector> cpu_data_ = {};
34 | float cpu_util_{ 0 };
35 | };
36 |
37 | enum JiffyData
38 | {
39 | K_JIFFIES_SYS = 0,
40 | K_JIFFIES_PROC
41 | };
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/system/processor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef PROCESSOR_HPP
2 | #define PROCESSOR_HPP
3 |
4 | #include
5 | #include
6 |
7 | /********* Processor class *******
8 | * Abstracts the system CPUs, collecting and calculating processor usage.
9 | */
10 |
11 | struct CpuNData
12 | {
13 | int idle;
14 | int active;
15 | };
16 |
17 | class Processor
18 | {
19 | public:
20 | std::vector utilization();
21 | void updateData();
22 | void updateResult();
23 | int numCpus();
24 |
25 | private:
26 | // Each vector represents CPU n, with a nested vector of CPU samples.
27 | std::vector> cpu_data_;
28 | // Each float represents the percentage of active time for CPU n.
29 | std::vector cpu_result_;
30 |
31 | void addCpuSample(int cpu_id, int idle, int active);
32 | };
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/dc_measurements/include/dc_measurements/system/system.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SYSTEM_HPP
2 | #define SYSTEM_HPP
3 |
4 | #include
5 | #include
6 |
7 | #include "process.hpp"
8 | #include "processor.hpp"
9 |
10 | /********* System class *******
11 | * Unifier that provides interfacing to the system monitor modules.
12 | */
13 | class System
14 | {
15 | public:
16 | Processor& cpu();
17 | std::vector& processes();
18 | float memoryUtilization();
19 | long upTime();
20 | int totalProcesses();
21 | int runningProcesses();
22 | std::string kernel();
23 | std::string operatingSystem();
24 |
25 | private:
26 | Processor cpu_ = {};
27 | std::vector processes_ = {};
28 |
29 | std::vector dumpPids();
30 | std::vector noPartner(const std::vector partner_a, const std::vector& partner_b);
31 | void addProcs(const std::vector& pid_list);
32 | void pruneProcs(std::vector dead_pids);
33 | void sortProcsByCpu();
34 | };
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/dc_measurements/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_measurements
5 | 0.1.0
6 | Collect data with measurement plugins
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake_ros
11 |
12 | cv_bridge
13 | dc_core
14 | dc_interfaces
15 | dc_lifecycle_manager
16 | dc_util
17 | ffmpeg
18 | geometry_msgs
19 | lifecycle_msgs
20 | nav2_util
21 | nlohmann-json-dev
22 | nlohmann_json_schema_validator_vendor
23 | pkg-config
24 | pluginlib
25 | sensor_msgs
26 | std_msgs
27 | tf2
28 | tf2_ros
29 | yaml_cpp_vendor
30 |
31 | ament_cmake_gtest
32 |
33 |
34 | ament_cmake
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/conditions/exist.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/conditions/exist.hpp"
2 |
3 | namespace dc_conditions
4 | {
5 |
6 | Exist::Exist() : dc_conditions::Condition()
7 | {
8 | }
9 |
10 | void Exist::onConfigure()
11 | {
12 | auto node = getNode();
13 | nav2_util::declare_parameter_if_not_declared(node, condition_name_ + ".key", rclcpp::PARAMETER_STRING);
14 | node->get_parameter(condition_name_ + ".key", key_);
15 | }
16 |
17 | bool Exist::getState(dc_interfaces::msg::StringStamped msg)
18 | {
19 | try
20 | {
21 | json data_json = json::parse(msg.data);
22 | json flat_json = data_json.flatten();
23 | std::string key_w_prefix = std::string("/") + key_ + "/";
24 |
25 | bool found = false;
26 | for (auto& x : flat_json.items())
27 | {
28 | if (x.key().rfind(key_w_prefix, 0) == 0)
29 | {
30 | found = true;
31 | break;
32 | }
33 | }
34 | active_ = found;
35 |
36 | publishActive();
37 | }
38 | catch (json::parse_error& e)
39 | {
40 | RCLCPP_ERROR_STREAM(logger_, "Error parsing JSON (exist): " << msg.data);
41 | return false;
42 | }
43 | return active_;
44 | }
45 |
46 | Exist::~Exist() = default;
47 |
48 | } // namespace dc_conditions
49 |
50 | #include "pluginlib/class_list_macros.hpp"
51 | PLUGINLIB_EXPORT_CLASS(dc_conditions::Exist, dc_core::Condition)
52 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/conditions/string_match.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/conditions/string_match.hpp"
2 |
3 | namespace dc_conditions
4 | {
5 |
6 | StringMatch::StringMatch() : dc_conditions::Condition()
7 | {
8 | }
9 |
10 | void StringMatch::onConfigure()
11 | {
12 | auto node = getNode();
13 | nav2_util::declare_parameter_if_not_declared(node, condition_name_ + ".key", rclcpp::PARAMETER_STRING);
14 | nav2_util::declare_parameter_if_not_declared(node, condition_name_ + ".regex", rclcpp::PARAMETER_STRING);
15 | node->get_parameter(condition_name_ + ".regex", regex_);
16 | node->get_parameter(condition_name_ + ".key", key_);
17 | }
18 |
19 | bool StringMatch::getState(dc_interfaces::msg::StringStamped msg)
20 | {
21 | json data_json = json::parse(msg.data);
22 | json flat_json = data_json.flatten();
23 |
24 | std::string key_w_prefix = std::string("/") + key_;
25 |
26 | if (!flat_json.contains(key_w_prefix))
27 | {
28 | RCLCPP_WARN_STREAM(logger_, "Key " << key_ << " not found in msg: " << msg.data);
29 | return false;
30 | }
31 |
32 | const std::regex base_regex(regex_);
33 |
34 | active_ = std::regex_match(flat_json[key_w_prefix].get(), base_regex);
35 | publishActive();
36 | return active_;
37 | }
38 |
39 | StringMatch::~StringMatch() = default;
40 |
41 | } // namespace dc_conditions
42 |
43 | #include "pluginlib/class_list_macros.hpp"
44 | PLUGINLIB_EXPORT_CLASS(dc_conditions::StringMatch, dc_core::Condition)
45 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/dummy.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/measurements/dummy.hpp"
2 |
3 | namespace dc_measurements
4 | {
5 |
6 | Dummy::Dummy() : dc_measurements::Measurement()
7 | {
8 | }
9 |
10 | Dummy::~Dummy() = default;
11 |
12 | void Dummy::setValidationSchema()
13 | {
14 | if (enable_validator_)
15 | {
16 | validateSchema("dc_measurements", "dummy.json");
17 | }
18 | }
19 |
20 | void Dummy::onConfigure()
21 | {
22 | auto node = getNode();
23 | nav2_util::declare_parameter_if_not_declared(node, measurement_name_ + ".record",
24 | rclcpp::ParameterValue("{\"message\":\"Hello from ROS 2 DC\"}"));
25 |
26 | node->get_parameter(measurement_name_ + ".record", record_);
27 | }
28 |
29 | dc_interfaces::msg::StringStamped Dummy::collect()
30 | {
31 | auto node = getNode();
32 | dc_interfaces::msg::StringStamped msg;
33 | msg.header.stamp = node->get_clock()->now();
34 | msg.group_key = group_key_;
35 |
36 | try
37 | {
38 | json data_json = json::parse(record_);
39 | msg.data = data_json.dump(-1, ' ', true);
40 | }
41 | catch (json::parse_error& ex)
42 | {
43 | RCLCPP_ERROR_STREAM(logger_, "Could not parse record as JSON: " << record_);
44 | }
45 |
46 | return msg;
47 | }
48 |
49 | } // namespace dc_measurements
50 |
51 | #include "pluginlib/class_list_macros.hpp"
52 | PLUGINLIB_EXPORT_CLASS(dc_measurements::Dummy, dc_core::Measurement)
53 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/cmd_vel.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Cmd_vel",
4 | "description": "Command velocity sent to the robot",
5 | "properties": {
6 | "computed": {
7 | "description": "Computed command velocity in meter/s",
8 | "type": "number"
9 | },
10 | "linear": {
11 | "description": "Linear velocity as a vector",
12 | "type": "object",
13 | "items": {
14 | "$ref": "#/$defs/vector3"
15 | }
16 | },
17 | "angular": {
18 | "description": "Angular velocity as a vector",
19 | "type": "object",
20 | "items": {
21 | "$ref": "#/$defs/vector3"
22 | }
23 | }
24 | },
25 | "$defs": {
26 | "vector3": {
27 | "type": "object",
28 | "properties": {
29 | "x": {
30 | "description": "X speed",
31 | "type": "number"
32 | },
33 | "y": {
34 | "description": "Y speed",
35 | "type": "number"
36 | },
37 | "z": {
38 | "description": "Z speed",
39 | "type": "number"
40 | }
41 | }
42 | }
43 | },
44 | "type": "object"
45 | }
46 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/distance_traveled.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Distance traveled",
4 | "description": "Total distance traveled in meters by the robot",
5 | "properties": {
6 | "distance_traveled": {
7 | "description": "Total distance traveled in meters",
8 | "type": "number"
9 | }
10 | },
11 | "type": "object"
12 | }
13 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/dummy.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Dummy",
4 | "description": "Dummy JSON",
5 | "properties": {
6 | "message": {
7 | "description": "Dummy message",
8 | "type": "string"
9 | }
10 | },
11 | "type": "object"
12 | }
13 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/ip_camera.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Ip Camera",
4 | "description": "Local and remote path where the remote camera video is recorded",
5 | "properties": {
6 | "local_path": {
7 | "description": "Local video path",
8 | "type": "string"
9 | },
10 | "remote_path": {
11 | "description": "Remote video path",
12 | "type": "string"
13 | }
14 | },
15 | "type": "object"
16 | }
17 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/memory.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Memory",
4 | "description": "Memory used",
5 | "properties": {
6 | "used": {
7 | "description": "Memory used in percent",
8 | "type": "number",
9 | "minimum": 0
10 | }
11 | },
12 | "type": "object"
13 | }
14 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/network.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Network",
4 | "description": "Network accessibility and information",
5 | "properties": {
6 | "ping": {
7 | "description": "Time to ping the host in ms",
8 | "type": "integer",
9 | "minimum": -1
10 | },
11 | "online": {
12 | "description": "If the pc is online",
13 | "type": "boolean"
14 | },
15 | "interfaces": {
16 | "description": "List of network interfaces",
17 | "type": "array",
18 | "items": {
19 | "type": "string"
20 | }
21 | }
22 | },
23 | "type": "object"
24 | }
25 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/os.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "OS",
4 | "description": "OS, kernel and CPUs information",
5 | "properties": {
6 | "os": {
7 | "description": "Host distribution name",
8 | "type": "string"
9 | },
10 | "kernel": {
11 | "description": "Kernel version",
12 | "type": "string"
13 | },
14 | "cpu": {
15 | "description": "Number of CPUs",
16 | "type": "integer",
17 | "minimum": 0
18 | },
19 | "memory": {
20 | "description": "System memory",
21 | "type": "number",
22 | "minimum": 0
23 | }
24 | },
25 | "type": "object"
26 | }
27 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/permissions.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Permissions",
4 | "description": "Permissions of a file/directory",
5 | "properties": {
6 | "uid": {
7 | "description": "File/directory User IDentifier",
8 | "type": "integer"
9 | },
10 | "gid": {
11 | "description": "File/directory Group IDentifier",
12 | "type": "integer"
13 | },
14 | "exists": {
15 | "description": "File/directory exists",
16 | "type": "boolean"
17 | },
18 | "permissions": {
19 | "description": "Permissions as rwx or integer",
20 | "type": "string"
21 | }
22 | },
23 | "type": "object"
24 | }
25 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/position.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Position",
4 | "description": "Position and orientation of the robot",
5 | "properties": {
6 | "x": {
7 | "description": "X position of the robot",
8 | "type": "number"
9 | },
10 | "y": {
11 | "description": "Y position of the robot",
12 | "type": "number"
13 | },
14 | "yaw": {
15 | "description": "Yaw angle of the robot",
16 | "type": "number"
17 | }
18 | },
19 | "type": "object"
20 | }
21 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/speed.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Speed",
4 | "description": "Computed, linear and angular speed of the robot",
5 | "properties": {
6 | "computed": {
7 | "description": "Computed speed in meter/s",
8 | "type": "number"
9 | },
10 | "linear": {
11 | "description": "Linear velocity as a vector",
12 | "type": "object",
13 | "items": {
14 | "$ref": "#/$defs/vector3"
15 | }
16 | },
17 | "angular": {
18 | "description": "Angular velocity as a vector",
19 | "type": "object",
20 | "items": {
21 | "$ref": "#/$defs/vector3"
22 | }
23 | }
24 | },
25 | "$defs": {
26 | "vector3": {
27 | "type": "object",
28 | "properties": {
29 | "x": {
30 | "description": "X speed",
31 | "type": "number"
32 | },
33 | "y": {
34 | "description": "Y speed",
35 | "type": "number"
36 | },
37 | "z": {
38 | "description": "Z speed",
39 | "type": "number"
40 | }
41 | }
42 | }
43 | },
44 | "type": "object"
45 | }
46 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/storage.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Storage",
4 | "description": "Storage information of a directory",
5 | "properties": {
6 | "free_percent": {
7 | "description": "Free space on the filesystem, in percent",
8 | "type": "number",
9 | "minimum": 0
10 | },
11 | "free": {
12 | "description": "Free space on the filesystem, in bytes",
13 | "type": "integer",
14 | "minimum": 0
15 | },
16 | "capacity": {
17 | "description": "Total size of the filesystem, in bytes",
18 | "type": "integer",
19 | "minimum": 0
20 | }
21 | },
22 | "type": "object"
23 | }
24 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/tcp_health.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "TCP Health",
4 | "description": "Status of a TCP server",
5 | "properties": {
6 | "host": {
7 | "description": "Server hostname",
8 | "type": "string"
9 | },
10 | "port": {
11 | "description": "Port number",
12 | "type": "integer",
13 | "minimum": 1,
14 | "maximum": 65536
15 | },
16 | "server_name": {
17 | "description": "Time the system has been up",
18 | "type": "string"
19 | }
20 | },
21 | "type": "object"
22 | }
23 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/json/uptime.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Uptime",
4 | "description": "Time the system has been up",
5 | "properties": {
6 | "time": {
7 | "description": "Time the system has been up",
8 | "type": "integer",
9 | "minimum": 0
10 | }
11 | },
12 | "type": "object"
13 | }
14 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/memory.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/measurements/memory.hpp"
2 |
3 | namespace dc_measurements
4 | {
5 |
6 | Memory::Memory() : dc_measurements::Measurement()
7 | {
8 | }
9 |
10 | Memory::~Memory() = default;
11 |
12 | void Memory::setValidationSchema()
13 | {
14 | if (enable_validator_)
15 | {
16 | validateSchema("dc_measurements", "memory.json");
17 | }
18 | }
19 |
20 | dc_interfaces::msg::StringStamped Memory::collect()
21 | {
22 | auto node = getNode();
23 | dc_interfaces::msg::StringStamped msg;
24 | msg.header.stamp = node->get_clock()->now();
25 | msg.group_key = group_key_;
26 | json data_json;
27 | data_json["used"] = System().memoryUtilization() * 100;
28 | msg.data = data_json.dump(-1, ' ', true);
29 |
30 | return msg;
31 | }
32 |
33 | } // namespace dc_measurements
34 |
35 | #include "pluginlib/class_list_macros.hpp"
36 | PLUGINLIB_EXPORT_CLASS(dc_measurements::Memory, dc_core::Measurement)
37 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/os.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/measurements/os.hpp"
2 |
3 | namespace dc_measurements
4 | {
5 | namespace lp = LinuxParser;
6 |
7 | OS::OS() : dc_measurements::Measurement()
8 | {
9 | }
10 |
11 | OS::~OS() = default;
12 |
13 | void OS::setValidationSchema()
14 | {
15 | if (enable_validator_)
16 | {
17 | validateSchema("dc_measurements", "os.json");
18 | }
19 | }
20 |
21 | unsigned long long OS::getTotalSystemMemory()
22 | {
23 | long pages = sysconf(_SC_PHYS_PAGES);
24 | long page_size = sysconf(_SC_PAGE_SIZE);
25 | return pages * page_size;
26 | }
27 |
28 | dc_interfaces::msg::StringStamped OS::collect()
29 | {
30 | auto node = getNode();
31 | dc_interfaces::msg::StringStamped msg;
32 | msg.header.stamp = node->get_clock()->now();
33 | msg.group_key = group_key_;
34 | json data_json;
35 | data_json["os"] = lp::OperatingSystem();
36 | data_json["kernel"] = lp::Kernel();
37 | data_json["cpus"] = Processor().numCpus();
38 | auto mem_total = getTotalSystemMemory();
39 | // Convert to Gb
40 | double mem_total_gb = (((mem_total / 1024.0) / 1024.0) / 1024.0);
41 | // Round to 2 decimals
42 | data_json["memory"] = std::ceil(mem_total_gb * 100.0) / 100.0;
43 |
44 | msg.data = data_json.dump(-1, ' ', true);
45 |
46 | return msg;
47 | }
48 |
49 | } // namespace dc_measurements
50 |
51 | #include "pluginlib/class_list_macros.hpp"
52 | PLUGINLIB_EXPORT_CLASS(dc_measurements::OS, dc_core::Measurement)
53 |
--------------------------------------------------------------------------------
/dc_measurements/plugins/measurements/uptime.cpp:
--------------------------------------------------------------------------------
1 | #include "dc_measurements/plugins/measurements/uptime.hpp"
2 |
3 | namespace dc_measurements
4 | {
5 | namespace lp = LinuxParser;
6 |
7 | Uptime::Uptime() : dc_measurements::Measurement()
8 | {
9 | }
10 |
11 | Uptime::~Uptime() = default;
12 |
13 | void Uptime::setValidationSchema()
14 | {
15 | if (enable_validator_)
16 | {
17 | validateSchema("dc_measurements", "uptime.json");
18 | }
19 | }
20 |
21 | dc_interfaces::msg::StringStamped Uptime::collect()
22 | {
23 | auto uptime = system_.upTime();
24 |
25 | auto node = getNode();
26 | dc_interfaces::msg::StringStamped msg;
27 | msg.header.stamp = node->get_clock()->now();
28 | msg.group_key = group_key_;
29 | json data_json;
30 | data_json["time"] = uptime;
31 |
32 | msg.data = data_json.dump(-1, ' ', true);
33 |
34 | return msg;
35 | }
36 |
37 | } // namespace dc_measurements
38 |
39 | #include "pluginlib/class_list_macros.hpp"
40 | PLUGINLIB_EXPORT_CLASS(dc_measurements::Uptime, dc_core::Measurement)
41 |
--------------------------------------------------------------------------------
/dc_measurements/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "dc_measurements/measurement_server.hpp"
4 | #include "rclcpp/rclcpp.hpp"
5 |
6 | int main(int argc, char** argv)
7 | {
8 | rclcpp::init(argc, argv);
9 | rclcpp::executors::MultiThreadedExecutor executor;
10 | auto measurement_node = std::make_shared();
11 |
12 | executor.add_node(measurement_node->get_node_base_interface());
13 | executor.spin();
14 | rclcpp::shutdown();
15 |
16 | return 0;
17 | }
18 |
--------------------------------------------------------------------------------
/dc_services/dc_services/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_services/dc_services/__init__.py
--------------------------------------------------------------------------------
/dc_services/launch/dc_detection_barcodes.launch.py:
--------------------------------------------------------------------------------
1 | """Launch barcode detection node."""
2 |
3 | import launch
4 | import launch_ros.actions
5 |
6 |
7 | def generate_launch_description() -> launch.LaunchDescription:
8 | """Launch file generator.
9 |
10 | Returns:
11 | launch.LaunchDescription: Launch
12 | """
13 | barcode_node = launch_ros.actions.Node(
14 | package="dc_services",
15 | executable="barcode_detection",
16 | namespace="/dc/service",
17 | output={
18 | "stdout": "screen",
19 | "stderr": "screen",
20 | },
21 | )
22 |
23 | nodes = [barcode_node]
24 | return launch.LaunchDescription(nodes)
25 |
--------------------------------------------------------------------------------
/dc_services/launch/dc_draw_image.launch.py:
--------------------------------------------------------------------------------
1 | """Launch draw image node."""
2 |
3 | import launch
4 | import launch_ros.actions
5 |
6 |
7 | def generate_launch_description() -> launch.LaunchDescription:
8 | """Launch file generator.
9 |
10 | Returns:
11 | launch.LaunchDescription: Launch
12 | """
13 | barcode_node = launch_ros.actions.Node(
14 | package="dc_services",
15 | executable="draw_image",
16 | namespace="/dc/service",
17 | output={
18 | "stdout": "screen",
19 | "stderr": "screen",
20 | },
21 | )
22 |
23 | nodes = [barcode_node]
24 | return launch.LaunchDescription(nodes)
25 |
--------------------------------------------------------------------------------
/dc_services/launch/dc_save_image.launch.py:
--------------------------------------------------------------------------------
1 | """Launch save image node."""
2 |
3 | import launch
4 | import launch_ros.actions
5 |
6 |
7 | def generate_launch_description() -> launch.LaunchDescription:
8 | """Launch file generator.
9 |
10 | Returns:
11 | launch.LaunchDescription: Launch
12 | """
13 | barcode_node = launch_ros.actions.Node(
14 | package="dc_services",
15 | executable="save_image",
16 | namespace="/dc/service",
17 | output={
18 | "stdout": "screen",
19 | "stderr": "screen",
20 | },
21 | )
22 |
23 | nodes = [barcode_node]
24 | return launch.LaunchDescription(nodes)
25 |
--------------------------------------------------------------------------------
/dc_services/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_services
5 | 0.1.0
6 | Collect uptime data
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | rclpy
11 | dc_interfaces
12 | zbar
13 |
14 |
15 | ament_python
16 |
17 |
18 |
--------------------------------------------------------------------------------
/dc_services/resource/dc_services:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_services/resource/dc_services
--------------------------------------------------------------------------------
/dc_services/setup.cfg:
--------------------------------------------------------------------------------
1 | [develop]
2 | script_dir=$base/lib/dc_services
3 | [install]
4 | install_scripts=$base/lib/dc_services
5 |
--------------------------------------------------------------------------------
/dc_simulation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | project(dc_simulation)
3 |
4 | find_package(ament_cmake REQUIRED)
5 | find_package(ament_cmake_python REQUIRED)
6 | find_package(gazebo_ros REQUIRED)
7 | find_package(rclpy REQUIRED)
8 | find_package(aws_robomaker_small_warehouse_world REQUIRED)
9 |
10 | install(
11 | DIRECTORY launch maps models rviz worlds
12 | DESTINATION share/${PROJECT_NAME}
13 | )
14 |
15 | ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/dc_simulation.dsv.in")
16 |
17 | ament_export_dependencies(ament_cmake)
18 | ament_export_dependencies(gazebo_ros)
19 |
20 | # Install Python modules
21 | ament_python_install_package(${PROJECT_NAME})
22 |
23 | ament_package()
24 |
--------------------------------------------------------------------------------
/dc_simulation/dc_simulation/__init__.py:
--------------------------------------------------------------------------------
1 | """Directory which contains all examples."""
2 |
--------------------------------------------------------------------------------
/dc_simulation/env-hooks/dc_simulation.dsv.in:
--------------------------------------------------------------------------------
1 | prepend-non-duplicate;GAZEBO_MODEL_PATH;share/dc_simulation/models
2 | prepend-non-duplicate;GAZEBO_MODEL_PATH;share/dc_simulation/worlds
3 |
--------------------------------------------------------------------------------
/dc_simulation/maps/qrcodes.pgm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/maps/qrcodes.pgm
--------------------------------------------------------------------------------
/dc_simulation/maps/qrcodes.yaml:
--------------------------------------------------------------------------------
1 | image: qrcodes.pgm
2 | mode: trinary
3 | resolution: 0.05
4 | origin: [-34.8, -26.1, 0]
5 | negate: 0
6 | occupied_thresh: 0.65
7 | free_thresh: 0.196
8 |
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/meshes/Chair.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
2 | # File Created: 21.03.2018 17:15:35
3 |
4 | newmtl Chair
5 | Ns 10.0000
6 | Ni 1.5000
7 | d 1.0000
8 | Tr 0.0000
9 | Tf 1.0000 1.0000 1.0000
10 | illum 2
11 | Ka 0.5882 0.5882 0.5882
12 | Kd 0.8000 0.8000 0.8000
13 | Ks 0.0000 0.0000 0.0000
14 | Ke 0.0000 0.0000 0.0000
15 | map_Ka Chair_Diffuse.png
16 | map_Kd Chair_Diffuse.png
17 | map_bump Chair_Normal_Normal_Bump.tga
18 |
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/meshes/Chair.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/meshes/Chair.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/meshes/Chair_Diffuse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/meshes/Chair_Diffuse.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/meshes/Chair_Normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/meshes/Chair_Normal.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/meshes/Chair_SpecGloss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/meshes/Chair_SpecGloss.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | Chair
4 | 1.0
5 | model.sdf
6 |
7 |
8 | Cole Biesemeyer
9 | cole@openrobotics.org
10 |
11 |
12 |
13 | A generic hospital chair
14 |
15 |
16 |
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0 0 0 0 0 1.5708
7 |
8 |
9 |
10 |
11 | model://Chair/meshes/Chair.obj
12 | 0.00817 0.00817 0.00817
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | model://Chair/meshes/Chair.obj
21 | 0.00817 0.00817 0.00817
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/thumbnails/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/thumbnails/1.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/thumbnails/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/thumbnails/2.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/thumbnails/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/thumbnails/3.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/thumbnails/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/thumbnails/4.png
--------------------------------------------------------------------------------
/dc_simulation/models/Chair/thumbnails/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/Chair/thumbnails/5.png
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/meshes/keyboard.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: 'None'
2 | # Material Count: 2
3 |
4 | newmtl metalDark
5 | Ns 96.078431
6 | Ka 0.000000 0.000000 0.000000
7 | Kd 0.164706 0.207843 0.207843
8 | Ks 0.330000 0.330000 0.330000
9 | Ke 0.000000 0.000000 0.000000
10 | Ni 1.000000
11 | d 1.000000
12 | illum 2
13 |
14 | newmtl metalMedium
15 | Ns 96.078431
16 | Ka 0.000000 0.000000 0.000000
17 | Kd 0.368627 0.466667 0.466667
18 | Ks 0.330000 0.330000 0.330000
19 | Ke 0.000000 0.000000 0.000000
20 | Ni 1.000000
21 | d 1.000000
22 | illum 2
23 |
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/meshes/monitor.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: 'None'
2 | # Material Count: 2
3 |
4 | newmtl metal
5 | Ns 96.078431
6 | Ka 0.000000 0.000000 0.000000
7 | Kd 0.658823 0.827451 0.827451
8 | Ks 0.330000 0.330000 0.330000
9 | Ke 0.000000 0.000000 0.000000
10 | Ni 1.000000
11 | d 1.000000
12 | illum 2
13 |
14 | newmtl metalDark
15 | Ns 96.078431
16 | Ka 0.000000 0.000000 0.000000
17 | Kd 0.164706 0.207843 0.207843
18 | Ks 0.330000 0.330000 0.330000
19 | Ke 0.000000 0.000000 0.000000
20 | Ni 1.000000
21 | d 1.000000
22 | illum 2
23 |
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | MonitorAndKeyboard
4 | 1.0
5 | model.sdf
6 |
7 |
8 | Kenney.nl
9 |
10 |
11 |
12 |
13 | A generic monitor and keyboard
14 | https://opengameart.org/content/furniture-kit - CC0 license
15 |
16 |
17 |
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/thumbnails/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/MonitorAndKeyboard/thumbnails/1.png
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/thumbnails/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/MonitorAndKeyboard/thumbnails/2.png
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/thumbnails/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/MonitorAndKeyboard/thumbnails/3.png
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/thumbnails/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/MonitorAndKeyboard/thumbnails/4.png
--------------------------------------------------------------------------------
/dc_simulation/models/MonitorAndKeyboard/thumbnails/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/MonitorAndKeyboard/thumbnails/5.png
--------------------------------------------------------------------------------
/dc_simulation/models/__init__.py:
--------------------------------------------------------------------------------
1 | """Directory which contains all models."""
2 |
--------------------------------------------------------------------------------
/dc_simulation/models/bag/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | bag
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/materials/scripts/cutout_wall.material:
--------------------------------------------------------------------------------
1 | material drc_practice/cutout_wall
2 | {
3 | technique
4 | {
5 | pass
6 | {
7 | texture_unit
8 | {
9 | texture cutout_wall.png
10 | filtering anistropic
11 | max_anisotropy 16
12 | scale 1 1
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/materials/textures/cutout_wall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/materials/textures/cutout_wall.png
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | cutout_wall
5 | 1.0
6 | model.sdf
7 |
8 |
9 | Carlos Agüero
10 | caguero@osrfoundation.org
11 |
12 |
13 |
14 | A grey wall with simple shapes.
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/thumbnails/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/thumbnails/1.png
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/thumbnails/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/thumbnails/2.png
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/thumbnails/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/thumbnails/3.png
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/thumbnails/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/thumbnails/4.png
--------------------------------------------------------------------------------
/dc_simulation/models/cutout_wall/thumbnails/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/cutout_wall/thumbnails/5.png
--------------------------------------------------------------------------------
/dc_simulation/models/europallet/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | europallet
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/europallet/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | model://europallet/europallet.dae
10 | 0.001 0.001 0.001
11 |
12 |
13 |
14 |
15 |
16 |
17 | model://europallet/europallet.dae
18 | 0.001 0.001 0.001
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/dc_simulation/models/europallet_10/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | europallet_10
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0001/materials/textures/qrcode_0001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0001/materials/textures/qrcode_0001.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0001/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0001
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0001/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0001/meshes/qrcode_0001.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0002/materials/textures/qrcode_0002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0002/materials/textures/qrcode_0002.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0002/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0002
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0002/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0002/meshes/qrcode_0002.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0003/materials/textures/qrcode_0003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0003/materials/textures/qrcode_0003.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0003/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0003
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0003/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0003/meshes/qrcode_0003.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0004/materials/textures/qrcode_0004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0004/materials/textures/qrcode_0004.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0004/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0004
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0004/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0004/meshes/qrcode_0004.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0005/materials/textures/qrcode_0005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0005/materials/textures/qrcode_0005.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0005/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0005
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0005/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0005/meshes/qrcode_0005.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0006/materials/textures/qrcode_0006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0006/materials/textures/qrcode_0006.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0006/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0006
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0006/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0006/meshes/qrcode_0006.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0007/materials/textures/qrcode_0007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0007/materials/textures/qrcode_0007.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0007/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0007
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0007/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0007/meshes/qrcode_0007.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0008/materials/textures/qrcode_0008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0008/materials/textures/qrcode_0008.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0008/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0008
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0008/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0008/meshes/qrcode_0008.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0009/materials/textures/qrcode_0009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0009/materials/textures/qrcode_0009.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0009/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0009
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0009/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0009/meshes/qrcode_0009.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0010/materials/textures/qrcode_0010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0010/materials/textures/qrcode_0010.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0010/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0010
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0010/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0010/meshes/qrcode_0010.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/materials/textures/output-no-img-no-txt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0011/materials/textures/output-no-img-no-txt.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/materials/textures/output-no-img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0011/materials/textures/output-no-img.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/materials/textures/output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0011/materials/textures/output.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/materials/textures/qrcode_0011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0011/materials/textures/qrcode_0011.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/materials/textures/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/qrcode_0011/materials/textures/test.png
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_0011
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/dc_simulation/models/qrcode_0011/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_0011/meshes/qrcode_0011.dae
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/Asphalt010_1K_Color.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/Asphalt010_1K_Color.jpg
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/Rough_Square_Concrete_Block.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/Rough_Square_Concrete_Block.jpg
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/Tape001_1K_Color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/Tape001_1K_Color.png
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/Terrazzo005_1K_Color.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/Terrazzo005_1K_Color.jpg
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/ground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/ground.png
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/meshes/warehouse_colision.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/meshes/warehouse_colision.stl
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | warehouse
4 | 1.0
5 | model.sdf
6 |
7 | Filipe Almeida
8 | filipe.almeida@mov.ai
9 |
10 | A simple warehouse walls to use in warehouse simulations
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0 0 0 0 0 0
5 | false
6 |
7 |
8 | 0 0 0 0 0 0
9 |
10 | 0 0 0 0 0 0
11 |
12 |
13 | 1 1 1
14 | meshes/warehouse_colision.stl
15 |
16 |
17 |
18 |
19 | 0 0 0 0 0 0
20 |
21 |
22 | 1 1 1
23 | meshes/warehouse.dae
24 |
25 |
26 |
27 |
28 | 0 0 0.101 0 0 0
29 |
30 |
31 | 1 1 1
32 | meshes/warehouse.dae
33 |
34 | drop1
35 | true
36 |
37 |
38 |
39 |
40 |
41 | 1
42 |
43 |
44 |
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/thumbnails/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/thumbnails/1.png
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/thumbnails/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/thumbnails/2.png
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/thumbnails/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/thumbnails/3.png
--------------------------------------------------------------------------------
/dc_simulation/models/warehouse/thumbnails/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/models/warehouse/thumbnails/4.png
--------------------------------------------------------------------------------
/dc_simulation/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_simulation
5 | 0.1.0
6 | Warehouse simulation.
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | aws_robomaker_small_warehouse_world
11 | dc_description
12 | gazebo_ros
13 | rclpy
14 |
15 |
16 | ament_cmake
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/dc_simulation/resource/dc_simulation:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/resource/dc_simulation
--------------------------------------------------------------------------------
/dc_simulation/setup.cfg:
--------------------------------------------------------------------------------
1 | [develop]
2 | script_dir=$base/lib/dc_simulation
3 | [install]
4 | install_scripts=$base/lib/dc_simulation
5 |
--------------------------------------------------------------------------------
/dc_simulation/tools/templates/model_qr/model.config.jinja2:
--------------------------------------------------------------------------------
1 |
2 |
3 | qrcode_{{data}}
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dc_simulation/tools/templates/model_qr/model.sdf.jinja2:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 | model://qrcode_{{data}}/meshes/qrcode_{{data}}.dae
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/dc_simulation/tools/templates/model_qr/ros_logo_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/dc_simulation/tools/templates/model_qr/ros_logo_large.png
--------------------------------------------------------------------------------
/dc_util/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | project(dc_util)
3 |
4 | set(dependencies
5 | dc_common
6 | lifecycle_msgs
7 | nav2_util
8 | nlohmann_json
9 | rclcpp
10 | rclcpp_lifecycle
11 | yaml_cpp_vendor
12 | )
13 | find_package(Boost REQUIRED)
14 |
15 | find_package(ament_cmake REQUIRED)
16 | foreach(Dependency IN ITEMS ${dependencies})
17 | find_package(${Dependency} REQUIRED)
18 | endforeach()
19 |
20 | dc_package()
21 |
22 | set(library_name base64_library)
23 |
24 | add_library(${library_name} SHARED
25 | src/base64.cpp
26 | )
27 |
28 | ament_target_dependencies(${library_name}
29 | ${dependencies}
30 | )
31 |
32 | ament_export_targets(${library_name} HAS_LIBRARY_TARGET)
33 |
34 | install(TARGETS ${library_name}
35 | EXPORT ${library_name}
36 | ARCHIVE DESTINATION lib
37 | LIBRARY DESTINATION lib
38 | RUNTIME DESTINATION bin
39 | INCLUDES DESTINATION include
40 | )
41 |
42 | include_directories(
43 | include
44 | ${YAML_CPP_INCLUDEDIR}
45 | ${OpenCV_INCLUDE_DIRS}
46 | )
47 |
48 | install(DIRECTORY include/
49 | DESTINATION include/
50 | )
51 |
52 | ament_export_include_directories(include)
53 | ament_export_libraries(${library_name})
54 | ament_export_dependencies(${dependencies})
55 |
56 | ament_package()
57 |
--------------------------------------------------------------------------------
/dc_util/include/dc_util/base64.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // base64 encoding and decoding with C++.
3 | // Version: 2.rc.09 (release candidate)
4 | //
5 |
6 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
7 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
8 |
9 | #include
10 |
11 | #if __cplusplus >= 201703L
12 | #include
13 | #endif // __cplusplus >= 201703L
14 |
15 | std::string base64_encode(std::string const& s, bool url = false);
16 | std::string base64_encode_pem(std::string const& s);
17 | std::string base64_encode_mime(std::string const& s);
18 |
19 | std::string base64_decode(std::string const& s, bool remove_linebreaks = false);
20 | std::string base64_encode(unsigned char const*, size_t len, bool url = false);
21 |
22 | #if __cplusplus >= 201703L
23 | //
24 | // Interface with std::string_view rather than const std::string&
25 | // Requires C++17
26 | // Provided by Yannic Bonenberger (https://github.com/Yannic)
27 | //
28 | std::string base64_encode(std::string_view s, bool url = false);
29 | std::string base64_encode_pem(std::string_view s);
30 | std::string base64_encode_mime(std::string_view s);
31 |
32 | std::string base64_decode(std::string_view s, bool remove_linebreaks = false);
33 | #endif // __cplusplus >= 201703L
34 |
35 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */
36 |
--------------------------------------------------------------------------------
/dc_util/include/dc_util/filesystem_utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_UTIL__FILESYSTEM_UTILS_HPP_
2 | #define DC_UTIL__FILESYSTEM_UTILS_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace dc_util
11 | {
12 |
13 | std::string get_file_content(const std::string& path, const bool& strip_end_new_line = true)
14 | {
15 | std::ifstream ifs(path);
16 | std::string content((std::istreambuf_iterator(ifs)), (std::istreambuf_iterator()));
17 |
18 | if (strip_end_new_line)
19 | {
20 | if (!content.empty() && content[content.length() - 1] == '\n')
21 | {
22 | content.erase(content.length() - 1);
23 | }
24 | }
25 |
26 | return content;
27 | }
28 |
29 | void write_str_file(const std::string& path, const std::string& write_str, const bool& strip_end_new_line = true)
30 | {
31 | std::string content = write_str;
32 | if (strip_end_new_line)
33 | {
34 | if (!content.empty() && content[content.length() - 1] == '\n')
35 | {
36 | content.erase(content.length() - 1);
37 | }
38 | }
39 | // Open the file
40 | std::ofstream w_file(path);
41 | // Write to the file
42 | w_file << content;
43 | // Close the file
44 | w_file.close();
45 | }
46 |
47 | } // namespace dc_util
48 |
49 | #endif // DC_UTIL__FILESYSTEM_UTILS_HPP_
50 |
--------------------------------------------------------------------------------
/dc_util/include/dc_util/image_utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DC_UTIL__IMAGE_UTILS_HPP_
2 | #define DC_UTIL__IMAGE_UTILS_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "sensor_msgs/msg/image.hpp"
12 |
13 | namespace dc_util
14 | {
15 | sensor_msgs::msg::Image cvToImage(const cv_bridge::CvImagePtr& cv_ptr)
16 | {
17 | cv_bridge::CvImage img_bridge;
18 | img_bridge.encoding = sensor_msgs::image_encodings::BGR8;
19 | img_bridge.image = cv_ptr->image;
20 | sensor_msgs::msg::Image img_msg;
21 | img_bridge.toImageMsg(img_msg);
22 |
23 | return img_msg;
24 | }
25 | } // namespace dc_util
26 |
27 | #endif // DC_UTIL__IMAGE_UTILS_HPP_
28 |
--------------------------------------------------------------------------------
/dc_util/include/dc_util/service_utils.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "dc_core/measurement.hpp"
10 | #include "dc_interfaces/srv/detect_barcode.hpp"
11 | #include "dc_interfaces/srv/draw_image.hpp"
12 | #include "dc_interfaces/srv/save_image.hpp"
13 | #include "dc_measurements/measurement.hpp"
14 | #include "dc_measurements/measurement_server.hpp"
15 | #include "dc_util/image_utils.hpp"
16 | #include "rclcpp/rclcpp.hpp"
17 | #include "sensor_msgs/msg/image.hpp"
18 |
19 | namespace dc_util
20 | {
21 |
22 | std::future_status req_save_image(const rclcpp::Client::SharedPtr& cli_save_img_,
23 | const sensor_msgs::msg::Image& data, const std::string& path,
24 | const std::chrono::milliseconds& timeout = std::chrono::milliseconds(500))
25 | {
26 | auto save_raw_img_req = std::make_shared();
27 | save_raw_img_req->frame = data;
28 | save_raw_img_req->path = path.c_str();
29 | auto result_future = cli_save_img_->async_send_request(save_raw_img_req);
30 | std::future_status status = result_future.wait_for(timeout);
31 |
32 | return status;
33 | }
34 |
35 | } // namespace dc_util
36 |
--------------------------------------------------------------------------------
/dc_util/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dc_util
5 | 0.1.0
6 | General headers used in DC
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake
11 |
12 | libboost-program-options-dev
13 |
14 | boost
15 | dc_common
16 | launch
17 | launch_testing_ament_cmake
18 | nav2_util
19 | nlohmann-json-dev
20 | rclcpp
21 | rclcpp_lifecycle
22 | yaml_cpp_vendor
23 |
24 | libboost-program-options
25 |
26 |
27 | ament_cmake
28 |
29 |
30 |
--------------------------------------------------------------------------------
/doc/css/logo.css:
--------------------------------------------------------------------------------
1 | #logo-dc {
2 | display: block;
3 | margin: auto;
4 | height: 150px;
5 | }
6 |
7 | .sidebar-scrollbox {
8 | top: 150px !important;
9 | }
10 |
--------------------------------------------------------------------------------
/doc/css/theme.css:
--------------------------------------------------------------------------------
1 | #nav-separator{
2 | border-top: 1px solid var(--sidebar-active);
3 | }
4 |
5 | /* Same Markdown page is used on Github and documentation, we just hide some elements on the doc */
6 | .github-only {
7 | display: none !important;
8 | }
9 |
--------------------------------------------------------------------------------
/doc/js/mermaid-init.js:
--------------------------------------------------------------------------------
1 | function get_theme_mermaid() {
2 | let mermaid_theme = "light";
3 |
4 | let mdbook_theme = localStorage.getItem('mdbook-theme')
5 |
6 | if (mdbook_theme == "ayu" || mdbook_theme == "navy" || mdbook_theme == "coal" || mdbook_theme == undefined) {
7 | // If undefined it is still dark, since default is navy mode, defined in book.toml
8 | mermaid_theme = "dark";
9 | }
10 | return mermaid_theme
11 | }
12 |
13 | mermaid.initialize({ startOnLoad: true, theme: get_theme_mermaid() });
14 |
--------------------------------------------------------------------------------
/doc/js/theme.js:
--------------------------------------------------------------------------------
1 | // To reload mermaid graphs
2 | document.getElementById('light').onclick = function () {
3 | location.reload();
4 | };
5 |
6 | document.getElementById('rust').onclick = function () {
7 | location.reload();
8 | };
9 |
10 | document.getElementById('coal').onclick = function () {
11 | location.reload();
12 | };
13 |
14 | document.getElementById('navy').onclick = function () {
15 | location.reload();
16 | };
17 |
18 | document.getElementById('ayu').onclick = function () {
19 | location.reload();
20 | };
21 |
22 | if (window.location.href.indexOf('http://localhost/') == 0) {
23 | document.getElementById("logo-dc").src = "/images/dc.png"
24 | document.getElementById("a-logo-dc").href = "/"
25 | } else if (window.location.href.indexOf('https://minipada.github.io/ros2_data_collection/') == 0) {
26 | let level = window.location.href.split("https://minipada.github.io/ros2_data_collection/")[1].split("/").length - 1
27 |
28 | document.getElementById("logo-dc").src = "../".repeat(level) + "images/dc.png"
29 | document.getElementById("a-logo-dc").href = "https://minipada.github.io/ros2_data_collection"
30 | }
31 |
--------------------------------------------------------------------------------
/doc/open-in.css:
--------------------------------------------------------------------------------
1 | /* based on https://github.com/badboy/mdbook-open-on-gh/ */
2 | footer {
3 | font-size: 0.8em;
4 | text-align: center;
5 | border-top: 1px solid black;
6 | padding: 5px 0;
7 | }
8 |
9 | :root {
10 | --content-max-width: 1500px !important ;
11 | }
12 |
13 | /* Change font size of database diagrams */
14 | .er.entityLabel {
15 | font-size: 1.6rem !important;
16 | }
17 |
--------------------------------------------------------------------------------
/doc/src/dc/about_contact.md:
--------------------------------------------------------------------------------
1 | # About and Contact
2 |
3 | ## About
4 | Our team currently includes:
5 |
6 | | Name | GitHub ID | Current Role |
7 | | ---------------- | ---------------------------------------- | ------------ |
8 | | David Bensoussan | [Minipada](https://github.com/Minipada/) | |
9 |
10 |
11 | ## Contact
12 |
13 | For any inquiry, please contact David ([d.bensoussan@proton.me](mailto:d.bensoussan@proton.me)). If your inquiry relates to bugs or open-source feature requests, consider posting a ticket on our GitHub project. If your inquiry relates to configuration support or private feature development, reach out and we will be able to support you in your projects.
14 |
--------------------------------------------------------------------------------
/doc/src/dc/concepts/destination_server.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/dc/concepts/destination_server.md
--------------------------------------------------------------------------------
/doc/src/dc/concepts/measurement_server.md:
--------------------------------------------------------------------------------
1 | # Measurements
2 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/bool_equal.md:
--------------------------------------------------------------------------------
1 | # Bool equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | bool | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/double_equal.md:
--------------------------------------------------------------------------------
1 | # Double equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ----- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | float | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/double_inferior.md:
--------------------------------------------------------------------------------
1 | # Double inferior
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if inferior.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ----- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | float | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/double_superior.md:
--------------------------------------------------------------------------------
1 | # Double superior
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if superior.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ----- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | float | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/exist.md:
--------------------------------------------------------------------------------
1 | # Exist
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if exists.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/integer_equal.md:
--------------------------------------------------------------------------------
1 | # Integer equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | int | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/integer_inferior.md:
--------------------------------------------------------------------------------
1 | # Integer inferior
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if inferior.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | int | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/integer_superior.md:
--------------------------------------------------------------------------------
1 | # Integer superior
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if superior.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | int | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/list_bool_equal.md:
--------------------------------------------------------------------------------
1 | # List bool equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | bool | N/A (Mandatory) |
13 | | **order_matters** | If true, will compare taking account of the order | bool | true |
14 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/list_double_equal.md:
--------------------------------------------------------------------------------
1 | # List double equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------------- | ---------------------------------------------------------------------- | ------------- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | list\[float\] | N/A (Mandatory) |
13 | | **order_matters** | If true, will compare taking account of the order | bool | true |
14 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/list_integer_equal.md:
--------------------------------------------------------------------------------
1 | # List integer equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------------- | ---------------------------------------------------------------------- | ----------- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | list\[int\] | N/A (Mandatory) |
13 | | **order_matters** | If true, will compare taking account of the order | bool | true |
14 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/list_string_equal.md:
--------------------------------------------------------------------------------
1 | # List string equal
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if equal.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **value** | Value to which compare the JSON value | bool | N/A (Mandatory) |
13 | | **order_matters** | If true, will compare taking account of the order | bool | true |
14 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/moving.md:
--------------------------------------------------------------------------------
1 | # Moving
2 |
3 | ## Description
4 |
5 | Use a [hysteresis](https://www.wikiwand.com/en/Hysteresis) on robot position to know whether the robot is moving.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | -------------------- | ------------------------------------------------------------ | ----- | ------- |
11 | | **odom_topic** | Topic from where odom is used to know if the robot is moving | str | "/odom" |
12 | | **speed_threshold** | Speed threshold used in the hysteresis | float | 0.2 |
13 | | **count_limit** | Counter to know if the robot is moving | int | 8 |
14 | | **count_hysteresis** | Hysteresis counter | int | 5 |
15 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/same_as_previous.md:
--------------------------------------------------------------------------------
1 | # Same as previous
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if match.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------- | ------------------------------------------------------------------------- | ----------- | --------------- |
11 | | **keys** | JSON keys where values are located, separate nested dictionary with **/** | list\[str\] | N/A (Mandatory) |
12 | | **exclude** | JSON keys to exclude in comparison | list\[str\] | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/conditions/string_match.md:
--------------------------------------------------------------------------------
1 | # String match
2 |
3 | ## Description
4 |
5 | Compare JSON key value to the value passed in parameter and returns true if match.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------- | ---------------------------------------------------------------------- | ---- | --------------- |
11 | | **key** | JSON key where value is located, separate nested dictionary with **/** | str | N/A (Mandatory) |
12 | | **regex** | Regex to which compare the JSON value to | str | N/A (Mandatory) |
13 |
--------------------------------------------------------------------------------
/doc/src/dc/destinations/flb_null.md:
--------------------------------------------------------------------------------
1 | # NULL - Fluent Bit
2 |
3 | ## Description
4 |
5 | The null output plugin just throws away events. See [fluent bit page](https://docs.fluentbit.io/manual/pipeline/outputs/null) for more information.
6 |
7 | ## Node configuration
8 |
9 | ```yaml
10 | ...
11 | flb_null:
12 | plugin: "dc_destinations/FlbNull"
13 | inputs: ["/dc/measurement/data"]
14 | ...
15 | ```
16 |
--------------------------------------------------------------------------------
/doc/src/dc/destinations/flb_slack.md:
--------------------------------------------------------------------------------
1 | # Slack - Fluent Bit
2 |
3 | ## Description
4 |
5 | The Slack output plugin delivers records or messages to your preferred Slack channel. See [fluent bit page](https://docs.fluentbit.io/manual/pipeline/outputs/slack) for more information.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | ----------- | -------------------------------------------------- | ---- | --------------- |
11 | | **webhook** | Absolute address of the Webhook provided by Slack. | str | N/A (Mandatory) |
12 |
13 | ## Node configuration
14 |
15 | ```yaml
16 | ...
17 | flb_slack:
18 | plugin: "dc_destinations/FlbSlack"
19 | inputs: ["/dc/group/data"]
20 | webhook: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
21 | ...
22 | ```
23 |
--------------------------------------------------------------------------------
/doc/src/dc/destinations/rcl.md:
--------------------------------------------------------------------------------
1 | # RCL - RCLCPP
2 |
3 | ## Description
4 |
5 | The RCL output collects the data with ROS and display it with `RCLCPP_INFO` call.
6 |
7 | ## Warning
8 | Note that plugins which are not using Fluent Bit like this one don't have any data integrity and persistence. Do not use in production!
9 |
--------------------------------------------------------------------------------
/doc/src/dc/future_work.md:
--------------------------------------------------------------------------------
1 | # Future work and Roadmap
2 |
3 | DC still being in early development, it requires:
4 | 1. High test coverage
5 | 2. Automation: docker image build, PR and commit builds
6 | 3. More measurement plugins
7 | 4. More destination plugins
8 | 5. Guide for the Backend developer: I would like DC to be simple enough so a web developer can run it, get the data and work on its backend application
9 | 6. Guide for the ROS developer: I would like DC to be simple enough so a ROS developer can collect data without the expertise of knowing how to manage databases
10 | 7. Handle python destination plugins
11 | 8. More use cases showcased in demos
12 |
--------------------------------------------------------------------------------
/doc/src/dc/infrastructure_setup.md:
--------------------------------------------------------------------------------
1 | # Infrastructure setup
2 |
--------------------------------------------------------------------------------
/doc/src/dc/infrastructure_setup/adminer.md:
--------------------------------------------------------------------------------
1 | # Adminer
2 |
3 | ## Description
4 | Adminer (formerly phpMinAdmin) is a full-featured database management tool written in PHP. Conversely to phpMyAdmin, it consist of a single file ready to deploy to the target server. Adminer is available for MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, Elasticsearch, MongoDB and others via plugin
5 |
6 | ## Start with docker compose
7 | Execute:
8 |
9 | ```bash
10 | ./tools/infrastructure/scripts/install_infrastructure.bash \
11 | --tool=adminer \
12 | --install-type=docker
13 | ```
14 |
15 | ## Start natively
16 | ```bash
17 | ./tools/infrastructure/scripts/install_infrastructure.bash \
18 | --tool=adminer \
19 | --install-type=native
20 | ```
21 |
22 | ## Credentials
23 |
24 | | Type | User | Password | Database | Port |
25 | | ------------------- | ---- | -------- | -------- | ---- |
26 | | PostgreSQL (Native) | dc | password | dc | 80 |
27 | | PostgreSQL (Docker) | dc | password | dc | 8080 |
28 |
29 | ## How to use
30 | Natively, by accessing [http://localhost:80/adminer](http://localhost:80/adminer), and in docker, by accessing [http://localhost:8080](http://localhost:8080), you will be able to see this page:
31 |
32 | 
33 |
--------------------------------------------------------------------------------
/doc/src/dc/infrastructure_setup/grafana.md:
--------------------------------------------------------------------------------
1 | # Grafana
2 |
3 | ## Description
4 | [Grafana](https://grafana.com/) is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.
5 |
6 | ## Start with docker compose
7 | Execute:
8 |
9 | ```bash
10 | ./tools/infrastructure/scripts/install_infrastructure.bash \
11 | --tool=grafana \
12 | --install-type=docker
13 | ```
14 |
15 | ## Start natively
16 | ```bash
17 | ./tools/infrastructure/scripts/install_infrastructure.bash \
18 | --tool=grafana \
19 | --install-type=native
20 | ```
21 |
22 | ## Credentials
23 |
24 | | User | Password | Port |
25 | | ----- | -------- | ---- |
26 | | admin | admin | 3000 |
27 |
28 | ## How to use
29 | Natively, by accessing [http://localhost:80/adminer](http://localhost:80/adminer), and in docker, by accessing [http://localhost:8080](http://localhost:8080), you will be able to see this page:
30 |
31 | 
32 |
--------------------------------------------------------------------------------
/doc/src/dc/infrastructure_setup/influxdb.md:
--------------------------------------------------------------------------------
1 | # InfluxDB
2 |
3 | ## Description
4 | PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads. The origins of PostgreSQL date back to 1986 as part of the POSTGRES project at the University of California at Berkeley and has more than 35 years of active development on the core platform.
5 |
6 | ## Start with docker compose
7 | Execute:
8 |
9 | ```bash
10 | ./tools/infrastructure/scripts/install_infrastructure.bash \
11 | --tool=influxdb
12 | --install-type=docker
13 | ```
14 |
15 | ## Start natively
16 |
17 | ```bash
18 | ./tools/infrastructure/scripts/install_infrastructure.bash \
19 | --tool=influxdb
20 | --install-type=native
21 | ```
22 |
23 | ## Credentials
24 |
25 | | User | Password | Database | Port |
26 | | ----- | -------- | -------- | ---- |
27 | | admin | admin | dc | 8086 |
28 |
--------------------------------------------------------------------------------
/doc/src/dc/infrastructure_setup/postgresql.md:
--------------------------------------------------------------------------------
1 | # PostgreSQL
2 | ## Description
3 | PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads. The origins of PostgreSQL date back to 1986 as part of the POSTGRES project at the University of California at Berkeley and has more than 35 years of active development on the core platform.
4 |
5 | ## Start with docker compose
6 | Execute:
7 |
8 | ```bash
9 | ./tools/infrastructure/scripts/install_infrastructure.bash \
10 | --tool=postgresql \
11 | --install-type=docker
12 | ```
13 |
14 | ## Start natively
15 | Execute:
16 |
17 | ```bash
18 | ./tools/infrastructure/scripts/install_infrastructure.bash \
19 | --tool=postgresql \
20 | --install-type=native
21 | ```
22 |
23 | ## Credentials
24 |
25 | | User | Password | Database | Port |
26 | | ---- | -------- | -------- | ---- |
27 | | dc | password | dc | 5432 |
28 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/distance_traveled.md:
--------------------------------------------------------------------------------
1 | # Distance traveled
2 |
3 | ## Description
4 |
5 | Collect total distance traveled in the robot since it is powered.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------------------- | ------------------------------------ | ----- | ----------- |
11 | | **global_frame** | Global frame | str | "map" |
12 | | **robot_base_frame** | Robot base frame | str | "base_link" |
13 | | **transform_timeout** | TF Timeout to use for transformation | float | 0.1 |
14 |
15 | ## Schema
16 |
17 | ```json
18 | {
19 | "$schema": "http://json-schema.org/draft-07/schema#",
20 | "title": "Distance traveled",
21 | "description": "Total distance traveled in meters by the robot",
22 | "properties": {
23 | "distance_traveled": {
24 | "description": "Total distance traveled in meters",
25 | "type": "number"
26 | }
27 | },
28 | "type": "object"
29 | }
30 | ```
31 |
32 | ## Measurement configuration
33 |
34 | ```yaml
35 | ...
36 | distance_traveled:
37 | plugin: "dc_measurements/DistanceTraveled"
38 | topic_output: "/dc/measurement/distance_traveled"
39 | tags: ["flb_stdout"]
40 | global_frame: "map"
41 | robot_base_frame: "base_link"
42 | transform_timeout: 0.1
43 | ```
44 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/dummy.md:
--------------------------------------------------------------------------------
1 | # Dummy
2 |
3 | ## Description
4 | The dummy measurement, generates dummy events. It is useful for testing, debugging, benchmarking and getting started with ROS 2 Data collection.
5 |
6 | ## Parameters
7 |
8 | | Parameter | Description | Type | Default |
9 | | ---------- | ------------------ | ---- | --------------------------------------- |
10 | | **record** | Dummy JSON record. | str | "{\"message\":\"Hello from ROS 2 DC\"}" |
11 |
12 |
13 | ## Schema
14 |
15 | ```json
16 | {
17 | "$schema": "http://json-schema.org/draft-07/schema#",
18 | "title": "Dummy",
19 | "description": "Dummy JSON",
20 | "properties": {
21 | "message": {
22 | "description": "Dummy message",
23 | "type": "string"
24 | }
25 | },
26 | "type": "object"
27 | }
28 | ```
29 |
30 | ## Measurement configuration
31 |
32 | ```yaml
33 | ...
34 | dummy:
35 | plugin: "dc_measurements/Dummy"
36 | topic_output: "/dc/measurement/dummy"
37 | tags: ["flb_stdout"]
38 | ```
39 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/memory.md:
--------------------------------------------------------------------------------
1 | # Memory
2 |
3 | ## Description
4 |
5 | Collect memory used in percentage.
6 |
7 | ## Schema
8 |
9 | ```json
10 | {
11 | "$schema": "http://json-schema.org/draft-07/schema#",
12 | "title": "Memory",
13 | "description": "Memory used",
14 | "properties": {
15 | "used": {
16 | "description": "Memory used in percent",
17 | "type": "number",
18 | "minimum": 0
19 | }
20 | },
21 | "type": "object"
22 | }
23 | ```
24 |
25 | ## Measurement configuration
26 |
27 | ```yaml
28 | ...
29 | memory:
30 | plugin: "dc_measurements/Memory"
31 | topic_output: "/dc/measurement/memory"
32 | tags: ["flb_stdout"]
33 | ```
34 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/os.md:
--------------------------------------------------------------------------------
1 | # OS
2 |
3 | ## Description
4 | Collects the Operating System information: cpus, operating system name and kernel information
5 |
6 | ## Schema
7 |
8 | ```json
9 | {
10 | "$schema": "http://json-schema.org/draft-07/schema#",
11 | "title": "OS",
12 | "description": "OS, kernel and CPUs information",
13 | "properties": {
14 | "os": {
15 | "description": "Host distribution name",
16 | "type": "string"
17 | },
18 | "kernel": {
19 | "description": "Kernel version",
20 | "type": "string"
21 | },
22 | "cpu": {
23 | "description": "Number of CPUs",
24 | "type": "integer",
25 | "minimum": 0
26 | },
27 | "memory": {
28 | "description": "System memory",
29 | "type": "number",
30 | "minimum": 0
31 | }
32 | },
33 | "type": "object"
34 | }
35 | ```
36 |
37 | ## Measurement configuration
38 |
39 | ```yaml
40 | ...
41 | os:
42 | plugin: "dc_measurements/OS"
43 | topic_output: "/dc/measurement/os"
44 | tags: ["flb_stdout"]
45 | ```
46 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/position.md:
--------------------------------------------------------------------------------
1 | # Position
2 |
3 | ## Description
4 |
5 | Collect x, y and yaw of the robot.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------------------- | ------------------------------------ | ----- | ----------- |
11 | | **global_frame** | Global frame | str | "map" |
12 | | **robot_base_frame** | Robot base frame | str | "base_link" |
13 | | **transform_timeout** | TF Timeout to use for transformation | float | 0.1 |
14 |
15 | ## Schema
16 |
17 | ```json
18 | {
19 | "$schema": "http://json-schema.org/draft-07/schema#",
20 | "title": "Position",
21 | "description": "Position and orientation of the robot",
22 | "properties": {
23 | "x": {
24 | "description": "X position of the robot",
25 | "type": "number"
26 | },
27 | "y": {
28 | "description": "Y position of the robot",
29 | "type": "number"
30 | },
31 | "yaw": {
32 | "description": "Yaw angle of the robot",
33 | "type": "number"
34 | }
35 | },
36 | "type": "object"
37 | }
38 | ```
39 |
40 | ## Measurement configuration
41 |
42 | ```yaml
43 | ...
44 | position:
45 | plugin: "dc_measurements/Position"
46 | topic_output: "/dc/measurement/position"
47 | tags: ["flb_stdout"]
48 | ```
49 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/string_stamped.md:
--------------------------------------------------------------------------------
1 | # String stamped
2 |
3 | ## Description
4 |
5 | Collect generic data from a topic publishing a StringStamped message and republish it. It allows to fetch data from rclc, rclpy and your custom ROS 2 nodes that don't have use a plugin.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Description | Type | Default |
10 | | --------------- | ------------------------------------------------------------------------------------------------ | ---- | --------------- |
11 | | **timer_based** | If true, collect data at interval and if false collect every record and ignores polling_interval | bool | true |
12 | | **topic** | Topic to get data from | str | N/A (mandatory) |
13 |
14 |
15 | ## Schema
16 |
17 | Given that the data is customized here, there is no default schema.
18 |
19 | ## Measurement configuration
20 |
21 | ```yaml
22 | ...
23 | my_data:
24 | plugin: "dc_measurements/StringStamped"
25 | topic_output: "/dc/measurement/my_data"
26 | tags: ["flb_stdout"]
27 | topic: "/hello-world"
28 | timer_based: true
29 | ```
30 |
--------------------------------------------------------------------------------
/doc/src/dc/measurements/uptime.md:
--------------------------------------------------------------------------------
1 | # Uptime
2 |
3 | ## Description
4 | Time since when the robot PC has been on.
5 |
6 | ## Schema
7 |
8 | ```json
9 | {
10 | "$schema": "http://json-schema.org/draft-07/schema#",
11 | "title": "Uptime",
12 | "description": "Time the system has been up",
13 | "properties": {
14 | "time": {
15 | "description": "Time the system has been up",
16 | "type": "integer",
17 | "minimum": 0
18 | }
19 | },
20 | "type": "object"
21 | }
22 | ```
23 |
24 | ## Measurement configuration
25 |
26 | ```yaml
27 | ...
28 | uptime:
29 | plugin: "dc_measurements/Uptime"
30 | topic_output: "/dc/measurement/uptime"
31 | tags: ["flb_stdout"]
32 | ```
33 |
--------------------------------------------------------------------------------
/doc/src/dc/requirements.md:
--------------------------------------------------------------------------------
1 | # Requirements
2 |
3 | Requirements are tracked using [Strictdoc](https://github.com/strictdoc-project/strictdoc).
4 |
5 | The goal is to list tasks and do [test based requirements](https://visuresolutions.com/requirements-management-traceability-guide/requirement-based-testing).
6 |
7 |
8 |
--------------------------------------------------------------------------------
/doc/src/fonts/lineicons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/fonts/lineicons.eot
--------------------------------------------------------------------------------
/doc/src/fonts/lineicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/fonts/lineicons.ttf
--------------------------------------------------------------------------------
/doc/src/fonts/lineicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/fonts/lineicons.woff
--------------------------------------------------------------------------------
/doc/src/fonts/lineicons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/fonts/lineicons.woff2
--------------------------------------------------------------------------------
/doc/src/images/adminer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/adminer.png
--------------------------------------------------------------------------------
/doc/src/images/dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/dc.png
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-access-db-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-access-db-1.gif
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-gz-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-gz-1.png
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-result-minio.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-result-minio.gif
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-result-pgsql.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-result-pgsql.gif
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-rviz-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-rviz-1.png
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-rviz-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-rviz-2.png
--------------------------------------------------------------------------------
/doc/src/images/demos-tb3_aws_minio_pgsql-streamlit.webm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/demos-tb3_aws_minio_pgsql-streamlit.webm
--------------------------------------------------------------------------------
/doc/src/images/grafana-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/grafana-1.png
--------------------------------------------------------------------------------
/doc/src/images/hn-monogram.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/hn-monogram.webp
--------------------------------------------------------------------------------
/doc/src/images/minio-access-keys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/minio-access-keys.png
--------------------------------------------------------------------------------
/doc/src/images/minio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/minio.png
--------------------------------------------------------------------------------
/doc/src/images/qrcodes_map_minio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/qrcodes_map_minio.png
--------------------------------------------------------------------------------
/doc/src/images/qrcodes_map_pgsql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/qrcodes_map_pgsql.png
--------------------------------------------------------------------------------
/doc/src/images/qrcodes_pgsql_adminer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/qrcodes_pgsql_adminer.png
--------------------------------------------------------------------------------
/doc/src/images/qrcodes_pgsql_adminer_files_metrics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/qrcodes_pgsql_adminer_files_metrics.png
--------------------------------------------------------------------------------
/doc/src/images/qrcodes_pgsql_adminer_record.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/src/images/qrcodes_pgsql_adminer_record.png
--------------------------------------------------------------------------------
/doc/theme/css/print.css:
--------------------------------------------------------------------------------
1 |
2 | #sidebar,
3 | #menu-bar,
4 | .nav-chapters,
5 | .mobile-nav-chapters {
6 | display: none;
7 | }
8 |
9 | #page-wrapper.page-wrapper {
10 | transform: none;
11 | margin-left: 0px;
12 | overflow-y: initial;
13 | }
14 |
15 | #content {
16 | max-width: none;
17 | margin: 0;
18 | padding: 0;
19 | }
20 |
21 | .page {
22 | overflow-y: initial;
23 | }
24 |
25 | code {
26 | background-color: #666666;
27 | border-radius: 5px;
28 |
29 | /* Force background to be printed in Chrome */
30 | -webkit-print-color-adjust: exact;
31 | }
32 |
33 | pre > .buttons {
34 | z-index: 2;
35 | }
36 |
37 | a, a:visited, a:active, a:hover {
38 | color: #4183c4;
39 | text-decoration: none;
40 | }
41 |
42 | h1, h2, h3, h4, h5, h6 {
43 | page-break-inside: avoid;
44 | page-break-after: avoid;
45 | }
46 |
47 | pre, code {
48 | page-break-inside: avoid;
49 | white-space: pre-wrap;
50 | }
51 |
52 | .fa {
53 | display: none !important;
54 | }
55 |
--------------------------------------------------------------------------------
/doc/theme/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/doc/theme/favicon.png
--------------------------------------------------------------------------------
/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: "3.9"
2 | x-logging:
3 | &x-logging
4 | options:
5 | max-size: 50m
6 | max-file: "1"
7 | driver: json-file
8 | x-restart: &x-restart "unless-stopped"
9 | x-stop-grace-period: &x-stop-grace-period "3s"
10 |
11 | services:
12 | ros2-data-collection:
13 | image: minipada/ros2_data_collection:humble-source-sim
14 | privileged: true
15 | container_name: ros2-data-collection
16 | environment:
17 | - QT_X11_NO_MITSHM=1
18 | - NVIDIA_VISIBLE_DEVICES=all
19 | - NVIDIA_DRIVER_CAPABILITIES=compute,utility,display
20 | - DISPLAY=unix$DISPLAY
21 | - XAUTHORITY=$XAUTHORITY
22 | volumes:
23 | - ${HOME}/.Xauthority:/root/.Xauthority
24 | - /tmp/.X11-unix:/tmp/.X11-unix
25 | - /var/run/docker.sock:/var/run/docker.sock
26 | - ${PWD}:/root/ros2_data_collection/src/ros2_data_collection
27 | network_mode: "host"
28 | logging: *x-logging
29 | restart: *x-restart
30 | stop_grace_period: *x-stop-grace-period
31 | runtime: nvidia
32 | command: tail -F anything
33 | working_dir: /root/ros2_data_collection
34 |
--------------------------------------------------------------------------------
/docker/ci-testing/Dockerfile:
--------------------------------------------------------------------------------
1 | # ghcr.io/minipada/ros2_data_collection:${ROS_DISTRO}-ci-testing
2 | # CI image using the ROS testing repository
3 |
4 | ARG ROS_DISTRO=humble
5 | FROM ghcr.io/minipada/ros2_data_collection:${ROS_DISTRO}-ci
6 |
7 | # Switch to ros-testing
8 | SHELL ["/bin/bash", "-o", "pipefail", "-c"]
9 | RUN echo "deb http://packages.ros.org/ros2-testing/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2-latest.list
10 |
11 | # Upgrade packages to ros-shadow-fixed and clean apt-cache within one RUN command
12 | RUN apt-get -qq update && \
13 | apt-get -qq dist-upgrade && \
14 | # Clear apt-cache to reduce image size
15 | rm -rf /var/lib/apt/lists/*
16 |
--------------------------------------------------------------------------------
/docker/doc/Dockerfile:
--------------------------------------------------------------------------------
1 | # ghcr.io/minipada/ros2_data_collection:${ROS_DISTRO}-doc
2 | # Image to build the documentation
3 | FROM rust:1.68.2-bullseye AS ros2_dc_doc_builder
4 |
5 | WORKDIR /
6 |
7 | COPY requirements.txt .
8 | COPY requirements-dev.txt .
9 |
10 | RUN apt-get -q update && \
11 | # Python3
12 | apt-get -q install --no-install-recommends -y python-is-python3 python3-pip && \
13 | pip3 install --no-cache-dir -r requirements.txt -r requirements-dev.txt && \
14 | cargo install mdbook mdbook-admonish mdbook-linkcheck mdbook-mermaid mdbook-open-on-gh && \
15 | # Clear apt-cache to reduce image size
16 | rm -rf /var/lib/apt/lists/*
17 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | fluent_bit_plugins
5 | 0.1.0
6 | A vendor package for An End to End Observability Pipeline
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | golang-go
11 |
12 | dc_interfaces
13 | fluent_bit_vendor
14 | rcl
15 | rclc
16 |
17 |
18 | ament_cmake
19 |
20 |
21 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_files_metrics/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(out_files_metrics)
3 |
4 | set(GO_COMPILER go)
5 | set(FILES_METRICS_LIBRARY out_files_metrics.so)
6 | set(FILES_METRICS_INCLUDE out_files_metrics.h)
7 |
8 | add_custom_target(plugin_out_files_metrics_install ALL
9 | COMMAND ${GO_COMPILER} get
10 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
11 | )
12 |
13 | add_custom_target(plugin_out_files_metrics ALL
14 | COMMAND ${GO_COMPILER} build -buildmode=c-shared -buildvcs=false -o ${FILES_METRICS_LIBRARY} ${CMAKE_CURRENT_SOURCE_DIR}
15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16 | )
17 |
18 | install(
19 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_METRICS_LIBRARY}
20 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_METRICS_INCLUDE}
21 | DESTINATION lib
22 | )
23 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_files_metrics/go.mod:
--------------------------------------------------------------------------------
1 | module out_files_metrics
2 |
3 | go 1.18
4 |
5 | require (
6 | github.com/fluent/fluent-bit-go v0.0.0-20230515084116-b93d969da46d
7 | github.com/lib/pq v1.10.9
8 | github.com/minio/minio-go/v7 v7.0.56
9 | )
10 |
11 | require (
12 | github.com/dustin/go-humanize v1.0.1 // indirect
13 | github.com/google/uuid v1.3.0 // indirect
14 | github.com/json-iterator/go v1.1.12 // indirect
15 | github.com/klauspost/compress v1.16.5 // indirect
16 | github.com/klauspost/cpuid/v2 v2.2.4 // indirect
17 | github.com/minio/md5-simd v1.1.2 // indirect
18 | github.com/minio/sha256-simd v1.0.1 // indirect
19 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
20 | github.com/modern-go/reflect2 v1.0.2 // indirect
21 | github.com/rs/xid v1.5.0 // indirect
22 | github.com/sirupsen/logrus v1.9.2 // indirect
23 | github.com/ugorji/go/codec v1.1.7 // indirect
24 | golang.org/x/crypto v0.9.0 // indirect
25 | golang.org/x/net v0.10.0 // indirect
26 | golang.org/x/sys v0.8.0 // indirect
27 | golang.org/x/text v0.9.0 // indirect
28 | gopkg.in/ini.v1 v1.67.0 // indirect
29 | )
30 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_files_metrics/misc.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | )
6 |
7 | func contains(elems []int, v int) bool {
8 | for _, s := range elems {
9 | if v == s {
10 | return true
11 | }
12 | }
13 | return false
14 | }
15 |
16 | func containsStr(elems []string, v string) bool {
17 | for _, s := range elems {
18 | if v == s {
19 | return true
20 | }
21 | }
22 | return false
23 | }
24 |
25 | type M map[string]interface{}
26 |
27 | func NestedMapLookup(m map[interface{}]interface{}, ks ...string) (rval interface{}, err error) {
28 | var ok bool
29 |
30 | if len(ks) == 0 { // degenerate input
31 | return nil, fmt.Errorf("NestedMapLookup needs at least one key")
32 | }
33 | if rval, ok = m[ks[0]]; !ok {
34 | return nil, fmt.Errorf("key not found; remaining keys: %v", ks)
35 | } else if len(ks) == 1 { // we've reached the final key
36 | return rval, nil
37 | } else if m, ok = rval.(map[interface{}]interface{}); !ok {
38 | return nil, fmt.Errorf("malformed structure at %#v", rval)
39 | } else { // 1+ more keys
40 | return NestedMapLookup(m, ks[1:]...)
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_minio/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(out_minio)
3 |
4 | set(GO_COMPILER go)
5 | set(MINIO_LIBRARY out_minio.so)
6 | set(MINIO_INCLUDE out_minio.h)
7 |
8 | add_custom_target(plugin_out_minio_install ALL
9 | COMMAND ${GO_COMPILER} get
10 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
11 | )
12 |
13 | add_custom_target(plugin_out_minio ALL
14 | COMMAND ${GO_COMPILER} build -buildmode=c-shared -buildvcs=false -o ${MINIO_LIBRARY} ${CMAKE_CURRENT_SOURCE_DIR}
15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16 | )
17 |
18 | install(
19 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/${MINIO_LIBRARY}
20 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/${MINIO_INCLUDE}
21 | DESTINATION lib
22 | )
23 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_minio/go.mod:
--------------------------------------------------------------------------------
1 | module out_minio
2 |
3 | go 1.18
4 |
5 | require (
6 | github.com/fluent/fluent-bit-go v0.0.0-20230515084116-b93d969da46d
7 | github.com/minio/minio-go/v7 v7.0.56
8 | )
9 |
10 | require (
11 | github.com/dustin/go-humanize v1.0.1 // indirect
12 | github.com/google/uuid v1.3.0 // indirect
13 | github.com/json-iterator/go v1.1.12 // indirect
14 | github.com/klauspost/compress v1.16.5 // indirect
15 | github.com/klauspost/cpuid/v2 v2.2.4 // indirect
16 | github.com/minio/md5-simd v1.1.2 // indirect
17 | github.com/minio/sha256-simd v1.0.1 // indirect
18 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
19 | github.com/modern-go/reflect2 v1.0.2 // indirect
20 | github.com/rs/xid v1.5.0 // indirect
21 | github.com/sirupsen/logrus v1.9.2 // indirect
22 | github.com/ugorji/go/codec v1.1.7 // indirect
23 | golang.org/x/crypto v0.9.0 // indirect
24 | golang.org/x/net v0.10.0 // indirect
25 | golang.org/x/sys v0.8.0 // indirect
26 | golang.org/x/text v0.9.0 // indirect
27 | gopkg.in/ini.v1 v1.67.0 // indirect
28 | )
29 |
--------------------------------------------------------------------------------
/fluent_bit_plugins/src/go/out_minio/misc.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "net/http"
6 | "os"
7 | )
8 |
9 | func NestedMapLookup(m map[interface{}]interface{}, ks ...string) (rval interface{}, err error) {
10 | var ok bool
11 |
12 | if len(ks) == 0 { // degenerate input
13 | return nil, fmt.Errorf("NestedMapLookup needs at least one key")
14 | }
15 | if rval, ok = m[ks[0]]; !ok {
16 | return nil, fmt.Errorf("key not found; remaining keys: %v", ks)
17 | } else if len(ks) == 1 { // we've reached the final key
18 | return rval, nil
19 | } else if m, ok = rval.(map[interface{}]interface{}); !ok {
20 | return nil, fmt.Errorf("malformed structure at %#v", rval)
21 | } else { // 1+ more keys
22 | return NestedMapLookup(m, ks[1:]...)
23 | }
24 | }
25 |
26 | func get_file_content(path string) string {
27 | file, err := os.Open(path)
28 |
29 | defer file.Close()
30 |
31 | if err != nil {
32 | panic(err)
33 | }
34 | // Get the file content
35 | buf := make([]byte, 512)
36 | _, err = file.Read(buf)
37 |
38 | if err != nil {
39 | panic(err)
40 | }
41 |
42 | contentType := http.DetectContentType(buf)
43 |
44 | return contentType
45 | }
46 |
47 | func contains(elems []int, v int) bool {
48 | for _, s := range elems {
49 | if v == s {
50 | return true
51 | }
52 | }
53 | return false
54 | }
55 |
--------------------------------------------------------------------------------
/fluent_bit_vendor/fluentbit_vendor-extras.cmake:
--------------------------------------------------------------------------------
1 | list(INSERT CMAKE_MODULE_PATH 0 "${fluent_bit_vendor_DIR}/Modules")
2 | list(INSERT CMAKE_MODULE_PATH 0 "${fluent_bit_vendor_DIR}/cmake")
3 | list(INSERT CMAKE_MODULE_PATH 0 "${fluent_bit_vendor_DIR}/sanitizers-cmake/cmake")
4 |
--------------------------------------------------------------------------------
/fluent_bit_vendor/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | fluent_bit_vendor
5 | 2.0.0
6 | A vendor package for An End to End Observability Pipeline
7 | David Bensoussan
8 | MPL-2.0
9 |
10 | ament_cmake
11 | dc_interfaces
12 | git
13 | flex
14 | bison
15 | libpq-dev
16 | libssl-dev
17 | rclc
18 |
19 |
20 | ament_cmake
21 |
22 |
23 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy==1.24.2 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
2 | opencv-python==4.7.0.68 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
3 | pillow==9.4.0 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
4 | pydantic==1.10.4 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
5 | pyzbar==0.1.9 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
6 | typing-extensions==4.5.0 ; python_full_version >= "3.8.10" and python_full_version != "3.9.7" and python_full_version < "4.0.0"
7 |
--------------------------------------------------------------------------------
/requirements/general.sdoc:
--------------------------------------------------------------------------------
1 | [DOCUMENT]
2 | TITLE: General
3 |
4 | [SECTION]
5 | TITLE: Usability
6 |
7 | [REQUIREMENT]
8 | UID: GEN-USAB-001
9 | TITLE: Can load configuration from YAML
10 | STATEMENT: All configuration can be passed as a standard ROS 2 YAML configuration file.
11 |
12 | [/SECTION]
13 |
14 | [SECTION]
15 | TITLE: Deployment
16 |
17 | [REQUIREMENT]
18 | UID: GEN-DEP-001
19 | TITLE: Container deployment
20 | STATEMENT: The system should support deployment with docker images.
21 |
22 | [REQUIREMENT]
23 | UID: GEN-DEP-002
24 | TITLE: Native deployment
25 | STATEMENT: The system should support deployment with native apt packages.
26 |
27 | [REQUIREMENT]
28 | UID: GEN-DEP-003
29 | TITLE: Easy configuration and management
30 | STATEMENT: The system should provide an easy-to-use configuration and management interface, allowing users to quickly and easily set up and manage the system.
31 |
32 | [REQUIREMENT]
33 | UID: GEN-DEP-004
34 | TITLE: Fault tolerance and error handling
35 | STATEMENT: The system should be fault-tolerant and provide robust error handling mechanisms to ensure that the system continues to operate even in the event of failures or errors.
36 |
37 | [/SECTION]
38 |
--------------------------------------------------------------------------------
/requirements/tooling.sdoc:
--------------------------------------------------------------------------------
1 | [DOCUMENT]
2 | TITLE: Tooling
3 |
4 | [SECTION]
5 | TITLE: Monitoring
6 |
7 | [REQUIREMENT]
8 | UID: TOOL-MON-001
9 | TITLE: Can monitor system performance and health
10 | STATEMENT: The system should be able to monitor its own performance and health, such as CPU usage, memory usage, network usage, and report any issues or errors to a logging system.
11 |
12 | [/SECTION]
13 |
14 | [SECTION]
15 | TITLE: Reports
16 |
17 | [REQUIREMENT]
18 | UID: TOOL-REP-001
19 | TITLE: Can generate reports and statistics on data usage and performance
20 | STATEMENT: The system should be able to generate reports and statistics on data usage and performance to help users optimize their data collection and analysis processes.
21 |
22 | [/SECTION]
23 |
24 | [SECTION]
25 | TITLE: CLI
26 |
27 | [REQUIREMENT]
28 | UID: TOOL-CLI-001
29 | TITLE: Can list plugins from CLI
30 | STATEMENT: Plugins defined in xml files can be fetched and listed so the user knows which ones are available.
31 |
32 | [/SECTION]
33 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | name = 'ros2_data_collection'
3 | long_description = file: README.md
4 | long_description_content_type = text/markdown
5 |
6 | [flake8]
7 | jobs = auto
8 | verbose = 0
9 | quiet = 0
10 | format = default
11 | count = True
12 | show-source = True
13 | statistics = True
14 | tee = True
15 | exclude = .git, __pycache__
16 | filename = *.py
17 | disable-noqa = False
18 | max-line-length = 100
19 | max-complexity = 10
20 | ignore = BLK100, W503, T101, E203, E266, B008, D106, D100, C901, D104
21 | enable-extensions = alfred, black, builtins, bugbear, comprehensions, darglint, debugger, executable, logging-format, pep3101, variables-names, copyright
22 | doctests = True
23 | inline-quotes = "
24 | multiline-quotes = """
25 | per-file-ignores = */launch/*launch.py:D103
26 |
27 | [darglint]
28 | strictness = short
29 | ignore = D407
30 | docstring_style=google
31 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/config/grafana/configuration/conf.ini:
--------------------------------------------------------------------------------
1 | instance_name = "ROS 2 Data Collection"
2 | app_mode = development
3 |
4 | [dashboards]
5 | default_home_dashboard_path = "/etc/dashboards/home.json"
6 |
7 | [panels]
8 | disable_sanitize_html = true
9 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/config/grafana/img/dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Minipada/ros2_data_collection/50336c9af003ff2f9c631830218e444206dfa5d0/tools/infrastructure/docker/config/grafana/img/dc.png
--------------------------------------------------------------------------------
/tools/infrastructure/docker/config/grafana/provisioning/grafana-dashboards.yml:
--------------------------------------------------------------------------------
1 | apiVersion: 1
2 |
3 | providers:
4 | - name: dashboards
5 | type: file
6 | orgId: 1
7 | updateIntervalSeconds: 10
8 | options:
9 | path: /etc/dashboards
10 | foldersFromFilesStructure: true
11 | allowUiUpdates: true
12 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/config/grafana/provisioning/grafana-datasource.yml:
--------------------------------------------------------------------------------
1 | apiVersion: 1
2 |
3 | datasources:
4 | - name: InfluxDB
5 | type: influxdb
6 | database: dc
7 | user: admin
8 | password: admin
9 | url: http://influxdb:8086
10 | isDefault: true
11 | uid: flb_influxdb
12 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/docker-compose.adminer.yaml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | adminer:
5 | image: adminer
6 | container_name: adminer
7 | restart: unless-stopped
8 | ports:
9 | - 8080:8080
10 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/docker-compose.grafana.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | grafana:
5 | image: grafana/grafana:9.5.2
6 | container_name: grafana
7 | restart: unless-stopped
8 | environment:
9 | - GF_SECURITY_ADMIN_USER=admin
10 | - GF_SECURITY_ADMIN_PASSWORD=admin
11 | - GF_INSTALL_PLUGINS=volkovlabs-image-panel,marcusolsson-dynamictext-panel
12 | ports:
13 | - 3000:3000
14 | volumes:
15 | - ./config/grafana/provisioning/grafana-datasource.yml:/etc/grafana/provisioning/datasources/grafana-datasource.yml
16 | - ./config/grafana/provisioning/grafana-dashboards.yml:/etc/grafana/provisioning/dashboards/grafana-dashboards.yml
17 | - ./config/grafana/dashboards:/etc/dashboards
18 | - ./config/grafana/configuration/conf.ini:/etc/grafana/grafana.ini
19 | - ./config/grafana/img:/usr/share/grafana/public/img/dc
20 | - /etc/localtime:/etc/localtime:ro
21 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/docker-compose.influxdb.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | influxdb:
5 | image: influxdb:1.8-alpine
6 | container_name: influxdb
7 | restart: unless-stopped
8 | environment:
9 | - INFLUXDB_DB=dc
10 | - INFLUXDB_ADMIN_USER=admin
11 | - INFLUXDB_ADMIN_PASSWORD=admin
12 | ports:
13 | - 8086:8086
14 |
--------------------------------------------------------------------------------
/tools/infrastructure/docker/docker-compose.postgresql.yaml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | db:
5 | image: postgres:13
6 | container_name: db
7 | restart: unless-stopped
8 | environment:
9 | POSTGRES_USER: dc
10 | POSTGRES_PASSWORD: password
11 | ports:
12 | - 5432:5432
13 |
--------------------------------------------------------------------------------
/tools/infrastructure/scripts/minio/minio.conf:
--------------------------------------------------------------------------------
1 | # Volume to be used for MinIO server.
2 | MINIO_VOLUMES="/mnt/data"
3 | # Use if you want to run MinIO on a custom port.
4 | MINIO_OPTS="--address :9199 --console-address :9001"
5 | # Root user for the server.
6 | MINIO_ROOT_USER=Root-User
7 | # Root secret for the server.
8 | MINIO_ROOT_PASSWORD=Root-Password
9 |
10 | # set this for MinIO to reload entries with 'mc admin service restart'
11 | MINIO_CONFIG_ENV_FILE=/etc/default/minio
12 |
--------------------------------------------------------------------------------
/tools/infrastructure/scripts/minio/minio.service:
--------------------------------------------------------------------------------
1 | # Source: https://github.com/minio/minio-service/blob/master/linux-systemd/minio.service
2 | [Unit]
3 | Description=MinIO
4 | Documentation=https://docs.min.io
5 | Wants=network-online.target
6 | After=network-online.target
7 | AssertFileIsExecutable=/usr/local/bin/minio
8 | AssertFileNotEmpty=/etc/default/minio
9 |
10 | [Service]
11 | Type=notify
12 |
13 | WorkingDirectory=/usr/local/
14 |
15 | User=minio-user
16 | Group=minio-user
17 | ProtectProc=invisible
18 |
19 | EnvironmentFile=/etc/default/minio
20 | ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
21 | ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
22 |
23 | # Let systemd restart this service always
24 | Restart=always
25 |
26 | # Specifies the maximum file descriptor number that can be opened by this process
27 | LimitNOFILE=1048576
28 |
29 | # Specifies the maximum number of threads this process can create
30 | TasksMax=infinity
31 |
32 | # Disable timeout logic and wait until process is stopped
33 | TimeoutStopSec=infinity
34 | SendSIGKILL=no
35 |
36 | [Install]
37 | WantedBy=multi-user.target
38 |
39 | # Built for ${project.name}-${project.version} (${project.name})
40 |
--------------------------------------------------------------------------------