MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / toMsg

Method toMsg

tracking/src/track.cpp:578–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576 }
577
578 void
579 Track::toMsg(opt_msgs::Track& track_msg, bool vertical)
580 {
581
582 double _x, _y;
583 filter_->getState(_x, _y);
584
585 track_msg.id = id_;
586 track_msg.x = _x;
587 track_msg.y = _y;
588 track_msg.height = height_;
589 track_msg.distance = distance_;
590 track_msg.age = age_;
591 track_msg.confidence = - data_association_score_; // minus for transforming distance into a sort of confidence
592 track_msg.visibility = visibility_;
593
594 Eigen::Vector3d top(_x, _y, z_ + (height_/2));
595 Eigen::Vector3d bottom(_x, _y, z_ - (height_/2));
596 top = detection_source_->transformToCam(top);
597 bottom = detection_source_->transformToCam(bottom);
598 if (not vertical)
599 {
600 track_msg.box_2D.height = int(std::abs((top - bottom)(1)));
601 track_msg.box_2D.width = track_msg.box_2D.height / 2;
602 track_msg.box_2D.x = int(top(0)) - track_msg.box_2D.height / 4;
603 track_msg.box_2D.y = int(top(1));
604 }
605 else
606 {
607 track_msg.box_2D.width = int(std::abs((top - bottom)(0)));
608 track_msg.box_2D.height = track_msg.box_2D.width / 2;
609 track_msg.box_2D.x = int(top(0)) - track_msg.box_2D.width;
610 track_msg.box_2D.y = int(top(1)) - track_msg.box_2D.width / 4;
611 }
612 }
613
614 open_ptrack::detection::DetectionSource*
615 Track::getDetectionSource()

Callers 4

detection_cbFunction · 0.45
detection_cbFunction · 0.45
detection_cbFunction · 0.45
detection_cbFunction · 0.45

Calls 2

transformToCamMethod · 0.80
getStateMethod · 0.45

Tested by

no test coverage detected