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

Method toMsg

tracking/src/track_object.cpp:577–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577void
578TrackObject::toMsg(opt_msgs::Track &track_msg, bool vertical)
579{
580
581 double _x, _y;
582 filter_->getState(_x, _y);
583
584 track_msg.id = id_;
585 track_msg.x = _x;
586 track_msg.y = _y;
587 track_msg.height = height_;
588 track_msg.distance = distance_;
589 track_msg.object_name=object_name_;
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
614open_ptrack::detection::DetectionSource*
615TrackObject::getDetectionSource()

Callers

nothing calls this directly

Calls 2

transformToCamMethod · 0.80
getStateMethod · 0.45

Tested by

no test coverage detected