src
ur
tool_communication.cpp
Go to the documentation of this file.
1
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2
3
// -- BEGIN LICENSE BLOCK ----------------------------------------------
4
// Copyright 2019 FZI Forschungszentrum Informatik
5
// Created on behalf of Universal Robots A/S
6
//
7
// Licensed under the Apache License, Version 2.0 (the "License");
8
// you may not use this file except in compliance with the License.
9
// You may obtain a copy of the License at
10
//
11
// http://www.apache.org/licenses/LICENSE-2.0
12
//
13
// Unless required by applicable law or agreed to in writing, software
14
// distributed under the License is distributed on an "AS IS" BASIS,
15
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
// See the License for the specific language governing permissions and
17
// limitations under the License.
18
// -- END LICENSE BLOCK ------------------------------------------------
19
20
//----------------------------------------------------------------------
27
//----------------------------------------------------------------------
28
29
#include "
ur_client_library/ur/tool_communication.h
"
30
31
namespace
urcl
32
{
33
ToolCommSetup::ToolCommSetup
()
34
: tool_voltage_(
ToolVoltage
::
OFF
)
35
, parity_(
Parity
::
ODD
)
36
, baud_rate_(9600)
37
, stop_bits_(1, 2)
38
, rx_idle_chars_(1.0, 40.0)
39
, tx_idle_chars_(0.0, 40.0)
40
{
41
}
42
43
void
ToolCommSetup::setBaudRate
(
const
uint32_t baud_rate)
44
{
45
if
(
baud_rates_allowed_
.find(baud_rate) !=
baud_rates_allowed_
.end())
46
{
47
baud_rate_
= baud_rate;
48
}
49
else
50
{
51
throw
std::runtime_error(
"Provided baud rate is not allowed"
);
52
}
53
}
54
}
// namespace urcl
urcl::ToolCommSetup::ToolCommSetup
ToolCommSetup()
Definition:
tool_communication.cpp:33
urcl::ToolCommSetup::baud_rates_allowed_
const std::set< uint32_t > baud_rates_allowed_
Definition:
tool_communication.h:232
urcl::ToolCommSetup::baud_rate_
uint32_t baud_rate_
Definition:
tool_communication.h:243
urcl::Parity
Parity
Possible values for th parity flag.
Definition:
tool_communication.h:51
urcl::ToolVoltage
ToolVoltage
Possible values for the tool voltage.
Definition:
tool_communication.h:41
urcl
Definition:
bin_parser.h:36
urcl::Parity::ODD
@ ODD
tool_communication.h
urcl::ToolCommSetup::setBaudRate
void setBaudRate(const uint32_t baud_rate)
Setup the tool communication baud rate that will be configured on the robot. This will not immediatel...
Definition:
tool_communication.cpp:43
urcl::ToolVoltage::OFF
@ OFF
0V
ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58