Skip to content

Commit

Permalink
Implemented feedback
Browse files Browse the repository at this point in the history
- Fixed sentence.
- Prefixed option.
- Improved README
  • Loading branch information
LucaRitz committed Aug 29, 2020
1 parent bc25d32 commit 56b5d89
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 50 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ set(PROJECT_VERSION 2.0)

set(TELLO_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include)

option(OPTION_BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(OPTION_MAKE_DLL "Make DLL" ON)
option(TELLO_BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(TELLO_MAKE_DLL "Make DLL" ON)

if (OPTION_BUILD_SHARED_LIBS)
if (TELLO_BUILD_SHARED_LIBS)
message(STATUS "Tello -- Build shared libs")
add_library(tello SHARED)
else()
message(STATUS "Tello -- Build static libs")
add_library(tello STATIC)
endif ()

if (OPTION_MAKE_DLL)
if (TELLO_MAKE_DLL)
message(STATUS "Tello -- Export")
target_compile_definitions(tello PUBLIC -DMAKE_DLL)
endif()
Expand Down
119 changes: 73 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,87 @@
The intent of this library is its simplicity to use.
The following code section shows a basic setup for one Tello-drone.
```cpp
// Initialize logging
LoggerSettings settings {"./log/command_log.log", "./log/video_log.log", "./log/status_log.log"};
Logger::initialize(settings);

// Setup connection
const bool isConnected = TelloNetwork::connect();
assert(isConnected);

// Create a tello drone object for interaction
Tello tello(TELLO_IP_ADDRESS);

// Enter command mode.
future<Response> command_future = tello.command();
// You don't have to wait for a response.
// A response is timed-out after 15 seconds.
command_future.wait();

// More commands
// ...

// At least, the connections have to be closed.
TelloNetwork::disconnect();
#include <tello/logger/logger.hpp>
#include <tello/connection/tello_network.hpp>
#include <tello/tello.hpp>

using tello::LoggerSettings;
using tello::Logger;
using tello::TelloNetwork;
using tello::Tello;
using tello::Response;

#define TELLO_IP_ADDRESS (ip_address)0xC0A80A01 // 192.168.10.1

void main() {
// Initialize logging
LoggerSettings settings {"./log/command_log.log", "./log/video_log.log", "./log/status_log.log"};
Logger::initialize(settings);

// Setup connection
const bool isConnected = TelloNetwork::connect();
assert(isConnected);

// Create a tello drone object for interaction
Tello tello(TELLO_IP_ADDRESS);

// Enter command mode.
future<Response> command_future = tello.command();
// You don't have to wait for a response.
// A response is timed-out after 15 seconds.
command_future.wait();

// There are some commands, which don't wait to a response
// The status of the response will be 'UNKNOWN'
future<Response> rc_future = tello.rc_control(10, -10, 0, 0);

// More commands
// ...

// At least, the connections have to be closed.
TelloNetwork::disconnect();
}
```

Another possibility is the setup of a swarm.
```cpp
// setup ...
// Create tello drones object for interaction
Tello tello_1(TELLO_IP_ADDRESS_1);
Tello tello_2(TELLO_IP_ADDRESS_2);
// ...
Tello tello_n(TELLO_IP_ADDRESS_n);
// Create a swarm object and add tellos
Swarm swarm;
swarm << tello_1 << tello_2 << ... << tello_n;
// Enter command mode
unordered_map<ip_address, future<Response>> response_futures = swarm.command();
for(auto& entry : response_futures) {
entry.second.wait();
// includes ...
#include <tello/swarm.hpp>
// usings ...

using tello::Swarm;

void main() {
// setup ...

// Create tello drones object for interaction
Tello tello_1(TELLO_IP_ADDRESS_1);
Tello tello_2(TELLO_IP_ADDRESS_2);
// ...
Tello tello_n(TELLO_IP_ADDRESS_n);
// Create a swarm object and add tellos
Swarm swarm;
swarm << tello_1 << tello_2 << ... << tello_n;
// Enter command mode
unordered_map<ip_address, future<Response>> response_futures = swarm.command();
for(auto& entry : response_futures) {
entry.second.wait();
}
// May repeate command for a single tello if one failed.
// More commands and tear down
// ...
}
// May repeate command for a single tello if one failed.
// More commands and tear down
// ...
```

## Build
Defaultly a static library is built. One can set the option
'OPTION_BUILD_SHARED_LIBS' to ON to build a shared library.<br>
Note: The tests cannot be built with this option on.<br>
Per default, a static library is built. One can set the option<br>
'TELLO_BUILD_SHARED_LIBS' to ON to build a shared library.<br>
Note: The target 'tello_test' cannot be built with this option on,<br>
because there are some usages, which are not exported (e.g. command_test.cpp).<br>
Use the target 'shared_linking_test' instead.

## Third-party libs
Expand Down

0 comments on commit 56b5d89

Please sign in to comment.