1 #define _GLIBCXX_USE_CXX11_ABI 0 6 #include <fastdds/dds/subscriber/DataReader.hpp> 7 #include <fastdds/dds/subscriber/DataReaderListener.hpp> 8 #include <fastdds/dds/core/status/SubscriptionMatchedStatus.hpp> 9 #include <fastdds/dds/subscriber/SampleInfo.hpp> 17 namespace efd = eprosima::fastdds::dds;
18 using erc = eprosima::fastrtps::types::ReturnCode_t;
23 efd::DataReader* reader,
24 const efd::SubscriptionMatchedStatus& info)
override;
35 if (info.current_count_change == 1) {
38 }
else if (info.current_count_change == -1) {
44 std::cerr << info.current_count_change
45 <<
" is not a valid value for PublicationMatchedStatus current count change" << std::endl;
52 eprosima::fastrtps::types::ReturnCode_t rcode = reader->take_next_sample(&
_message, &info);
53 if (rcode == erc::ReturnCodeValue::RETCODE_OK) {
64 if (rcode == erc::ReturnCodeValue::RETCODE_ERROR) {
65 std::cerr <<
"RETCODE_ERROR" << std::endl;
67 if (rcode == erc::ReturnCodeValue::RETCODE_UNSUPPORTED) {
68 std::cerr <<
"RETCODE_UNSUPPORTED" << std::endl;
70 if (rcode == erc::ReturnCodeValue::RETCODE_BAD_PARAMETER) {
71 std::cerr <<
"RETCODE_BAD_PARAMETER" << std::endl;
73 if (rcode == erc::ReturnCodeValue::RETCODE_PRECONDITION_NOT_MET) {
74 std::cerr <<
"RETCODE_PRECONDITION_NOT_MET" << std::endl;
76 if (rcode == erc::ReturnCodeValue::RETCODE_OUT_OF_RESOURCES) {
77 std::cerr <<
"RETCODE_OUT_OF_RESOURCES" << std::endl;
79 if (rcode == erc::ReturnCodeValue::RETCODE_NOT_ENABLED) {
80 std::cerr <<
"RETCODE_NOT_ENABLED" << std::endl;
82 if (rcode == erc::ReturnCodeValue::RETCODE_IMMUTABLE_POLICY) {
83 std::cerr <<
"RETCODE_IMMUTABLE_POLICY" << std::endl;
85 if (rcode == erc::ReturnCodeValue::RETCODE_INCONSISTENT_POLICY) {
86 std::cerr <<
"RETCODE_INCONSISTENT_POLICY" << std::endl;
88 if (rcode == erc::ReturnCodeValue::RETCODE_ALREADY_DELETED) {
89 std::cerr <<
"RETCODE_ALREADY_DELETED" << std::endl;
91 if (rcode == erc::ReturnCodeValue::RETCODE_TIMEOUT) {
92 std::cerr <<
"RETCODE_TIMEOUT" << std::endl;
94 if (rcode == erc::ReturnCodeValue::RETCODE_NO_DATA) {
95 std::cerr <<
"RETCODE_NO_DATA" << std::endl;
97 if (rcode == erc::ReturnCodeValue::RETCODE_ILLEGAL_OPERATION) {
98 std::cerr <<
"RETCODE_ILLEGAL_OPERATION" << std::endl;
100 if (rcode == erc::ReturnCodeValue::RETCODE_NOT_ALLOWED_BY_SECURITY) {
101 std::cerr <<
"RETCODE_NOT_ALLOWED_BY_SECURITY" << std::endl;
106 _impl->_owner = owner;
111 _impl->_owner = owner;
eProsima_user_DllExport void throttle(float _throttle)
This function sets a value in member throttle.
~CarlaSubscriberListener()
eProsima_user_DllExport void hand_brake(bool _hand_brake)
This function sets a value in member hand_brake.
eprosima::fastrtps::types::ReturnCode_t erc
This file contains definitions of common data structures used in traffic manager. ...
std::unique_ptr< CarlaSubscriberListenerImpl > _impl
This class represents the structure CarlaEgoVehicleControl defined by the user in the IDL file...
eProsima_user_DllExport void steer(float _steer)
This function sets a value in member steer.
void on_data_available(efd::DataReader *reader) override
CarlaEgoVehicleControlSubscriber * _owner
carla_msgs::msg::CarlaEgoVehicleControl _message
eProsima_user_DllExport void manual_gear_shift(bool _manual_gear_shift)
This function sets a value in member manual_gear_shift.
void on_subscription_matched(efd::DataReader *reader, const efd::SubscriptionMatchedStatus &info) override
void ForwardMessage(VehicleControl control)
void SetOwner(CarlaEgoVehicleControlSubscriber *owner)
CarlaSubscriberListener(CarlaEgoVehicleControlSubscriber *owner)
eProsima_user_DllExport void reverse(bool _reverse)
This function sets a value in member reverse.
eProsima_user_DllExport void gear(int32_t _gear)
This function sets a value in member gear.
eProsima_user_DllExport void brake(float _brake)
This function sets a value in member brake.