Go to the documentation of this file.
38 #include <OgreViewport.h>
39 #include <OgreCamera.h>
40 #include <OgreSceneNode.h>
41 #include <Eigen/Geometry>
42 #include <QSignalBlocker>
46 static const QString
ANY_AXIS(
"arbitrary");
51 return QString(
"%1%2 axis").arg(QChar(i % 2 ?
'+' :
'-')).arg(QChar(
'x' + (i - 1) / 2));
57 "Point the camera along the given axis of the frame.",
nullptr,
62 for (
int i = 1; i <= 6; ++i)
67 "Lock camera in its current pose relative to the frame",
this);
78 camera_->setPosition(Ogre::Vector3::ZERO);
79 Eigen::Vector3d axis(0, 0, 0);
81 if (option >= 1 && option <= 6)
83 axis[(option - 1) / 2] = (option % 2) ? +1 : -1;
84 Eigen::Quaterniond q = Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitX(), axis);
94 setStatus(
"Unlock camera in settings to enable mouse interaction.");
103 Ogre::Vector3 actual =
105 for (
unsigned int i = 0; i < 3; ++i)
107 Ogre::Vector3 axis(0, 0, 0);
109 auto scalar_product = axis.dotProduct(actual);
110 if (std::abs(scalar_product) > 1.0 - precision)
111 return 1 + 2 * i + (scalar_product > 0 ? 0 : 1);
146 const Ogre::Quaternion& )
Ogre::Vector3 reference_position_
virtual bool getBool() const
virtual int getOptionInt()
Return the int value of the currently-chosen option, or 0 if the current option string does not have ...
void updateTargetSceneNode() override
Update the position of the target_scene_node_ from the TF frame specified in the Target Frame propert...
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
void setAxisFromCamera()
set axis_property_ from camera
BoolProperty * locked_property_
Lock camera, i.e. disable mouse interaction?
virtual void setString(const QString &str)
Set the value of this property to the given string. Does not force the value to be one of the list of...
void handleMouseEvent(ViewportMouseEvent &event) override
void setPropertiesFromCamera()
set yaw, pitch, roll, position properties from camera
Property specialized to provide getter for booleans.
virtual void addChild(Property *child, int index=-1)
Add a child property.
static const Ogre::Quaternion ROBOT_TO_CAMERA_ROTATION
FloatProperty * yaw_property_
The camera's yaw (rotation around the z-axis), in radians.
DisplayContext * context_
EnumProperty * axis_property_
The axis that the camera aligns to.
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void onInitialize() override
Do subclass-specific initialization. Called by ViewController::initialize after context_ and camera_ ...
virtual void addOption(const QString &option, int value=0)
void onTargetFrameChanged(const Ogre::Vector3 &old_reference_position, const Ogre::Quaternion &old_reference_orientation) override
Override to implement the change in properties which nullifies the change in target frame.
void rememberAxis(int current)
void onInitialize() override
Do subclass-specific initialization. Called by ViewController::initialize after context_ and camera_ ...
Ogre::Quaternion reference_orientation_
void changedOrientation() override
void handleMouseEvent(ViewportMouseEvent &event) override
int rowNumberInParent() const
Return the row number of this property within its parent, or -1 if it has no parent.
static const QString ANY_AXIS("arbitrary")
void setStatus(const QString &message)
int actualCameraAxisOption(double precision=0.001) const
find enum ID from camera's current pose
virtual void changedOrientation()
Ogre::SceneNode * target_scene_node_
A camera tied to a given frame.
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09