Skip to content

Commit 5af04b1

Browse files
committed
Port code to mrpt3
1 parent 92a4d8e commit 5af04b1

69 files changed

Lines changed: 534 additions & 522 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CMakeLists.txt‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ if (DETECTED_ROS2)
9898

9999
find_package(rclcpp REQUIRED)
100100

101-
# *** TEMPORARY ***!!!
102101
find_package(ament_cmake REQUIRED)
103102
find_package(geometry_msgs REQUIRED)
104103
find_package(nav_msgs REQUIRED)
@@ -193,15 +192,10 @@ endif()
193192
# Dependency: MRPT
194193
# Use the first cmd to set the minimum required version
195194
# ----------------------------------------------------------
196-
find_package(mrpt-maps REQUIRED)
197-
find_package(mrpt-tclap REQUIRED)
198-
find_package(mrpt-gui REQUIRED)
199-
find_package(mrpt-tfest REQUIRED)
200-
find_package(mrpt-topography REQUIRED)
201-
202-
if (mrpt-maps_VERSION VERSION_LESS "2.14.1")
203-
message(FATAL_ERROR "MRPT version 2.14.1 or newer is required, but found ${mrpt-maps_VERSION}")
204-
endif()
195+
find_package(mrpt_maps REQUIRED)
196+
find_package(mrpt_gui REQUIRED)
197+
find_package(mrpt_tfest REQUIRED)
198+
find_package(mrpt_topography REQUIRED)
205199

206200
# --------------------------
207201
# Dependency: Box2D

‎docs/world_lighting.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Light and shadows configuration
77
At present, the lighting model of ``mrpt-opengl`` defines
88
**one directional light source** (i.e. placed at the infinity),
99
with one color and three component intensities (ambient, diffuse, and specular).
10-
See `mrpt::opengl::TLightParameters <https://docs.mrpt.org/reference/latest/struct_mrpt_opengl_TLightParameters.html>`_
10+
See `mrpt::viz::TLightParameters <https://docs.mrpt.org/reference/latest/struct_mrpt_opengl_TLightParameters.html>`_
1111
and `mrpt-opengl <https://docs.mrpt.org/reference/latest/group_mrpt_opengl_grp.html>`_ for further details.
1212

1313
MVSim offers a number of parameters under the global ``<light> ... </light>`` tag

‎examples_cpp/mvsim-subscriber-example/CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ project(mvsim-subscriber-example)
33

44
find_package(mvsim-comms)
55
find_package(mvsim-msgs)
6-
find_package(mrpt-obs)
6+
find_package(mrpt_obs)
77

88
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp)
99

1010
target_link_libraries(${PROJECT_NAME}
1111
mvsim::mvsim-comms
1212
mvsim::mvsim-msgs
13-
mrpt::obs
13+
mrpt::mrpt_obs
1414
)

‎modules/comms/CMakeLists.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ target_link_libraries(${PROJECT_NAME}
2828
${ZeroMQ_LIBRARY}
2929
PUBLIC
3030
${Protobuf_LIBRARIES}
31-
mrpt::system
32-
mrpt::io
33-
mrpt::serialization
31+
mrpt::mrpt_system
32+
mrpt::mrpt_io
33+
mrpt::mrpt_serialization
3434
mvsim::msgs
3535
)
3636

‎modules/simulator/CMakeLists.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ target_link_libraries(${PROJECT_NAME}
150150
PRIVATE
151151
${DEP_MVSIM_MSGS_TRG}
152152
PUBLIC
153-
mrpt::obs
154-
mrpt::opengl
155-
mrpt::maps
156-
mrpt::gui
157-
mrpt::topography
153+
mrpt::mrpt_obs
154+
mrpt::mrpt_opengl
155+
mrpt::mrpt_maps
156+
mrpt::mrpt_gui
157+
mrpt::mrpt_topography
158158
${DEP_MVSIM_COMMS_TRG}
159159
${BOX2D_LIBRARIES}
160160
)

