50 static constexpr std::size_t WindowCapacity = 32;
60 double rotation_start[3][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
61 double axis[3] = {0.0, 0.0, 1.0};
66 otg::Profile1D profile{};
67 std::int64_t duration = 0;
74 : data_(new rt::StaticVector<Piece, WindowCapacity>())
78 bool empty()
const {
return data_->empty(); }
79 std::size_t size()
const {
return data_->size(); }
80 Piece &operator[](std::size_t index) {
return (*data_)[index]; }
81 const Piece &operator[](std::size_t index)
const {
return (*data_)[index]; }
82 rt::ErrorCode push_back(
const Piece &value) {
return data_->push_back(value); }
83 void pop_back() { data_->pop_back(); }
84 void clear() { data_->clear(); }
85 void copy_from(
const Storage &other)
88 for(std::size_t i = 0; i < other.size(); ++i) {
89 (void)data_->push_back(other[i]);
92 void swap(Storage &other)
noexcept { data_.swap(other.data_); }
95 std::unique_ptr<rt::StaticVector<Piece, WindowCapacity>> data_;
99 double window_joints_[
MaxAxes] = {};
100 CartesianSegment active_segment_{};
101 otg::Profile1D halt_profile_{};
103 Storage staging_window_{};
105 std::uint32_t window_last_id_ = 0;
106 std::size_t piece_index_ = 0;
107 std::int64_t piece_tick_ = 0;
108 std::int64_t halt_tick_ = 0;
109 std::int64_t halt_duration_ = 0;
110 double halt_origin_ = 0.0;
111 double halt_piece_offset_ = 0.0;
112 double window_entry_velocity_ = 0.0;
113 double window_entry_acceleration_ = 0.0;
114 double window_acceleration_ = 0.0;
115 double window_deceleration_ = 0.0;
116 double window_jerk_ = 0.0;
117 bool window_active_ =
false;
118 bool window_stopping_ =
false;
119 bool window_pose_ =
false;
122 std::array<otg::Profile1D, 3> takeover_residuals_{};
123 std::int64_t takeover_residual_duration_ = 0;
124 double takeover_tcp_tube_ = 0.0;
125 bool takeover_active_ =
false;
126 bool takeover_stopping_ =
false;
127 bool active_safe_envelope_ =
false;
128 bool active_replay_only_takeover_ =
false;
129 otg::Limits1D active_safe_limits_{};
130 bool pending_takeover_grid_valid_ =
false;
131 std::array<std::array<double, 3>, 33> pending_takeover_grid_{};
134 bool staged_takeover_valid_ =
false;
135 bool staged_takeover_is_connector_ =
false;
136 bool staged_takeover_has_safe_envelope_ =
false;
137 otg::Profile1D staged_base_profile_{};
138 std::int64_t staged_base_duration_ = 0;
139 std::array<otg::Profile1D, 3> staged_residuals_{};
140 std::int64_t staged_residual_duration_ = 0;
141 double staged_tcp_tube_ = 0.0;
142 otg::Limits1D staged_safe_limits_{};
144 void clear_takeover()
146 takeover_active_ =
false;
147 takeover_stopping_ =
false;
148 takeover_residual_duration_ = 0;
149 takeover_tcp_tube_ = 0.0;
150 for(std::size_t i = 0; i < 3; ++i) {
151 takeover_residuals_[i] = otg::Profile1D{};
155 void clear_envelope()
157 active_safe_envelope_ =
false;
158 active_replay_only_takeover_ =
false;
159 active_safe_limits_ = otg::Limits1D{};
162 void clear_staged_takeover()
164 staged_takeover_valid_ =
false;
165 staged_takeover_is_connector_ =
false;
166 staged_takeover_has_safe_envelope_ =
false;
167 staged_base_profile_ = otg::Profile1D{};
168 staged_base_duration_ = 0;
169 staged_residual_duration_ = 0;
170 staged_tcp_tube_ = 0.0;
171 staged_safe_limits_ = otg::Limits1D{};
172 for(std::size_t i = 0; i < 3; ++i) {
173 staged_residuals_[i] = otg::Profile1D{};