Apollo 10.0
自动驾驶开放平台
apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > > 模板类 参考abstract

#include <convert_ros_quadruple.h>

类 apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > > 继承关系图:
apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > > 的协作图:

Public 成员函数

 RosApolloMessageConverter ()
 
 ~RosApolloMessageConverter () override
 
bool Init () override
 
- Public 成员函数 继承自 apollo::cyber::MessageConverter
 MessageConverter ()
 
virtual ~MessageConverter ()
 
bool IsInit () const
 

Protected 成员函数

virtual bool ConvertMsg (InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > > &input, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > &output)=0
 
- Protected 成员函数 继承自 apollo::cyber::MessageConverter
bool LoadConfig (ConverterConf *config)
 

额外继承的成员函数

- Protected 属性 继承自 apollo::cyber::MessageConverter
std::atomic< bool > init_
 
std::unique_ptr< apollo::cyber::Nodecyber_node_
 
std::vector< std::shared_ptr< apollo::cyber::proto::RoleAttributes > > apollo_attrs_
 
std::vector< std::shared_ptr< apollo::cyber::ReaderBase > > apollo_readers_
 
std::vector< std::shared_ptr< apollo::cyber::WriterBase > > apollo_writers_
 
const std::string node_name_ = "converter_base"
 
ConverterConf converter_conf_
 

详细描述

template<typename InType0, typename InType1, typename InType2, typename InType3, typename OutType0, typename OutType1, typename OutType2, typename OutType3>
class apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >

在文件 convert_ros_quadruple.h404 行定义.

构造及析构函数说明

◆ RosApolloMessageConverter()

template<typename InType0 , typename InType1 , typename InType2 , typename InType3 , typename OutType0 , typename OutType1 , typename OutType2 , typename OutType3 >
apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >::RosApolloMessageConverter ( )
inline

在文件 convert_ros_quadruple.h424 行定义.

424{}

◆ ~RosApolloMessageConverter()

template<typename InType0 , typename InType1 , typename InType2 , typename InType3 , typename OutType0 , typename OutType1 , typename OutType2 , typename OutType3 >
apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >::~RosApolloMessageConverter ( )
inlineoverride

在文件 convert_ros_quadruple.h425 行定义.

425{}

成员函数说明

◆ ConvertMsg()

template<typename InType0 , typename InType1 , typename InType2 , typename InType3 , typename OutType0 , typename OutType1 , typename OutType2 , typename OutType3 >
virtual bool apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >::ConvertMsg ( InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > > &  input,
OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > &  output 
)
protectedpure virtual

◆ Init()

template<typename InType0 , typename InType1 , typename InType2 , typename InType3 , typename OutType0 , typename OutType1 , typename OutType2 , typename OutType3 >
bool apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 >, std::shared_ptr< InType3 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >::Init ( )
inlineoverridevirtual

重载 apollo::cyber::MessageConverter .

在文件 convert_ros_quadruple.h427 行定义.

427 {
429 if (!init_.load()) {
430 return false;
431 }
433 return false;
434 }
435
436 apollo_attrs_.push_back(
437 std::make_shared<apollo::cyber::proto::RoleAttributes>());
439
440 apollo_attrs_.push_back(
441 std::make_shared<apollo::cyber::proto::RoleAttributes>());
443
444 apollo_attrs_.push_back(
445 std::make_shared<apollo::cyber::proto::RoleAttributes>());
447
448 apollo_attrs_.push_back(
449 std::make_shared<apollo::cyber::proto::RoleAttributes>());
451
452 auto ros_topic_name_0 = converter_conf_.ros_topic_name_0();
453 auto ros_topic_name_1 = converter_conf_.ros_topic_name_1();
454 auto ros_topic_name_2 = converter_conf_.ros_topic_name_2();
455 auto ros_topic_name_3 = converter_conf_.ros_topic_name_3();
456
457 apollo_writer_0_ =
458 cyber_node_->template CreateWriter<OutType0>(*apollo_attrs_[0]);
459 apollo_writer_1_ =
460 cyber_node_->template CreateWriter<OutType1>(*apollo_attrs_[1]);
461 apollo_writer_2_ =
462 cyber_node_->template CreateWriter<OutType2>(*apollo_attrs_[2]);
463 apollo_writer_3_ =
464 cyber_node_->template CreateWriter<OutType3>(*apollo_attrs_[3]);
465#ifdef RCLCPP__RCLCPP_HPP_
466 ros_msg_subs_.push_back(
467 std::move(std::make_shared<message_filters::Subscriber<InType0>>(
468 ros_node_, ros_topic_name_0)));
469 ros_msg_subs_.push_back(
470 std::move(std::make_shared<message_filters::Subscriber<InType1>>(
471 ros_node_, ros_topic_name_1)));
472 ros_msg_subs_.push_back(
473 std::move(std::make_shared<message_filters::Subscriber<InType2>>(
474 ros_node_, ros_topic_name_2)));
475 ros_msg_subs_.push_back(
476 std::move(std::make_shared<message_filters::Subscriber<InType3>>(
477 ros_node_, ros_topic_name_3)));
478 syncApproximate_ = std::make_shared<
479 message_filters::Synchronizer<approximate_sync_policy>>(
480 approximate_sync_policy(10),
481 *dynamic_cast<message_filters::Subscriber<InType0>*>(
482 ros_msg_subs_[0].get()),
483 *dynamic_cast<message_filters::Subscriber<InType1>*>(
484 ros_msg_subs_[1].get()),
485 *dynamic_cast<message_filters::Subscriber<InType2>*>(
486 ros_msg_subs_[2].get()),
487 *dynamic_cast<message_filters::Subscriber<InType3>*>(
488 ros_msg_subs_[3].get()));
489 syncApproximate_->registerCallback(
491 InputTypes<std::shared_ptr<InType0>, std::shared_ptr<InType1>,
492 std::shared_ptr<InType2>, std::shared_ptr<InType3>>,
493 OutputTypes<std::shared_ptr<OutType0>, std::shared_ptr<OutType1>,
494 std::shared_ptr<OutType2>,
495 std::shared_ptr<OutType3>>>::TopicCallback,
496 this);
497
498 ros_spin_thread_ =
499 std::make_shared<std::thread>(&MessageConverter::NodeSpin, this);
500#endif
501 return true;
502 }
std::unique_ptr< apollo::cyber::Node > cyber_node_
std::vector< std::shared_ptr< apollo::cyber::proto::RoleAttributes > > apollo_attrs_
bool LoadConfig(ConverterConf *config)

该类的文档由以下文件生成: