Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ThirdPersonFollowerViewController #295

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

7 changes: 4 additions & 3 deletions rviz_default_plugins/CMakeLists.txt
Expand Up @@ -142,6 +142,7 @@ set(rviz_default_plugins_source_files
src/rviz_default_plugins/tools/move/move_tool.cpp
src/rviz_default_plugins/tools/point/point_tool.cpp
src/rviz_default_plugins/tools/select/selection_tool.cpp
src/rviz_default_plugins/view_controllers/follower/third_person_follower_view_controller.cpp
src/rviz_default_plugins/view_controllers/fps/fps_view_controller.cpp
src/rviz_default_plugins/view_controllers/orbit/orbit_view_controller.cpp
src/rviz_default_plugins/view_controllers/ortho/fixed_orientation_ortho_view_controller.cpp
Expand Down Expand Up @@ -272,7 +273,7 @@ if(BUILD_TESTING)
ament_add_gmock(grid_cells_display_test
test/rviz_default_plugins/displays/grid_cells/grid_cells_display_test.cpp
test/rviz_default_plugins/displays/display_test_fixture.cpp
test/rviz_default_plugins/scene_graph_introspection.cpp
test/rviz_default_plugins/scene_graph_introspection_helper.cpp
APPEND_ENV AMENT_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} PATH=${CMAKE_INSTALL_PREFIX}/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_assimp_vendor/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_yaml_cpp_vendor/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_ogre_vendor/bin)
if(TARGET grid_cells_display_test)
target_include_directories(grid_cells_display_test PUBLIC
Expand Down Expand Up @@ -327,7 +328,7 @@ if(BUILD_TESTING)
ament_add_gmock(point_display_test
test/rviz_default_plugins/displays/point/point_stamped_display_test.cpp
test/rviz_default_plugins/displays/display_test_fixture.cpp
test/rviz_default_plugins/scene_graph_introspection.cpp)
test/rviz_default_plugins/scene_graph_introspection_helper.cpp)
if(TARGET point_display_test)
target_include_directories(point_display_test PUBLIC
${TEST_INCLUDE_DIRS})
Expand Down Expand Up @@ -484,7 +485,7 @@ if(BUILD_TESTING)
test/rviz_default_plugins/view_controllers/fps/fps_view_controller_test.cpp
test/rviz_default_plugins/view_controllers/view_controller_test_fixture.hpp
test/rviz_default_plugins/displays/display_test_fixture.cpp
test/rviz_default_plugins/scene_graph_introspection.cpp
test/rviz_default_plugins/scene_graph_introspection_helper.cpp
APPEND_ENV AMENT_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} PATH=${CMAKE_INSTALL_PREFIX}/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_assimp_vendor/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_yaml_cpp_vendor/bin;${CMAKE_INSTALL_PREFIX}/opt/rviz_ogre_vendor/bin)
if(TARGET fps_view_controller_test)
target_include_directories(fps_view_controller_test PUBLIC
Expand Down
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, Willow Garage, Inc.
* Copyright (c) 2018, Bosch Software Innovations GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -27,51 +28,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef RVIZ_THIRD_PERSON_VIEW_CONTROLLER_H
#define RVIZ_THIRD_PERSON_VIEW_CONTROLLER_H

#include "rviz/default_plugin/view_controllers/orbit_view_controller.h"
#ifndef RVIZ_DEFAULT_PLUGINS__VIEW_CONTROLLERS__FOLLOWER__THIRD_PERSON_FOLLOWER_VIEW_CONTROLLER_HPP_
#define RVIZ_DEFAULT_PLUGINS__VIEW_CONTROLLERS__FOLLOWER__THIRD_PERSON_FOLLOWER_VIEW_CONTROLLER_HPP_

#include <OgreVector3.h>

namespace Ogre
{
class SceneNode;
}
#include "rviz_default_plugins/view_controllers/xy_orbit/xy_orbit_view_controller.hpp"

namespace rviz
namespace rviz_default_plugins
{
namespace view_controllers
{

class TfFrameProperty;

/**
* \brief Like the orbit view controller, but focal point moves only in the x-y plane.
* \brief Like the XY orbit view controller, but turns when the target frame yaws.
*/
class ThirdPersonFollowerViewController : public OrbitViewController
class ThirdPersonFollowerViewController : public XYOrbitViewController
{
Q_OBJECT
public:
virtual void onInitialize();

virtual void handleMouseEvent(ViewportMouseEvent& evt);

virtual void lookAt( const Ogre::Vector3& point );

/** @brief Configure the settings of this view controller to give,
* as much as possible, a similar view as that given by the
* @a source_view.
*
* @a source_view must return a valid @c Ogre::Camera* from getCamera(). */
virtual void mimic( ViewController* source_view );

protected:
virtual void updateCamera();

virtual void updateTargetSceneNode();

bool intersectGroundPlane( Ogre::Ray mouse_ray, Ogre::Vector3 &intersection_3d );
void updateTargetSceneNode() override;
};

}
} // namespace view_controllers
} // namespace rviz_default_plugins

#endif // RVIZ_VIEW_CONTROLLER_H
#endif // RVIZ_DEFAULT_PLUGINS__VIEW_CONTROLLERS__FOLLOWER__THIRD_PERSON_FOLLOWER_VIEW_CONTROLLER_HPP_
8 changes: 8 additions & 0 deletions rviz_default_plugins/plugins_description.xml
Expand Up @@ -270,4 +270,12 @@
Makes it easy to move around a given point on the XY plane, looking at it from any angle.
</description>
</class>
<class
name="rviz_default_plugins/ThirdPersonFollower"
type="rviz_default_plugins::view_controllers::ThirdPersonFollowerViewController"
base_class_type="rviz_common::ViewController">
<description>
Follow a target frame and turn the viewing direction with the yaw of the target frame.
</description>
</class>
</library>