Skip to content

Commit

Permalink
Use /gui/track functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Dec 3, 2024
1 parent a3d1ab6 commit 5604930
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/integration/camera_tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <gtest/gtest.h>

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/cameratrack.pb.h>
#include <gz/msgs/pose.pb.h>
#include <gz/msgs/stringmsg.pb.h>
#include <gz/msgs/vector3d.pb.h>
Expand Down Expand Up @@ -176,6 +177,21 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config))
EXPECT_GT(10, abs(camera->WorldPose().Pos().Y() - 100));
EXPECT_GT(10, abs(camera->WorldPose().Pos().Z() - 100));

// Move target object to new position
trackedVis->SetWorldPose({130, 130, 130, 0, 0, 0});

// Follow
auto trackPub = node.Advertise<gz::msgs::CameraTrack>("/gui/track");
msgs::CameraTrack trackMsg;
trackMsg.set_track_mode(msgs::CameraTrack::FOLLOW);
trackMsg.mutable_follow_target()->set_name("track_me");
trackPub.Publish(trackMsg);

trackMsg.mutable_follow_offset()->set_x(1);
trackMsg.mutable_follow_offset()->set_y(1);
trackMsg.mutable_follow_offset()->set_z(1);
trackPub.Publish(trackMsg);

// Many update loops to process many events
maxSleep = 600;
for (auto it : {150.0, 200.0})
Expand Down

0 comments on commit 5604930

Please sign in to comment.