‎modules/simulator/include/mvsim/Block.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <box2d/b2_world.h>
1616
#include <mrpt/img/TColor.h>
1717
#include <mrpt/math/TPolygon2D.h>
18-
#include <mrpt/opengl/CSetOfLines.h>
19-
#include <mrpt/opengl/CSetOfObjects.h>
2018
#include <mrpt/poses/CPose2D.h>
2119
#include <mrpt/typemeta/TEnumType.h>
20+
#include <mrpt/viz/CSetOfLines.h>
21+
#include <mrpt/viz/CSetOfObjects.h>
2222
#include <mvsim/ClassFactory.h>
2323
#include <mvsim/Sensors/SensorBase.h>
2424
#include <mvsim/Simulable.h>
@@ -47,7 +47,7 @@ enum class GeometryType : int32_t
4747
/** A non-vehicle "actor" for the simulation, typically obstacle blocks.
4848
* \ingroup mvsim_simulator_module
4949
*/
50-
class Block : public VisualObject, public Simulable
50+
class Block : public CVisualObject, public Simulable
5151
{
5252
public:
5353
using Ptr = std::shared_ptr<Block>;
@@ -143,14 +143,14 @@ class Block : public VisualObject, public Simulable
143143
/// explicitly yet. Used while parsing the shape_from_visual tag.
144144
bool default_block_z_min_max() const;
145145

146-
VisualObject* meAsVisualObject() override { return this; }
146+
CVisualObject* meAsCVisualObject() override { return this; }
147147

148148
std::optional<float> getElevationAt(const mrpt::math::TPoint2D& worldXY) const override;
149149

150150
protected:
151151
virtual void internalGuiUpdate(
152-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
153-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical, bool childrenOnly) override;
152+
const mrpt::optional_ref<mrpt::viz::Scene>& viz,
153+
const mrpt::optional_ref<mrpt::viz::Scene>& physical, bool childrenOnly) override;
154154

155155
/** user-supplied index number: must be set/get'ed with setblockIndex()
156156
* getblockIndex() (default=0) */
@@ -213,7 +213,7 @@ class Block : public VisualObject, public Simulable
213213
b2Fixture* fixture_block_;
214214

215215
private:
216-
void internal_internalGuiUpdate_forces(mrpt::opengl::COpenGLScene& scene);
216+
void internal_internalGuiUpdate_forces(mrpt::viz::Scene& scene);
217217

218218
void internal_parseGeometry(const rapidxml::xml_node<char>& xml_geom_node);
219219

@@ -242,8 +242,8 @@ class Block : public VisualObject, public Simulable
242242

243243
GeometryParams geomParams_;
244244

245-
mrpt::opengl::CSetOfObjects::Ptr gl_block_;
246-
mrpt::opengl::CSetOfLines::Ptr gl_forces_;
245+
mrpt::viz::CSetOfObjects::Ptr gl_block_;
246+
mrpt::viz::CSetOfLines::Ptr gl_forces_;
247247
std::mutex force_segments_for_rendering_cs_;
248248
std::vector<mrpt::math::TSegment3D> force_segments_for_rendering_;
249249

