Drake
generate_obj.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
8 
9 namespace drake {
10 namespace maliput {
11 namespace utility {
12 
13 /// Multitude of parameters for generating an OBJ model of a road surface,
14 /// with sensible defaults.
15 struct ObjFeatures {
16  /// Maximum distance between rendered vertices, in either s- or r-dimension,
17  /// along a lane's surface
18  double max_grid_unit{1.0};
19  /// Minimum number of vertices, in either s- or r-dimension, along a lane's
20  /// surface.
21  double min_grid_resolution{5.0};
22  /// Draw stripes along lane_bounds() of each lane?
23  bool draw_stripes{true};
24  /// Draw arrows at start/finish of each lane?
25  bool draw_arrows{true};
26  /// Draw highlighting swath with lane_bounds() of each lane?
27  bool draw_lane_haze{true};
28  /// Draw branching at BranchPoints?
29  bool draw_branch_points{true};
30  /// Draw highlighting of elevation_bounds of each lane?
32  /// Absolute width of stripes
33  double stripe_width{0.25};
34  /// Absolute elevation (h) of stripes above road surface
35  double stripe_elevation{0.05};
36  /// Absolute elevation (h) of arrows above road surface
37  double arrow_elevation{0.05};
38  /// Absolute elevation (h) of lane-haze above road surface
39  double lane_haze_elevation{0.02};
40  /// Absolute elevation (h) of branch-points above road surface
42  /// Height of rendered branch-point arrows
43  double branch_point_height{0.5};
44  /// Origin of OBJ coordinates relative to world-frame
45  api::GeoPosition origin{0., 0., 0.};
46  /// ID's of specific segments to be highlighted. (If non-empty, then the
47  /// Segments *not* specified on this list will be rendered as grayed-out.)
48  std::vector<api::SegmentId> highlighted_segments;
49 };
50 
51 /// Generates a Wavefront OBJ model of the road surface of an api::RoadGeometry.
52 ///
53 /// @param road_geometry the api::RoadGeometry to model
54 /// @param dirpath directory component of the output pathnames
55 /// @param fileroot root of the filename component of the output pathnames
56 /// @param features parameters for constructing the mesh
57 ///
58 /// GenerateObjFile actually produces two files: the first, named
59 /// [@p dirpath]/[@p fileroot].obj, is a Wavefront OBJ containing the
60 /// mesh which models the api::RoadGeometry. The second file is a
61 /// Wavefront MTL file named [@p dirpath]/[@p fileroot].mtl, containing
62 /// descriptions of materials referenced by the OBJ file.
63 ///
64 /// The produced mesh covers the area within the driveable-bounds of the
65 /// road surface described by the RoadGeometry.
66 void GenerateObjFile(const api::RoadGeometry* road_geometry,
67  const std::string& dirpath,
68  const std::string& fileroot,
69  const ObjFeatures& features);
70 
71 } // namespace utility
72 } // namespace maliput
73 } // namespace drake
bool draw_stripes
Draw stripes along lane_bounds() of each lane?
Definition: generate_obj.h:23
Definition: generate_obj.cc:24
bool draw_branch_points
Draw branching at BranchPoints?
Definition: generate_obj.h:29
double lane_haze_elevation
Absolute elevation (h) of lane-haze above road surface.
Definition: generate_obj.h:39
bool draw_arrows
Draw arrows at start/finish of each lane?
Definition: generate_obj.h:25
Definition: automotive_demo.cc:88
double branch_point_height
Height of rendered branch-point arrows.
Definition: generate_obj.h:43
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
bool draw_lane_haze
Draw highlighting swath with lane_bounds() of each lane?
Definition: generate_obj.h:27
GeoPositionT< double > GeoPosition
Definition: lane_data.h:178
double arrow_elevation
Absolute elevation (h) of arrows above road surface.
Definition: generate_obj.h:37
std::vector< api::SegmentId > highlighted_segments
ID&#39;s of specific segments to be highlighted.
Definition: generate_obj.h:48
void GenerateObjFile(const api::RoadGeometry *rg, const std::string &dirpath, const std::string &fileroot, const ObjFeatures &features)
Generates a Wavefront OBJ model of the road surface of an api::RoadGeometry.
Definition: generate_obj.cc:779
Multitude of parameters for generating an OBJ model of a road surface, with sensible defaults...
Definition: generate_obj.h:15
double min_grid_resolution
Minimum number of vertices, in either s- or r-dimension, along a lane&#39;s surface.
Definition: generate_obj.h:21
double branch_point_elevation
Absolute elevation (h) of branch-points above road surface.
Definition: generate_obj.h:41
double stripe_elevation
Absolute elevation (h) of stripes above road surface.
Definition: generate_obj.h:35
bool draw_elevation_bounds
Draw highlighting of elevation_bounds of each lane?
Definition: generate_obj.h:31
double stripe_width
Absolute width of stripes.
Definition: generate_obj.h:33
double max_grid_unit
Maximum distance between rendered vertices, in either s- or r-dimension, along a lane&#39;s surface...
Definition: generate_obj.h:18
api::GeoPosition origin
Origin of OBJ coordinates relative to world-frame.
Definition: generate_obj.h:45