SMACC2
Loading...
Searching...
No Matches
cl_px4_mr::CpVehicleCommandAck Class Reference

#include <cp_vehicle_command_ack.hpp>

Inheritance diagram for cl_px4_mr::CpVehicleCommandAck:
Inheritance graph
Collaboration diagram for cl_px4_mr::CpVehicleCommandAck:
Collaboration graph

Public Member Functions

 CpVehicleCommandAck ()
 
virtual ~CpVehicleCommandAck ()
 
void onInitialize () override
 
uint32_t getLastAckCommand () const
 
uint8_t getLastAckResult () const
 
- Public Member Functions inherited from smacc2::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Public Attributes

smacc2::SmaccSignal< void()> onAckReceived_
 

Private Member Functions

void onAckMessage (const px4_msgs::msg::VehicleCommandAck::SharedPtr msg)
 

Private Attributes

rclcpp::Subscription< px4_msgs::msg::VehicleCommandAck >::SharedPtr subscriber_
 
uint32_t lastCommand_ = 0
 
uint8_t lastResult_ = 0
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccComponent
template<typename TOrthogonal , typename TClient >
void onComponentInitialization ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger () const
 
ISmaccStateMachinegetStateMachine ()
 
- Protected Attributes inherited from smacc2::ISmaccComponent
ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Detailed Description

Definition at line 24 of file cp_vehicle_command_ack.hpp.

Constructor & Destructor Documentation

◆ CpVehicleCommandAck()

cl_px4_mr::CpVehicleCommandAck::CpVehicleCommandAck ( )

Definition at line 20 of file cp_vehicle_command_ack.cpp.

20{}

◆ ~CpVehicleCommandAck()

cl_px4_mr::CpVehicleCommandAck::~CpVehicleCommandAck ( )
virtual

Definition at line 22 of file cp_vehicle_command_ack.cpp.

22{}

Member Function Documentation

◆ getLastAckCommand()

uint32_t cl_px4_mr::CpVehicleCommandAck::getLastAckCommand ( ) const

Definition at line 41 of file cp_vehicle_command_ack.cpp.

References lastCommand_.

◆ getLastAckResult()

uint8_t cl_px4_mr::CpVehicleCommandAck::getLastAckResult ( ) const

Definition at line 43 of file cp_vehicle_command_ack.cpp.

References lastResult_.

◆ onAckMessage()

void cl_px4_mr::CpVehicleCommandAck::onAckMessage ( const px4_msgs::msg::VehicleCommandAck::SharedPtr msg)
private

Definition at line 33 of file cp_vehicle_command_ack.cpp.

34{
35 lastCommand_ = msg->command;
36 lastResult_ = msg->result;
37 RCLCPP_INFO(getLogger(), "CpVehicleCommandAck: command=%u result=%u", msg->command, msg->result);
39}
smacc2::SmaccSignal< void()> onAckReceived_
rclcpp::Logger getLogger() const

References smacc2::ISmaccComponent::getLogger(), lastCommand_, lastResult_, and onAckReceived_.

Referenced by onInitialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onInitialize()

void cl_px4_mr::CpVehicleCommandAck::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccComponent.

Definition at line 24 of file cp_vehicle_command_ack.cpp.

25{
26 auto node = this->getNode();
27 subscriber_ = node->create_subscription<px4_msgs::msg::VehicleCommandAck>(
28 "/fmu/out/vehicle_command_ack", rclcpp::SensorDataQoS(),
29 std::bind(&CpVehicleCommandAck::onAckMessage, this, std::placeholders::_1));
30 RCLCPP_INFO(getLogger(), "CpVehicleCommandAck: subscribed to /fmu/out/vehicle_command_ack");
31}
rclcpp::Subscription< px4_msgs::msg::VehicleCommandAck >::SharedPtr subscriber_
void onAckMessage(const px4_msgs::msg::VehicleCommandAck::SharedPtr msg)
rclcpp::Node::SharedPtr getNode()

References smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), onAckMessage(), and subscriber_.

Here is the call graph for this function:

Member Data Documentation

◆ lastCommand_

uint32_t cl_px4_mr::CpVehicleCommandAck::lastCommand_ = 0
private

Definition at line 41 of file cp_vehicle_command_ack.hpp.

Referenced by getLastAckCommand(), and onAckMessage().

◆ lastResult_

uint8_t cl_px4_mr::CpVehicleCommandAck::lastResult_ = 0
private

Definition at line 42 of file cp_vehicle_command_ack.hpp.

Referenced by getLastAckResult(), and onAckMessage().

◆ onAckReceived_

smacc2::SmaccSignal<void()> cl_px4_mr::CpVehicleCommandAck::onAckReceived_

Definition at line 35 of file cp_vehicle_command_ack.hpp.

Referenced by onAckMessage().

◆ subscriber_

rclcpp::Subscription<px4_msgs::msg::VehicleCommandAck>::SharedPtr cl_px4_mr::CpVehicleCommandAck::subscriber_
private

Definition at line 40 of file cp_vehicle_command_ack.hpp.

Referenced by onInitialize().


The documentation for this class was generated from the following files: