Skip to content

Commit

Permalink
Merge branch 'boston-dynamics:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
amessing-bdai authored Sep 25, 2024
2 parents 1789a26 + b4682d9 commit c8649f4
Show file tree
Hide file tree
Showing 250 changed files with 4,839 additions and 3,526 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@ is subject to the terms and conditions of the Boston Dynamics Software
Development Kit License (20191101-BDSDK-SL).
-->

# Spot C++ SDK (BETA)
# Spot C++ SDK (BETA)

Develop applications and payloads for Spot using the Boston Dynamics Spot C++ SDK. The Spot C++ SDK is a **beta** release.

The C++ SDK consists of:
* [C++ client library](docs/cpp/README.md). Applications using the C++ library can control Spot and read sensor and health information from Spot. A variety of example programs and a QuickStart guide are also included.
* [Spot C++ SDK Repository](https://github.com/boston-dynamics/spot-cpp-sdk). The GitHub repo where all of the Spot C++ SDK code is hosted.

- [C++ client library](docs/cpp/README.md). Applications using the C++ library can control Spot and read sensor and health information from Spot. A variety of example programs and a QuickStart guide are also included.
- [Spot C++ SDK Repository](https://github.com/boston-dynamics/spot-cpp-sdk). The GitHub repo where all of the Spot C++ SDK code is hosted.

The official Spot SDK documentation also contains information relevant to the C++ SDK:
* [Conceptual documentation](https://dev.bostondynamics.com/docs/concepts/readme). These documents explain the key abstractions used by the Spot API.
* [Payload developer documentation](https://dev.bostondynamics.com/docs/payload/readme). Payloads add additional sensing, communication, and control capabilities beyond what the base platform provides. The Payload ICD covers the mechanical, electrical, and software interfaces that Spot supports.
* [Spot API protocol definition](https://dev.bostondynamics.com/docs/protos/readme). This reference guide covers the details of the protocol applications used to communicate to Spot. Application developers who wish to use a language other than Python can implement clients that speak the protocol.

This is version 4.0.2 of the C++ SDK. Please review the [Release Notes](docs/cpp_release_notes.md) to see what has changed.
- [Conceptual documentation](https://dev.bostondynamics.com/docs/concepts/readme). These documents explain the key abstractions used by the Spot API.
- [Payload developer documentation](https://dev.bostondynamics.com/docs/payload/readme). Payloads add additional sensing, communication, and control capabilities beyond what the base platform provides. The Payload ICD covers the mechanical, electrical, and software interfaces that Spot supports.
- [Spot API protocol definition](https://dev.bostondynamics.com/docs/protos/readme). This reference guide covers the details of the protocol applications used to communicate to Spot. Application developers who wish to use a language other than Python can implement clients that speak the protocol.

This is version 4.1.0 of the C++ SDK. Please review the [Release Notes](docs/cpp_release_notes.md) to see what has changed.

## Contents

* [C++ Library](docs/cpp/README.md)
* [Release Notes](docs/cpp_release_notes.md)
* [SDK Repository](https://github.com/boston-dynamics/spot-cpp-sdk)
- [C++ Library](docs/cpp/README.md)
- [Release Notes](docs/cpp_release_notes.md)
- [SDK Repository](https://github.com/boston-dynamics/spot-cpp-sdk)
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This file is autogenerated.

cmake_minimum_required (VERSION 3.10.2)
project (bosdyn VERSION 4.0.2)
project (bosdyn VERSION 4.0.3)

# Dependencies:
find_package(protobuf REQUIRED)
Expand Down
24 changes: 13 additions & 11 deletions cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ The C++ SDK includes C++ libraries and examples.
## Coding standards and dependencies.

The C++ implementation follows these requirements:
* A modern C++14 compiler toolchain.
* Does not make use of exceptions or RTTI.
* Generally complies with the Google C++ style guide.
* Doxygen-friendly comments, particularly in header files.

- A modern C++14 compiler toolchain.
- Does not make use of exceptions or RTTI.
- Generally complies with the Google C++ style guide.
- Doxygen-friendly comments, particularly in header files.

Library Dependencies:
* C++14 standard library. Many advanced features, such as functional programming and concurrency support are used.
* Google's gRPC C++ library, as well as it's transitive dependencies.
* Unit tests depend on gTest.
* Eigen for math operations

- C++14 standard library. Many advanced features, such as functional programming and concurrency support are used.
- Google's gRPC C++ library, as well as it's transitive dependencies.
- Unit tests depend on gTest.
- Eigen for math operations

## Contents

* [Client](bosdyn/client/README.md)
* [Common](bosdyn/common/README.md)
* [Math](bosdyn/math/README.md)
- [Client](bosdyn/client/README.md)
- [Common](bosdyn/common/README.md)
- [Math](bosdyn/math/README.md)
44 changes: 24 additions & 20 deletions cpp/bosdyn/client/auth/auth_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const char* AuthClient::s_default_service_authority = "auth.spot.robot";

const char* AuthClient::s_service_type = "bosdyn.api.AuthService";

std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(
const std::string& username, const std::string& password,
const RPCParameters& parameters) {
std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(const std::string& username,
const std::string& password,
const RPCParameters& parameters) {
std::promise<AuthResultType> response;
std::shared_future<AuthResultType> future = response.get_future();
BOSDYN_ASSERT_PRECONDITION(m_stub != nullptr, "Stub for service is unset!");
Expand All @@ -36,16 +36,18 @@ std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(
request.set_password(password);

MessagePumpCallBase* one_time =
InitiateAsyncCall<::bosdyn::api::GetAuthTokenRequest, ::bosdyn::api::GetAuthTokenResponse, ::bosdyn::api::GetAuthTokenResponse>(
InitiateAsyncCall<::bosdyn::api::GetAuthTokenRequest, ::bosdyn::api::GetAuthTokenResponse,
::bosdyn::api::GetAuthTokenResponse>(
request,
std::bind(&::bosdyn::api::AuthService::Stub::AsyncGetAuthToken, m_stub.get(), _1, _2, _3),
std::bind(&::bosdyn::api::AuthService::StubInterface::AsyncGetAuthToken, m_stub.get(),
_1, _2, _3),
std::bind(&AuthClient::OnGetAuthTokenComplete, this, _1, _2, _3, _4, _5),
std::move(response), parameters);
return future;
}

std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(
const std::string& token, const RPCParameters& parameters) {
std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(const std::string& token,
const RPCParameters& parameters) {
std::promise<AuthResultType> response;
std::shared_future<AuthResultType> future = response.get_future();
BOSDYN_ASSERT_PRECONDITION(m_stub != nullptr, "Stub for service is unset!");
Expand All @@ -54,33 +56,35 @@ std::shared_future<AuthResultType> AuthClient::GetAuthTokenAsync(
request.set_token(token);

MessagePumpCallBase* one_time =
InitiateAsyncCall<::bosdyn::api::GetAuthTokenRequest, ::bosdyn::api::GetAuthTokenResponse, ::bosdyn::api::GetAuthTokenResponse>(
InitiateAsyncCall<::bosdyn::api::GetAuthTokenRequest, ::bosdyn::api::GetAuthTokenResponse,
::bosdyn::api::GetAuthTokenResponse>(
request,
std::bind(&::bosdyn::api::AuthService::Stub::AsyncGetAuthToken, m_stub.get(), _1, _2, _3),
std::bind(&::bosdyn::api::AuthService::StubInterface::AsyncGetAuthToken, m_stub.get(),
_1, _2, _3),
std::bind(&AuthClient::OnGetAuthTokenComplete, this, _1, _2, _3, _4, _5),
std::move(response), parameters);

return future;
}

AuthResultType AuthClient::GetAuthToken(
const std::string& username, const std::string& password,
const RPCParameters& parameters) {
AuthResultType AuthClient::GetAuthToken(const std::string& username, const std::string& password,
const RPCParameters& parameters) {
return GetAuthTokenAsync(username, password, parameters).get();
}

AuthResultType AuthClient::GetAuthToken(
const std::string& token, const RPCParameters& parameters) {
AuthResultType AuthClient::GetAuthToken(const std::string& token, const RPCParameters& parameters) {
return GetAuthTokenAsync(token, parameters).get();
}

// Set the outstanding response, which will update any futures. Reset it.
void AuthClient::OnGetAuthTokenComplete(
MessagePumpCallBase* call, const ::bosdyn::api::GetAuthTokenRequest& request,
::bosdyn::api::GetAuthTokenResponse&& response, const grpc::Status& status,
std::promise<AuthResultType> promise) {
::bosdyn::common::Status ret_status = ProcessResponseAndGetFinalStatus<::bosdyn::api::GetAuthTokenResponse>(
status, response, response.status());
void AuthClient::OnGetAuthTokenComplete(MessagePumpCallBase* call,
const ::bosdyn::api::GetAuthTokenRequest& request,
::bosdyn::api::GetAuthTokenResponse&& response,
const grpc::Status& status,
std::promise<AuthResultType> promise) {
::bosdyn::common::Status ret_status =
ProcessResponseAndGetFinalStatus<::bosdyn::api::GetAuthTokenResponse>(status, response,
response.status());
if (!ret_status) {
promise.set_value({ret_status, std::move(response)});
return;
Expand Down
21 changes: 10 additions & 11 deletions cpp/bosdyn/client/auth/auth_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace client {

// This typedef needs to be a std::shared_ptr to satisfy the InitiateCall templatized method in
// ServiceClient
typedef Result<::bosdyn::api::GetAuthTokenResponse> AuthResultType;
typedef Result<::bosdyn::api::GetAuthTokenResponse> AuthResultType;

class AuthClient : public ServiceClient {
public:
Expand All @@ -36,17 +36,16 @@ class AuthClient : public ServiceClient {
const RPCParameters& parameters = RPCParameters());

// Synchronous method to get an auth token for username/password combination.
AuthResultType GetAuthToken(
const std::string& username, const std::string& password,
const RPCParameters& parameters = RPCParameters());
AuthResultType GetAuthToken(const std::string& username, const std::string& password,
const RPCParameters& parameters = RPCParameters());

// Asynchronous method to get an auth token for provided token.
std::shared_future<AuthResultType> GetAuthTokenAsync(
const std::string& token, const RPCParameters& parameters = RPCParameters());

// Synchronous method to get an auth token for provided token.
AuthResultType GetAuthToken(
const std::string& token, const RPCParameters& parameters = RPCParameters());
AuthResultType GetAuthToken(const std::string& token,
const RPCParameters& parameters = RPCParameters());

// Start of ServiceClient overrides.
QualityOfService GetQualityOfService() const override;
Expand All @@ -65,12 +64,12 @@ class AuthClient : public ServiceClient {
static std::string GetServiceType() { return s_service_type; }

private:
void OnGetAuthTokenComplete(
MessagePumpCallBase* call, const ::bosdyn::api::GetAuthTokenRequest& request,
::bosdyn::api::GetAuthTokenResponse&& response, const grpc::Status& status,
std::promise<AuthResultType> promise);
void OnGetAuthTokenComplete(MessagePumpCallBase* call,
const ::bosdyn::api::GetAuthTokenRequest& request,
::bosdyn::api::GetAuthTokenResponse&& response,
const grpc::Status& status, std::promise<AuthResultType> promise);

std::unique_ptr<::bosdyn::api::AuthService::Stub> m_stub;
std::unique_ptr<::bosdyn::api::AuthService::StubInterface> m_stub;

// Default service name for the Auth service.
static const char* s_default_service_name;
Expand Down
Loading

0 comments on commit c8649f4

Please sign in to comment.