-
Notifications
You must be signed in to change notification settings - Fork 31
/
robot_command_streaming_client.cpp
48 lines (35 loc) · 1.59 KB
/
robot_command_streaming_client.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.
*
* Downloading, reproducing, distributing or otherwise using the SDK Software
* is subject to the terms and conditions of the Boston Dynamics Software
* Development Kit License (20191101-BDSDK-SL).
*/
#include "robot_command_streaming_client.h"
namespace bosdyn {
namespace client {
const char* RobotCommandStreamingClient::s_default_service_name = "robot-command-streaming";
const char* RobotCommandStreamingClient::s_service_type = "bosdyn.api.RobotCommandStreamingService";
JointControlStreamResultType RobotCommandStreamingClient::JointControlStream(
const ::bosdyn::api::JointControlStreamRequest& request) {
if (!m_request_writer) {
m_request_writer = m_stub->JointControlStream(&m_context, &m_response);
if (!m_request_writer) {
return {::bosdyn::common::Status(JointControlStreamErrorCode::RequestWriterFailed),
std::move(m_response)};
}
}
if (!m_request_writer->Write(request)) {
return {::bosdyn::common::Status(JointControlStreamErrorCode::StreamingFailed),
std::move(m_response)};
}
return {::bosdyn::common::Status(JointControlStreamErrorCode::Success)};
}
ServiceClient::QualityOfService RobotCommandStreamingClient::GetQualityOfService() const {
return QualityOfService::NORMAL;
}
void RobotCommandStreamingClient::SetComms(const std::shared_ptr<grpc::ChannelInterface>& channel) {
m_stub.reset(new ::bosdyn::api::RobotCommandStreamingService::Stub(channel));
}
} // namespace client
} // namespace bosdyn