33 {
34 AINFO <<
"start to init MotionService.";
35 vehicle_planemotion_ = new PlaneMotion(motion_buffer_size_);
36
37
40 AINFO <<
"load lane detection component proto param failed";
41 return false;
42 }
43
44 std::string camera_names_str = motion_service_param.
camera_names();
45 boost::algorithm::split(camera_names_, camera_names_str,
46 boost::algorithm::is_any_of(","));
47
48 std::string input_camera_channel_names_str =
50 boost::algorithm::split(input_camera_channel_names_,
51 input_camera_channel_names_str,
52 boost::algorithm::is_any_of(","));
53 if (input_camera_channel_names_.size() != camera_names_.size()) {
54 AERROR <<
"wrong input_camera_channel_names_.size(): "
55 << input_camera_channel_names_.size();
57 }
58
59
60 const std::string &channel_name_img = input_camera_channel_names_[0];
61 const std::string &camera_name = camera_names_[0];
62 std::function<void(
const ImageMsgType &)> camera_callback =
63 std::bind(&MotionServiceComponent::OnReceiveImage, this,
64 std::placeholders::_1, camera_name);
65 auto camera_reader =
node_->CreateReader(channel_name_img, camera_callback);
66
67
68 const std::string &channel_name_local =
71 std::bind(&MotionServiceComponent::OnLocalization, this,
72 std::placeholders::_1);
73 auto localization_reader =
74 node_->CreateReader(channel_name_local, localization_callback);
75
76
77 writer_ =
node_->CreateWriter<MotionService>(
79 AINFO <<
"init MotionService success.";
80 return true;
81}
bool GetProtoConfig(T *config) const
std::shared_ptr< Node > node_
std::shared_ptr< localization::LocalizationEstimate > LocalizationMsgType
std::shared_ptr< apollo::drivers::Image > ImageMsgType
optional string input_camera_channel_names
optional string input_localization_channel_name
optional string output_topic_channel_name
optional string camera_names