private void PublishGroundTruth(List <Ros.Detection2D> detectedObjects) { if (Bridge == null || Bridge.Status != Ros.Status.Connected) { return; } if (Time.time < nextSend) { return; } if (detectedObjects == null) { return; } if (targetEnv == ROSTargetEnvironment.AUTOWARE || targetEnv == ROSTargetEnvironment.APOLLO) { var detectedObjectArrayMsg = new Ros.Detection2DArray() { header = new Ros.Header() { stamp = Ros.Time.Now(), }, detections = detectedObjects, }; Bridge.Publish(objects2DTopicName, detectedObjectArrayMsg); nextSend = Time.time + 1.0f / frequency; } }
private void PublishGroundTruth(List <Ros.Detection2D> detectedObjects) { if (Bridge == null || Bridge.Status != Ros.Status.Connected) { return; } var detectedObjectArrayMsg = new Ros.Detection2DArray() { detections = detectedObjects, }; // if (targetEnv == ROSTargetEnvironment.AUTOWARE || targetEnv == ROSTargetEnvironment.APOLLO) { // Bridge.Publish(objects2DTopicName, detectedObjectArrayMsg); // } Debug.Log("Publish"); }
private void PublishGroundTruth(List <Ros.Detection2D> detectedObjects) { if (Bridge == null || Bridge.Status != Comm.BridgeStatus.Connected) { return; } if (Time.time < nextSend) { return; } if (detectedObjects == null) { return; } if (targetEnv == ROSTargetEnvironment.AUTOWARE || targetEnv == ROSTargetEnvironment.APOLLO || targetEnv == ROSTargetEnvironment.LGSVL) { var detectedObjectArrayMsg = new Ros.Detection2DArray() { header = new Ros.Header() { stamp = Ros.Time.Now(), }, detections = detectedObjects, }; DectectedObjectArrayWriter.Publish(detectedObjectArrayMsg); nextSend = Time.time + 1.0f / frequency; } if (targetEnv == ROSTargetEnvironment.APOLLO35) { Apollo.Common.Detection2DArray cyberDetectionObjectArray = new Apollo.Common.Detection2DArray(); foreach (Ros.Detection2D rosDetection2D in detectedObjects) { Apollo.Common.Detection2D cyberDetection2D = new Apollo.Common.Detection2D() { Header = new Apollo.Common.Header() { SequenceNum = rosDetection2D.header.seq, FrameId = rosDetection2D.header.frame_id, TimestampSec = (double)rosDetection2D.header.stamp.secs, }, Id = rosDetection2D.id, Label = rosDetection2D.label, Score = rosDetection2D.score, Bbox = new Apollo.Common.BoundingBox2D() { X = rosDetection2D.bbox.x, Y = rosDetection2D.bbox.y, Height = rosDetection2D.bbox.height, Width = rosDetection2D.bbox.width, }, Velocity = new Apollo.Common.Twist() { Linear = new Apollo.Common.Vector3() { X = rosDetection2D.velocity.linear.x, Y = rosDetection2D.velocity.linear.y, Z = rosDetection2D.velocity.linear.z, }, Angular = new Apollo.Common.Vector3() { X = rosDetection2D.velocity.angular.x, Y = rosDetection2D.velocity.angular.y, Z = rosDetection2D.velocity.angular.z, }, }, }; cyberDetectionObjectArray.Detections.Add(cyberDetection2D); } System.DateTime Unixepoch = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); double measurement_time = (double)(System.DateTime.UtcNow - Unixepoch).TotalSeconds; cyberDetectionObjectArray.Header = new Apollo.Common.Header() { TimestampSec = measurement_time, }; Apollo35DetectedObjectArrayWriter.Publish(cyberDetectionObjectArray); nextSend = Time.time + 1.0f / frequency; } }