Add setup documentation
This commit is contained in:
parent
315c37d3bf
commit
70c4afca89
@ -22,9 +22,18 @@ else()
|
||||
set(CMAKE_CXX_STANDARD 17) # Enable c++11 standard
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
include_directories(
|
||||
.
|
||||
LinearAlgebra
|
||||
)
|
||||
add_library(RoboidControl STATIC ${srcs})
|
||||
|
||||
project(RoboidControl)
|
||||
add_subdirectory(LinearAlgebra)
|
||||
add_subdirectory(Examples)
|
||||
|
||||
# Examples
|
||||
option(BUILD_EXAMPLE_BB2A "Build BB2A Example" OFF)
|
||||
add_subdirectory(examples)
|
||||
|
||||
add_compile_definitions(GTEST)
|
||||
include(FetchContent)
|
||||
@ -38,12 +47,6 @@ else()
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
include_directories(
|
||||
.
|
||||
LinearAlgebra
|
||||
)
|
||||
add_library(RoboidControl STATIC ${srcs})
|
||||
|
||||
enable_testing()
|
||||
|
||||
file(GLOB_RECURSE test_srcs test/*_test.cc)
|
||||
|
@ -48,7 +48,7 @@ PROJECT_NAME = "Roboid Control for C++"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER = 0.4
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -67,7 +67,7 @@ bool Participant::Send(IMessage* msg) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
Windows::ParticipantUDP* thisWindows =
|
||||
static_cast<Windows::ParticipantUDP*>(this);
|
||||
return thisWindows->Send(remoteParticipant, bufferSize);
|
||||
return thisWindows->Send(this, bufferSize);
|
||||
#elif defined(__unix__) || defined(__APPLE__)
|
||||
Posix::ParticipantUDP* thisPosix = static_cast<Posix::ParticipantUDP*>(this);
|
||||
return thisPosix->Send(this, bufferSize);
|
||||
|
@ -232,7 +232,9 @@ void ParticipantUDP::SendThingInfo(Participant* remoteParticipant,
|
||||
|
||||
bool ParticipantUDP::Send(IMessage* msg) {
|
||||
if (this->remoteSite != nullptr)
|
||||
this->remoteSite->Send(msg);
|
||||
return this->remoteSite->Send(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParticipantUDP::PublishThingInfo(Thing* thing) {
|
||||
|
54
README.md
54
README.md
@ -14,4 +14,56 @@ Supporting:
|
||||
# Basic components
|
||||
|
||||
- RoboidControl::Thing
|
||||
- RoboidControl::Participant
|
||||
- RoboidControl::Participant
|
||||
|
||||
# Installation
|
||||
|
||||
## Core code
|
||||
|
||||
The repository uses cmake for building. You can place it in a subfolder of your project and include it in you `CMakeLists.txt`.
|
||||
For example if the library is placed in the subfolder `roboidcontrol`:
|
||||
```
|
||||
add_subdirectory(roboidcontrol)
|
||||
|
||||
add_executable(my_executable main.cpp) # Your source files/executable
|
||||
target_link_libraries(my_executable RoboidControl)
|
||||
```
|
||||
|
||||
## Arduino (PlatformIO)
|
||||
|
||||
Arduino is only supported in combination with PlatformIO. The Arduino IDE is not (yet?) supported.
|
||||
|
||||
The best way to include support for Roboid Control in PlatformIO is
|
||||
to clone the Roboid Control for C++ repository into a subfolder of the /lib folder.
|
||||
Alternatively you can download the zip file and unpack it as a subfolder of the /lib folder.
|
||||
|
||||
## ESP-IDF
|
||||
|
||||
The best way to include support for Roboid Control in PlatformIO is
|
||||
to clone the Roboid Control for C++ repository into a subfolder of the /components folder.
|
||||
Alternatively you can download the zip file and unpack it as a subfolder of the /components folder.
|
||||
|
||||
Make sure you have included RoboidControl as a component in your top-level CMakeLists.txt, for example:
|
||||
```
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
components/RoboidControl
|
||||
)
|
||||
```
|
||||
|
||||
# Get Started
|
||||
|
||||
## Core C++ Examples
|
||||
|
||||
This repository contains examples in the `examples` folder. You can build these using cmake.
|
||||
|
||||
For example, to build the BB2A example:
|
||||
```
|
||||
cmake -B build -D BUILD_EXAMPLE_BB2A=ON
|
||||
cmake --build build
|
||||
```
|
||||
The resulting executable is then `build/examples/Debug/BB2A.exe`
|
||||
|
||||
## Arduino (PlatformIO) Examples
|
||||
|
||||
Specific examples for the Arduino platform are found in the `Arduino\examples` folder.
|
||||
To use them you should create a new project in PlatformIO and then copy the example code to your project.
|
@ -1,25 +1,8 @@
|
||||
# examples/CMakeLists.txt
|
||||
|
||||
# Specify the minimum CMake version
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
# Check if the options are enabled and add the corresponding examples
|
||||
if(BUILD_EXAMPLE_BB2A)
|
||||
add_executable(BB2A BB2A/main.cpp) # Adjust the path as necessary
|
||||
|
||||
# Specify the path to the main project directory
|
||||
set(MAIN_PROJECT_DIR "${CMAKE_SOURCE_DIR}/..")
|
||||
|
||||
# Set the project name
|
||||
project(Examples)
|
||||
|
||||
include_directories(..)
|
||||
|
||||
# Add the executable for the main project
|
||||
#add_executable(MainExecutable ${SOURCES})
|
||||
# Find the main project library (assuming it's defined in the root CMakeLists.txt)
|
||||
#find_package(RoboidControl REQUIRED) # Replace MyLibrary with your actual library name
|
||||
|
||||
# Add example executables
|
||||
add_executable(BB2B BB2B.cpp)
|
||||
target_link_libraries(
|
||||
BB2B
|
||||
RoboidControl
|
||||
LinearAlgebra
|
||||
)
|
||||
target_link_libraries(BB2A RoboidControl)
|
||||
endif()
|
||||
|
@ -1 +1 @@
|
||||
Important: this folder has to be names 'examples' exactly to maintain compatibility with Arduino
|
||||
Important: this folder has to be named 'examples' exactly to maintain compatibility with Arduino
|
Loading…
x
Reference in New Issue
Block a user