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

#include <convert_ros_triple.h>

类 apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 > >, 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 > >, 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 > > &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 OutType0, typename OutType1, typename OutType2, typename OutType3>
class apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >

在文件 convert_ros_triple.h373 行定义.

构造及析构函数说明

◆ RosApolloMessageConverter()

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

在文件 convert_ros_triple.h392 行定义.

392{}

◆ ~RosApolloMessageConverter()

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

在文件 convert_ros_triple.h393 行定义.

393{}

成员函数说明

◆ ConvertMsg()

template<typename InType0 , typename InType1 , typename InType2 , 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 > >, 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 > > &  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 OutType0 , typename OutType1 , typename OutType2 , typename OutType3 >
bool apollo::cyber::RosApolloMessageConverter< InputTypes< std::shared_ptr< InType0 >, std::shared_ptr< InType1 >, std::shared_ptr< InType2 > >, OutputTypes< std::shared_ptr< OutType0 >, std::shared_ptr< OutType1 >, std::shared_ptr< OutType2 >, std::shared_ptr< OutType3 > > >::Init ( )
inlineoverridevirtual

重载 apollo::cyber::MessageConverter .

在文件 convert_ros_triple.h395 行定义.

395 {
397 if (!init_.load()) {
398 return false;
399 }
401 return false;
402 }
403
404 apollo_attrs_.push_back(
405 std::make_shared<apollo::cyber::proto::RoleAttributes>());
407
408 apollo_attrs_.push_back(
409 std::make_shared<apollo::cyber::proto::RoleAttributes>());
411
412 apollo_attrs_.push_back(
413 std::make_shared<apollo::cyber::proto::RoleAttributes>());
415
416 apollo_attrs_.push_back(
417 std::make_shared<apollo::cyber::proto::RoleAttributes>());
419
420 auto ros_topic_name_0 = converter_conf_.ros_topic_name_0();
421 auto ros_topic_name_1 = converter_conf_.ros_topic_name_1();
422 auto ros_topic_name_2 = converter_conf_.ros_topic_name_2();
423
424 apollo_writer_0_ =
425 cyber_node_->template CreateWriter<OutType0>(*apollo_attrs_[0]);
426 apollo_writer_1_ =
427 cyber_node_->template CreateWriter<OutType1>(*apollo_attrs_[1]);
428 apollo_writer_2_ =
429 cyber_node_->template CreateWriter<OutType2>(*apollo_attrs_[2]);
430 apollo_writer_3_ =
431 cyber_node_->template CreateWriter<OutType3>(*apollo_attrs_[3]);
432#ifdef RCLCPP__RCLCPP_HPP_
433 ros_msg_subs_.push_back(
434 std::move(std::make_shared<message_filters::Subscriber<InType0>>(
435 ros_node_, ros_topic_name_0)));
436 ros_msg_subs_.push_back(
437 std::move(std::make_shared<message_filters::Subscriber<InType1>>(
438 ros_node_, ros_topic_name_1)));
439 ros_msg_subs_.push_back(
440 std::move(std::make_shared<message_filters::Subscriber<InType2>>(
441 ros_node_, ros_topic_name_2)));
442 syncApproximate_ = std::make_shared<
443 message_filters::Synchronizer<approximate_sync_policy>>(
444 approximate_sync_policy(10),
445 *dynamic_cast<message_filters::Subscriber<InType0>*>(
446 ros_msg_subs_[0].get()),
447 *dynamic_cast<message_filters::Subscriber<InType1>*>(
448 ros_msg_subs_[1].get()),
449 *dynamic_cast<message_filters::Subscriber<InType2>*>(
450 ros_msg_subs_[2].get()));
451 syncApproximate_->registerCallback(
453 InputTypes<std::shared_ptr<InType0>, std::shared_ptr<InType1>,
454 std::shared_ptr<InType2>>,
455 OutputTypes<std::shared_ptr<OutType0>, std::shared_ptr<OutType1>,
456 std::shared_ptr<OutType2>,
457 std::shared_ptr<OutType3>>>::TopicCallback,
458 this);
459
460 ros_spin_thread_ =
461 std::make_shared<std::thread>(&MessageConverter::NodeSpin, this);
462#endif
463 return true;
464 }
std::unique_ptr< apollo::cyber::Node > cyber_node_
std::vector< std::shared_ptr< apollo::cyber::proto::RoleAttributes > > apollo_attrs_
bool LoadConfig(ConverterConf *config)

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