422 {
423 if (!v2x_car_status) {
424 return false;
425 }
426 if (!out_junction_id) {
427 return false;
428 }
429 if (!out_heading) {
430 return false;
431 }
432 *out_junction_id = kUnknownJunctionId;
433 auto res = std::make_shared<::apollo::v2x::CarStatus>();
434 if (nullptr == res) {
435 return false;
436 }
437 if (!os_location.has_header()) {
438 return false;
439 }
440 if (!os_location.has_pose()) {
441 return false;
442 }
443 res->mutable_localization()->CopyFrom(os_location);
452 *out_heading = heading;
453 std::vector<::apollo::hdmap::RSUInfoConstPtr> rsus;
454 if (0 != hdmap->GetForwardNearestRSUs(point, distance, heading,
455 max_heading_difference, &rsus) ||
456 rsus.empty()) {
457 AINFO <<
"no rsu is found";
458 return false;
459 }
460 AINFO <<
"Get " << rsus.size() <<
" rsu(s)";
461 if (rsu_whitelist.find(rsus[0]->id().id() + "_tl") == rsu_whitelist.cend()) {
462 AINFO <<
"This rsu id '" << rsus[0]->id().id()
463 << "' is not in the white list";
464 return false;
465 }
466 AINFO <<
"This RSU is in the white list";
467 AINFO <<
"Junction id " << rsus[0]->rsu().junction_id().id();
468 auto junction_info = hdmap->GetJunctionById(rsus[0]->rsu().junction_id());
469 if (nullptr == junction_info) {
470 return false;
471 }
472 std::shared_ptr<::apollo::v2x::ObuJunction> obu_junction = nullptr;
473 if (!ProtoAdapter::JunctionHd2obu(junction_info, &obu_junction)) {
474 return false;
475 }
476 res->mutable_junction()->CopyFrom(*obu_junction);
477 *v2x_car_status = res;
478 *out_junction_id = junction_info->id().id();
479 return true;
480}
double QuaternionToHeading(const double qw, const double qx, const double qy, const double qz)
optional apollo::localization::Pose pose
optional apollo::common::Quaternion orientation
optional apollo::common::PointENU position