22template <
typename LimitType>
40 const std::string &
desc,
const LimitType &max_val,
const std::shared_ptr<std::mutex> &write_mutex,
41 const std::function<
bool()> &can_write_condition)
60 std::string
desc,
const LimitType &max_val,
const std::shared_ptr<std::mutex> &write_mutex,
61 const std::function<
bool()> &can_write_condition,
const LimitType &default_val)
64 write_mutex_(write_mutex),
66 can_write_condition_(can_write_condition) {}
77 template <
typename AlternativeType>
78 void setFrom(
const AlternativeType &value);
92 void set(
const LimitType &value) {
93 std::unique_lock lock(*write_mutex_);
94 if (!can_write_condition_()) {
96 ss <<
"Cannot set " <<
desc <<
" limit while robot is in control.";
97 throw std::runtime_error(ss.str());
110 [[nodiscard]] LimitType
get()
const {
return value_; }
128 template <
typename LimitTypeStream>
140 void check(
const LimitType &value)
const;
142 std::shared_ptr<std::mutex> write_mutex_;
144 std::function<bool()> can_write_condition_;
147template <
typename LimitTypeStream>
149 os << dynamics_limit.value_ <<
" (max: " << dynamics_limit.
max <<
")";
A template class representing a dynamics limit with a maximum value.
Definition dynamics_limit.hpp:23
void set(const LimitType &value)
Set a new value for the limit.
Definition dynamics_limit.hpp:92
friend std::ostream & operator<<(std::ostream &os, const DynamicsLimit< LimitTypeStream > &dynamics_limit)
Definition dynamics_limit.hpp:148
DynamicsLimit(const std::string &desc, const LimitType &max_val, const std::shared_ptr< std::mutex > &write_mutex, const std::function< bool()> &can_write_condition)
Constructor for DynamicsLimit.
Definition dynamics_limit.hpp:39
LimitType get() const
Get the current value of the limit.
Definition dynamics_limit.hpp:110
const std::string desc
Description of this limit.
Definition dynamics_limit.hpp:126
const LimitType max
The maximum value this limit can take as defined by Franka.
Definition dynamics_limit.hpp:118
void setFrom(const AlternativeType &value)
Set a new value for the limit with a different type.
DynamicsLimit(std::string desc, const LimitType &max_val, const std::shared_ptr< std::mutex > &write_mutex, const std::function< bool()> &can_write_condition, const LimitType &default_val)
Constructor for DynamicsLimit.
Definition dynamics_limit.hpp:59
Definition dynamics_limit.cpp:8
std::ostream & operator<<(std::ostream &os, const DynamicsLimit< Vector7d > &limit)
Definition dynamics_limit.cpp:47