Skip to content

Commit

Permalink
Release/v1.0.1 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhipengZhang-flexiv authored Dec 16, 2024
1 parent 1324579 commit 830ffea
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 34 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16.3)
# ===================================================================
# PROJECT SETUP
# ===================================================================
project(flexiv_ddk VERSION 1.0.0)
project(flexiv_ddk VERSION 1.0.1)

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Flexiv DDK APIs"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.0
PROJECT_NUMBER = 1.0.1

# 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
Expand Down
5 changes: 2 additions & 3 deletions example/basics3_display_plan_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ int main(int argc, char *argv[]) {
spdlog::info(">>> Tutorial description <<<\nThis tutorial check connection "
"with the robot and print plan info.");

// Setup signal handler for graceful exit
std::signal(SIGINT, SignalHandler);
try {
// DDK Initialization
// =========================================================================================
// Instantiate DDK client interface
flexiv::ddk::Client client(robot_sn);

// Setup signal handler for graceful exit
std::signal(SIGINT, SignalHandler);

// Print States
// =========================================================================================
// Use std::thread to do scheduling so that this example can run on all OS
Expand Down
18 changes: 7 additions & 11 deletions example/basics4_display_primitive_states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ void printPrimitiveStates(flexiv::ddk::Client &client) {
std::this_thread::sleep_for(std::chrono::seconds(5));
continue;
}
// Print all robot states in JSON format using the built-in ostream operator
// overloading
// Print all robot states
spdlog::info("Current primitive states:");
std::cout << "primitiveName= "
<< flexiv::ddk::utility::ParsePtStates(client.primitive_states(),
"primitiveName")
<< std::endl;
std::cout << "reachedTarget= "
<< flexiv::ddk::utility::ParsePtStates(client.primitive_states(),
"reachedTarget")
<< std::endl;
for (const auto &pt : client.primitive_states()) {
std::cout << pt.first << " = ";
std::visit([](auto &&arg) { std::cout << arg; }, pt.second);
std::cout << std::endl;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
Expand All @@ -76,7 +72,7 @@ int main(int argc, char *argv[]) {

// Print description
spdlog::info(">>> Tutorial description <<<\nThis tutorial check connection "
"with the robot and print plan infos.");
"with the robot and print primitive states.");

try {
// DDK Initialization
Expand Down
2 changes: 1 addition & 1 deletion example/basics5_display_server_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {

// Print description
spdlog::info(">>> Tutorial description <<<\nThis tutorial check connection "
"with the robot and print plan infos.");
"with the robot and print server time.");

// Setup signal handler for graceful exit
std::signal(SIGINT, SignalHandler);
Expand Down
2 changes: 1 addition & 1 deletion example/basics6_display_system_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {

// Print description
spdlog::info(">>> Tutorial description <<<\nThis tutorial check connection "
"with the robot and print plan infos.");
"with the robot and print system status.");

// Setup signal handler for graceful exit
std::signal(SIGINT, SignalHandler);
Expand Down
2 changes: 1 addition & 1 deletion example/basics9_display_manipulability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {

// Print description
spdlog::info(">>> Tutorial description <<<\nThis tutorial check connection "
"with the robot and print received robot cartesian commands.");
"with the robot and print current manipulability.");

// Setup signal handler for graceful exit
std::signal(SIGINT, SignalHandler);
Expand Down
30 changes: 27 additions & 3 deletions include/flexiv/ddk/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "data.hpp"
#include <exception>
#include <map>
#include <memory>
#include <vector>

Expand All @@ -26,6 +27,11 @@ class Client {
* services will initialize and connection with the robot will be established.
* @param[in] robot_sn Serial number of the robot to connect. The accepted
* formats are: "Rizon 4s-123456" and "Rizon4s-123456".
* @param[in] network_interface_whitelist Limit the network interface(s) that
* can be used to try to establish connection with the specified robot. The
* whitelisted network interface is defined by its associated IPv4 address.
* For example, {"10.42.0.1", "192.168.2.102"}. If left empty, all available
* network interfaces will be tried when searching for the specified robot.
* @throw std::invalid_argument if the format of [robot_sn] is invalid.
* @throw std::runtime_error if the initialization sequence failed.
* @throw std::logic_error if the connected robot does not have a valid DDK
Expand All @@ -34,7 +40,8 @@ class Client {
* @warning This constructor blocks until the initialization sequence is
* successfully finished and connection with the robot is established.
*/
Client(const std::string &robot_sn);
Client(const std::string &robot_sn,
const std::vector<std::string> &network_interface_whitelist = {});
virtual ~Client();

/**
Expand Down Expand Up @@ -86,7 +93,23 @@ class Client {
* or the result is invalid.
* @note This function blocks until a reply is received.
*/
const std::vector<std::string> primitive_states() const;
[[deprecated(
"[Will be removed in flexiv_ddk v1.1] Use the other primitive_states() "
"instead")]] const std::vector<std::string>
primitive_states(bool dummy)
const; ///< Unused parameter [dummy] is needed for function overloading

/**
* @brief [Blocking] State parameters of the executing primitive and their
* current values.
* @return A map of {pt_state_name, pt_state_value(s)}. Booleans are
* represented by int 1 and 0. For example,
* {{"primitiveName","MoveL"},{"reachedTarget", 0}, {"timePeriod", 5.6}}.
* @throw std::runtime_error if failed to get a reply from the connected
* robot.
* @note This function blocks until a reply is received.
*/
std::map<std::string, FlexivPrimitiveStatesType> primitive_states() const;

/**
* @brief [Non-blocking] Access the current time from server. It contains
Expand All @@ -108,7 +131,8 @@ class Client {
bool enabling_button_pressed() const;

/**
* @brief [Non-blocking] Read all digital input ports on the control box.
* @brief [Non-blocking] Read all digital input ports on the control box,
* including 16 on the control box plus 2 inside the wrist connector.
* @return Digital input readings array whose index corresponds to the digital
* input port index. True: port high, false: port low.
*/
Expand Down
11 changes: 8 additions & 3 deletions include/flexiv/ddk/data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <array>
#include <ostream>
#include <string>
#include <variant>
#include <vector>

namespace flexiv {
namespace ddk {

Expand All @@ -21,8 +21,9 @@ constexpr size_t kCartDoF = 6;
/** Size of pose array (3 position + 4 quaternion) */
constexpr size_t kPoseSize = 7;

/** Number of digital IO ports */
constexpr size_t kIOPorts = 16;
/** Number of digital IO ports (16 on control box + 2 inside the wrist
* connector) */
constexpr size_t kIOPorts = 18;

/**
* @struct JointStates
Expand Down Expand Up @@ -291,6 +292,10 @@ struct ServerTime {
int nano_sec = {};
};

/** Alias of the variant that holds all possible types of flexiv primitive
* states */
using FlexivPrimitiveStatesType = std::variant<int, double, std::string>;

/**
* @brief Operator overloading to out stream all robot states in JSON format:
* {"state_1": [val1,val2,val3,...], "state_2": [val1,val2,val3,...], ...}.
Expand Down
Binary file modified lib/flexiv_ddk.win_amd64.lib
Binary file not shown.
Binary file modified lib/libflexiv_ddk.x86_64-linux-gnu.a
Binary file not shown.
2 changes: 1 addition & 1 deletion thirdparty/scripts/install_Fast-CDR.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DCOMPILE_EXAMPLES=OFF

# Build and install
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/scripts/install_Fast-DDS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DTHIRDPARTY_Asio=ON \
-DCOMPILE_EXAMPLES=OFF \
-DSQLITE3_SUPPORT=OFF \
Expand Down
7 changes: 3 additions & 4 deletions thirdparty/scripts/install_eigen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ else
fi

# Use specific version
git fetch -p
git checkout 3.3.7
git submodule update --init --recursive
git fetch --prune --tags
git checkout 3.4.0

# Configure CMake
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR
-DCMAKE_PREFIX_PATH=$INSTALL_DIR

# Build and install
cmake --build . --target install --config Release -j $NUM_JOBS
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/scripts/install_foonathan_memory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR

# Build and install
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/scripts/install_spdlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR

# Build and install
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/scripts/install_tinyxml2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCAMEK_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR

# Build and install
Expand Down

0 comments on commit 830ffea

Please sign in to comment.