20template <
typename LimitType>
34 DynamicsLimit(
const std::string&
desc,
const LimitType& max_val,
const LimitType& default_val,
35 const std::shared_ptr<std::mutex>& write_mutex,
const std::function<
bool()>& can_write_condition)
38 write_mutex_(write_mutex),
40 can_write_condition_(can_write_condition) {}
34 DynamicsLimit(
const std::string&
desc,
const LimitType& max_val,
const LimitType& default_val, {
…}
50 template <
typename AlternativeType>
51 void setFrom(
const AlternativeType& value);
63 void set(
const LimitType& value) {
64 std::unique_lock lock(*write_mutex_);
65 if (!can_write_condition_()) {
67 ss <<
"Cannot set " <<
desc <<
" limit while robot is in control.";
68 throw std::runtime_error(ss.str());
63 void set(
const LimitType& value) {
…}
81 [[nodiscard]] LimitType
get()
const {
return value_; }
97 template <
typename LimitTypeStream>
109 void check(
const LimitType& value)
const;
111 std::shared_ptr<std::mutex> write_mutex_;
113 std::function<bool()> can_write_condition_;
116template <
typename LimitTypeStream>
118 os << dynamics_limit.value_ <<
" (max: " << dynamics_limit.
max <<
")";
A template class representing a dynamics limit with a maximum value.
Definition dynamics_limit.hpp:21
void set(const LimitType &value)
Set a new value for the limit.
Definition dynamics_limit.hpp:63
friend std::ostream & operator<<(std::ostream &os, const DynamicsLimit< LimitTypeStream > &dynamics_limit)
Definition dynamics_limit.hpp:117
LimitType get() const
Get the current value of the limit.
Definition dynamics_limit.hpp:81
const std::string desc
Description of this limit.
Definition dynamics_limit.hpp:95
DynamicsLimit(const std::string &desc, const LimitType &max_val, const LimitType &default_val, const std::shared_ptr< std::mutex > &write_mutex, const std::function< bool()> &can_write_condition)
Constructor for DynamicsLimit.
Definition dynamics_limit.hpp:34
const LimitType max
The maximum value this limit can take as defined by Franka.
Definition dynamics_limit.hpp:88
void setFrom(const AlternativeType &value)
Set a new value for the limit with a different type.
Definition dynamics_limit.cpp:8
std::ostream & operator<<(std::ostream &os, const DynamicsLimit< Vector7d > &limit)
Definition dynamics_limit.cpp:47