@@ -253,7 +253,7 @@ class Block : public VisualObject, public Simulable
253253
* \ingroup mvsim_simulator_module
254254
*
255255
*/
256-
class DummyInvisibleBlock : public VisualObject, public Simulable
256+
class DummyInvisibleBlock : public CVisualObject, public Simulable
257257
{
258258
public:
259259
using Ptr = std::shared_ptr<DummyInvisibleBlock>;
@@ -301,8 +301,8 @@ class DummyInvisibleBlock : public VisualObject, public Simulable
301301

302302
protected:
303303
void internalGuiUpdate(
304-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
305-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical,
304+
const mrpt::optional_ref<mrpt::viz::Scene>& viz,
305+
const mrpt::optional_ref<mrpt::viz::Scene>& physical,
306306
[[maybe_unused]] bool childrenOnly) override;
307307

308308
void registerOnServer(mvsim::Client& c) override

‎modules/simulator/include/mvsim/CollisionShapeCache.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| See COPYING |
88
+-------------------------------------------------------------------------+ */
99

10-
#include <mrpt/opengl/CRenderizable.h>
10+
#include <mrpt/viz/CVisualObject.h>
1111
#include <mvsim/Shape2p5.h>
1212

1313
#include <map>
@@ -24,7 +24,7 @@ class CollisionShapeCache
2424

2525
/** Computes the convex hull of a given model, or gets it from the cache */
2626
Shape2p5 get(
27-
mrpt::opengl::CRenderizable& obj, float zMin, float zMax,
27+
mrpt::viz::CVisualObject& obj, float zMin, float zMax,
2828
const mrpt::poses::CPose3D& modelPose, const float modelScale,
2929
const std::optional<std::string>& modelFile = std::nullopt);
3030

@@ -45,11 +45,11 @@ class CollisionShapeCache
4545
* filled in.
4646
*/
4747
std::optional<Shape2p5> processSimpleGeometries(
48-
const mrpt::opengl::CRenderizable& obj, float zMin, float zMax,
48+
const mrpt::viz::CVisualObject& obj, float zMin, float zMax,
4949
const mrpt::poses::CPose3D& modelPose, const float modelScale);
5050

5151
Shape2p5 processGenericGeometry(
52-
mrpt::opengl::CRenderizable& obj, float zMin, float zMax,
52+
mrpt::viz::CVisualObject& obj, float zMin, float zMax,
5353
const mrpt::poses::CPose3D& modelPose, const float modelScale);
5454

5555
Shape2p5 processCylinderLike(

‎modules/simulator/include/mvsim/HumanActor.h‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
#pragma once
1010

11-
#include <mrpt/opengl/CCylinder.h>
12-
#include <mrpt/opengl/CSetOfObjects.h>
13-
#include <mrpt/opengl/CSphere.h>
1411
#include <mrpt/poses/CPose3DInterpolator.h>
1512
#include <mrpt/version.h>
13+
#include <mrpt/viz/CCylinder.h>
14+
#include <mrpt/viz/CSetOfObjects.h>
15+
#include <mrpt/viz/CSphere.h>
1616
#include <mvsim/ClassFactory.h>
1717
#include <mvsim/Simulable.h>
1818
#include <mvsim/TParameterDefinitions.h>
@@ -21,9 +21,9 @@
2121
#define MIN_MRPT_VERSION_ANIMATED_ASSIMP 0x020f08
2222

2323
#if MRPT_VERSION >= MIN_MRPT_VERSION_ANIMATED_ASSIMP
24-
#include <mrpt/opengl/CAnimatedAssimpModel.h>
24+
#include <mrpt/viz/CAnimatedAssimpModel.h>
2525
#else
26-
#include <mrpt/opengl/CAssimpModel.h>
26+
#include <mrpt/viz/CAssimpModel.h>
2727
#endif
2828

2929
#include <memory>
@@ -63,7 +63,7 @@ class World;
6363
*
6464
* \ingroup mvsim_simulator_module
6565
*/
66-
class HumanActor : public VisualObject, public Simulable
66+
class HumanActor : public CVisualObject, public Simulable
6767
{
6868
public:
6969
using Ptr = std::shared_ptr<HumanActor>;
@@ -153,8 +153,8 @@ class HumanActor : public VisualObject, public Simulable
153153

154154
protected:
155155
void internalGuiUpdate(
156-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
157-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical, bool childrenOnly) override;
156+
const mrpt::optional_ref<mrpt::viz::Scene>& viz,
157+
const mrpt::optional_ref<mrpt::viz::Scene>& physical, bool childrenOnly) override;
158158

159159
// ==================== Configuration Parameters ====================
160160

@@ -212,9 +212,9 @@ class HumanActor : public VisualObject, public Simulable
212212

213213
// ==================== Rendering ====================
214214
#if MRPT_VERSION >= MIN_MRPT_VERSION_ANIMATED_ASSIMP
215-
mrpt::opengl::CAnimatedAssimpModel::Ptr glModel_;
215+
mrpt::viz::CAnimatedAssimpModel::Ptr glModel_;
216216
#else
217-
mrpt::opengl::CAssimpModel::Ptr glModel_;
217+
mrpt::viz::CAssimpModel::Ptr glModel_;
218218
#endif
219219
bool glInitialized_ = false;
220220

‎modules/simulator/include/mvsim/Joystick.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
+------------------------------------------------------------------------+ */
2020
#pragma once
2121

22-
#include <mrpt/config.h>
22+
#include <mrpt/core/config.h>
2323

2424
#include <vector>
2525

@@ -78,7 +78,7 @@ class Joystick
7878
/** Gets joystick information.
7979
*
8080
* This method will try first to open the joystick, so you can safely call
81-
* it while the joystick is plugged and removed arbitrarly.
81+
* it while the joystick is plugged and removed arbitrarily.
8282
*
8383
* \param nJoy The index of the joystick to query: The first one is 0, the
8484
* second 1, etc... See CJoystick::getJoysticksCount to discover the number

‎modules/simulator/include/mvsim/Sensors/CameraSensor.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#pragma once
1111

1212
#include <mrpt/obs/CObservationImage.h>
13-
#include <mrpt/opengl/CFBORender.h>
13+
#include <mrpt/viz/CFBORender.h>
1414
#include <mvsim/Sensors/SensorBase.h>
1515

1616
#include <mutex>
@@ -34,14 +34,14 @@ class CameraSensor : public SensorBase
3434
virtual void simul_pre_timestep(const TSimulContext& context) override;
3535
virtual void simul_post_timestep(const TSimulContext& context) override;
3636

37-
void simulateOn3DScene(mrpt::opengl::COpenGLScene& gl_scene) override;
37+
void simulateOn3DScene(mrpt::viz::Scene& gl_scene) override;
3838

3939
void freeOpenGLResources() override;
4040

4141
protected:
4242
virtual void internalGuiUpdate(
43-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
44-
const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical, bool childrenOnly) override;
43+
const mrpt::optional_ref<mrpt::viz::Scene>& viz,
44+
const mrpt::optional_ref<mrpt::viz::Scene>& physical, bool childrenOnly) override;
4545

4646
void notifySimulableSetPose(const mrpt::math::TPose3D& newPose) override;
4747

@@ -60,7 +60,7 @@ class CameraSensor : public SensorBase
6060
mrpt::obs::CObservationImage::Ptr last_obs_;
6161
mrpt::obs::CObservationImage::Ptr last_obs2gui_;
6262

63-
std::shared_ptr<mrpt::opengl::CFBORender> fbo_renderer_rgb_;
63+
std::shared_ptr<mrpt::viz::CFBORender> fbo_renderer_rgb_;
6464

6565
/** Whether gl_* have to be updated upon next call of
6666
* internalGuiUpdate() from last_scan2gui_ */
@@ -71,7 +71,7 @@ class CameraSensor : public SensorBase
7171

7272
float rgbClipMin_ = 1e-2, rgbClipMax_ = 1e+4;
7373

74-
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_origin_, gl_sensor_origin_corner_;
75-
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_fov_, gl_sensor_frustum_;
74+
mrpt::viz::CSetOfObjects::Ptr gl_sensor_origin_, gl_sensor_origin_corner_;
75+
mrpt::viz::CSetOfObjects::Ptr gl_sensor_fov_, gl_sensor_frustum_;
7676
};
7777
} // namespace mvsim

0 commit comments

Comments
 (0)