|
| | CbFigureEight (float centerX, float centerY, float altitude, float size=5.0f, float speed=0.5f, int numLoops=1) |
| |
| void | onEntry () override |
| |
| void | onExit () override |
| |
| void | update () override |
| |
| template<typename TOrthogonal , typename TSourceObject > |
| void | onStateOrthogonalAllocation () |
| |
| virtual | ~SmaccAsyncClientBehavior () |
| |
| template<typename TCallback , typename T > |
| smacc2::SmaccSignalConnection | onSuccess (TCallback callback, T *object) |
| |
| template<typename TCallback , typename T > |
| smacc2::SmaccSignalConnection | onFinished (TCallback callback, T *object) |
| |
| template<typename TCallback , typename T > |
| smacc2::SmaccSignalConnection | onFailure (TCallback callback, T *object) |
| |
| void | requestForceFinish () |
| |
| void | executeOnEntry () override |
| |
| void | executeOnExit () override |
| |
| void | waitOnEntryThread (bool requestFinish) |
| |
| template<typename TCallbackMethod , typename T > |
| smacc2::SmaccSignalConnection | onSuccess (TCallbackMethod callback, T *object) |
| |
| template<typename TCallbackMethod , typename T > |
| smacc2::SmaccSignalConnection | onFinished (TCallbackMethod callback, T *object) |
| |
| template<typename TCallbackMethod , typename T > |
| smacc2::SmaccSignalConnection | onFailure (TCallbackMethod callback, T *object) |
| |
| | ISmaccClientBehavior () |
| |
| virtual | ~ISmaccClientBehavior () |
| |
| ISmaccStateMachine * | getStateMachine () |
| |
| std::string | getName () const |
| |
| template<typename SmaccClientType > |
| void | requiresClient (SmaccClientType *&storage) |
| |
| template<typename SmaccComponentType > |
| void | requiresComponent (SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
| |
| | ISmaccUpdatable () |
| |
| | ISmaccUpdatable (rclcpp::Duration duration) |
| |
| void | executeUpdate (rclcpp::Node::SharedPtr node) |
| |
| void | setUpdatePeriod (rclcpp::Duration duration) |
| |
Definition at line 26 of file cb_figure_eight.hpp.
| void cl_px4_mr::CbFigureEight::update |
( |
| ) |
|
|
overridevirtual |
Implements smacc2::ISmaccUpdatable.
Definition at line 53 of file cb_figure_eight.cpp.
54{
55 auto now = std::chrono::steady_clock::now();
56 double dt = std::chrono::duration<double>(now -
lastUpdateTime_).count();
58
60
61
62 float sinT = std::sin(
t_);
63 float cosT = std::cos(
t_);
64 float denom = 1.0f + sinT * sinT;
65
66 float localX =
size_ * cosT / denom;
67 float localY =
size_ * sinT * cosT / denom;
68
72
73
74 float sinT2 = sinT * sinT;
75 float cosT2 = cosT * cosT;
76 float denom2 = denom * denom;
77 float dxdt =
size_ * (-sinT * (1.0f + sinT2) - cosT * 2.0f * sinT * cosT) / denom2;
78 float dydt =
79 size_ * ((cosT2 - sinT2) * (1.0f + sinT2) - sinT * cosT * 2.0f * sinT * cosT) / denom2;
80 float yaw = std::atan2(dydt, dxdt);
81
83
84
85 float requiredT =
numLoops_ * 2.0f * M_PI;
87 {
88 RCLCPP_INFO(
getLogger(),
"CbFigureEight: %d loops completed - posting success",
numLoops_);
90 }
91}
References altitude_, centerX_, centerY_, smacc2::ISmaccClientBehavior::getLogger(), lastUpdateTime_, numLoops_, smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), cl_px4_mr::CpTrajectorySetpoint::setPositionNED(), size_, speed_, t_, and trajectorySetpoint_.