Skip to content

Commit

Permalink
Use Entity instead of string.
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Perseghetti <[email protected]>
  • Loading branch information
bperseghetti committed May 11, 2024
1 parent 96b602a commit 23f9ac8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions src/gui/plugins/modules/EntityContextMenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/cameratrack.pb.h>
#include <gz/msgs/stringmsg.pb.h>
#include <gz/msgs/entity.pb.h>
#include <gz/msgs/stringmsg.pb.h>

#include <iostream>
#include <mutex>
Expand Down Expand Up @@ -257,37 +257,38 @@ void EntityContextMenu::OnRequest(const QString &_request, const QString &_data)
else if (request == "follow")
{
msgs::CameraTrack followMsg;
followMsg.set_follow_target(_data.toStdString());
followMsg.mutable_follow_target()->set_name(_data.toStdString());
followMsg.set_track_mode(msgs::CameraTrack::FOLLOW);
this->dataPtr->followTargetLookAt = followMsg.follow_target();
gzmsg << "Follow target: " << followMsg.follow_target() << std::endl;
this->dataPtr->followTargetLookAt = followMsg.follow_target().name();
gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl;
this->dataPtr->trackPub.Publish(followMsg);
}
else if (request == "free_look")
{
msgs::CameraTrack followMsg;
followMsg.set_follow_target(_data.toStdString());
followMsg.mutable_follow_target()->set_name(_data.toStdString());
followMsg.set_track_mode(msgs::CameraTrack::FOLLOW_FREE_LOOK);
this->dataPtr->followTargetLookAt = followMsg.follow_target();
gzmsg << "Follow target: " << followMsg.follow_target() << std::endl;
this->dataPtr->followTargetLookAt = followMsg.follow_target().name();
gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl;
this->dataPtr->trackPub.Publish(followMsg);
}
else if (request == "look_at")
{
msgs::CameraTrack followMsg;
followMsg.set_track_target(_data.toStdString());
followMsg.mutable_track_target()->set_name(_data.toStdString());
followMsg.set_track_mode(msgs::CameraTrack::FOLLOW_LOOK_AT);
followMsg.set_follow_target(this->dataPtr->followTargetLookAt);
gzmsg << "Follow target: " << followMsg.follow_target() << std::endl;
gzmsg << "Look at target: " << followMsg.track_target() << std::endl;
followMsg.mutable_follow_target()->set_name(
this->dataPtr->followTargetLookAt);
gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl;
gzmsg << "Look at target: " << followMsg.track_target().name() << std::endl;
this->dataPtr->trackPub.Publish(followMsg);
}
else if (request == "track")
{
msgs::CameraTrack trackMsg;
trackMsg.set_track_target(_data.toStdString());
trackMsg.mutable_track_target()->set_name(_data.toStdString());
trackMsg.set_track_mode(msgs::CameraTrack::TRACK);
gzmsg << "Track target: " << trackMsg.track_target() << std::endl;
gzmsg << "Track target: " << trackMsg.track_target().name() << std::endl;
this->dataPtr->trackPub.Publish(trackMsg);
}
else if (request == "view_transparent")
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/modules/EntityContextMenu.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace sim

/// \brief Set whether followingTarget
/// \param[in] _followingTarget True if followingTarget
public: Q_INVOKABLE void SetFollowingTarget(const bool &_followingTarget);
public: Q_INVOKABLE void SetFollowingTarget(bool &_followingTarget);

/// \brief Notify that followingTarget has changed
signals: void FollowingTargetChanged();
Expand Down

0 comments on commit 23f9ac8

Please sign in to comment.