Skip to content

Commit

Permalink
Update documentation to include Plugin Programming Guide and Plugin D…
Browse files Browse the repository at this point in the history
…ocumentation Template (#644)

<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
This PR includes improvements to our documentation. Specifically we have
taken the **Plugin Programming Guide** and converted it to a Mark Down
file included in the `src/v2i-hub` directory. Additionally we have
deleted redundant example plugins.
<!--- Describe your changes in detail -->

## Related Issue
[VH-1337
](https://usdot-carma.atlassian.net/browse/VH-1337)<!--- This project
only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
Improve development documentation
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
NA
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
paulbourelly999 authored Oct 1, 2024
1 parent f381370 commit 4611f58
Show file tree
Hide file tree
Showing 12 changed files with 1,347 additions and 279 deletions.
5 changes: 0 additions & 5 deletions examples/tmx-exampleapps/EmptyPlugin/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions examples/tmx-exampleapps/EmptyPlugin/manifest.json

This file was deleted.

217 changes: 0 additions & 217 deletions examples/tmx-exampleapps/EmptyPlugin/src/EmptyPlugin.cpp

This file was deleted.

19 changes: 18 additions & 1 deletion examples/tmx-exampleapps/ExamplePlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
PROJECT ( ExamplePlugin VERSION 3.0.0 LANGUAGES CXX )
PROJECT ( ExamplePlugin VERSION 7.6.0 LANGUAGES CXX )

SET (TMX_PLUGIN_NAME "Example")

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
#############
## Testing ##
#############
enable_testing()
add_library(${PROJECT_NAME}_lib src/SampleData.cpp)
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_lib PUBLIC tmxutils )

set(BINARY ${PROJECT_NAME}_test)
file(GLOB_RECURSE TEST_SOURCES LIST_DIRECTORIES false test/*.h test/*.cpp)
set(SOURCES ${TEST_SOURCES} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test)
add_executable(${BINARY} ${TEST_SOURCES})
add_test(NAME ${BINARY} COMMAND ${BINARY})
TARGET_INCLUDE_DIRECTORIES(${BINARY} PUBLIC src/)

target_link_libraries(${BINARY} PUBLIC
${PROJECT_NAME}_lib
gtest)
29 changes: 29 additions & 0 deletions examples/tmx-exampleapps/ExamplePlugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SampleBSMPlugin

This is an example plugin used for demostrating how to develop new **V2X Hub** plugins. Any developed plugin should include accompanying documentation in the form of a `README.md` with the sections outlined here.

## Documentation Template

### Introduction

A brief introduction to the Plugin and the functionality it introduces. Well developed plugins are modular and function independently.

### Related Plugins

A list of plugins related to the documented plugin. Often to enable Connected Automated Vehicle (CAV) use-cases, requires multiple **V2X-Hub** plugins running conccurently. This section should described other plugins required for end-user functionality and their role.

### Configuration/Deployment

This section should provide documentation about how to configure and deploy the plugin. This should include descriptions of plugin configuration parameters as well as step by step instructions for enabling the plugin.

### Design (Recommended)

This is an optional, but recommended section that can be used to outline the high-level design of your plugin. This should include insights into data-flow, communication sequence and relevant data transforms/translations.

### Messages (Recommended)

This is an optional, but recommended section that is intended to describe the TMX Messages used by the plugin to communicate with other plugins in V2X-Hub

### Testing (Recommended)

This final section is optional, but recommended and is intended to describe methods used to confirm the deployed plugin is functioning correctly. This can include testing scripts used to send mock data through the plugin and/or UI status fields to check to confirm working functionality.
7 changes: 6 additions & 1 deletion examples/tmx-exampleapps/ExamplePlugin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"@TMX_PLUGIN_NAME@",
"description":"An example plugin for the IVP system.",
"description":"An example plugin for the V2X Hub.",
"version":"@PROJECT_VERSION@",
"exeLocation":"/bin/@PROJECT_NAME@",
"coreIpAddr":"127.0.0.1",
Expand All @@ -13,6 +13,11 @@
}
],
"configuration":[
{
"key":"LogLevel",
"default":"INFO",
"description":"The log level for this plugin"
},
{
"key":"Frequency",
"default":"1000",
Expand Down
12 changes: 6 additions & 6 deletions examples/tmx-exampleapps/ExamplePlugin/src/ExamplePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Description : Example Plugin
//==========================================================================

#include "PluginClient.h"
#include "PluginClientClockAware.h"
#include "PluginDataMonitor.h"

#include <atomic>
Expand All @@ -25,7 +25,7 @@ namespace ExamplePlugin
/**
* This plugin is an example to demonstrate the capabilities of a TMX plugin.
*/
class ExamplePlugin: public PluginClient
class ExamplePlugin: public PluginClientClockAware
{
public:
ExamplePlugin(std::string);
Expand All @@ -51,7 +51,7 @@ class ExamplePlugin: public PluginClient
*
* @param name The name to give the plugin for identification purposes.
*/
ExamplePlugin::ExamplePlugin(string name): PluginClient(name)
ExamplePlugin::ExamplePlugin(string name): PluginClientClockAware(name)
{
// The log level can be changed from the default here.
FILELog::ReportingLevel() = FILELog::FromString("DEBUG");
Expand Down Expand Up @@ -115,7 +115,7 @@ void ExamplePlugin::HandleMapDataMessage(MapDataMessage &msg, routeable_message

void ExamplePlugin::HandleDecodedBsmMessage(DecodedBsmMessage &msg, routeable_message &routeableMsg)
{
//PLOG(logDEBUG) << "Received Decoded BSM: " << msg;
PLOG(logDEBUG) << "Received Decoded BSM: " << msg;

// Determine if location, speed, and heading are valid.
bool isValid = msg.get_IsLocationValid() && msg.get_IsSpeedValid() && msg.get_IsHeadingValid();
Expand Down Expand Up @@ -148,9 +148,9 @@ int ExamplePlugin::Main()
uint msCount = 0;
while (_plugin->state != IvpPluginState_error)
{
PLOG(logDEBUG4) << "Sleeping 1 ms" << endl;
PLOG(logDEBUG4) << "Sleeping 10 ms" << endl;

this_thread::sleep_for(chrono::milliseconds(10));
PluginClientClockAware::getClock()->sleep_for(10);

msCount += 10;

Expand Down
2 changes: 1 addition & 1 deletion examples/tmx-exampleapps/SampleBSMPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PROJECT ( SampleBSMPlugin VERSION 5.0 LANGUAGES CXX )

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils jsoncpp)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
Loading

0 comments on commit 4611f58

Please sign in to comment.