codac 1.5.6
Loading...
Searching...
No Matches
codac_VIBesFigMap.h
Go to the documentation of this file.
1
12#ifndef __CODAC_VIBESFIGMAP_H__
13#define __CODAC_VIBESFIGMAP_H__
14
15#include <map>
16#include <vector>
17
18#include <codac_Interval.h>
19#include <codac_VIBesFig.h>
20#include <codac_TubeVector.h>
22#include <codac_Beacon.h>
23#include <codac_ColorMap.h>
24
25namespace codac
26{
27 #define TRAJ_MAX_NB_DISPLAYED_POINTS 2000
28 #define TUBE_MAX_NB_DISPLAYED_SLICES 2000
29
30 // HTML color codes:
31 #define DEFAULT_BEACON_COLOR "#D65A00[#FFB93C]"
32 #define DEFAULT_TRAJMAP_COLOR "#276279"
33 #define DEFAULT_MAPBCKGRND_COLOR "#d2d2d2[#d2d2d2]"
34 #define DEFAULT_OBS_COLOR "gray"
35 #define DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ true
36
45 class VIBesFigMap : public VIBesFig
46 {
47 public:
48
51
57 VIBesFigMap(const std::string& fig_name);
58
63
70 void restrict_tdomain(const Interval& restricted_tdomain);
71
78 void enable_tubes_backgrounds(bool enable = true);
79
80 void no_axis_limits();
81
85 void show();
86
92 void show(float robot_size);
93
100
110
119 void smooth_tube_drawing(bool smooth);
120
124
133 void add_tube(const TubeVector *tube, const std::string& name, int index_x, int index_y);
134
141 void set_tube_name(const TubeVector *tube, const std::string& name);
142
149 void set_tube_color(const TubeVector *tube, const std::string& color);
150
159 void set_tube_color(const TubeVector *tube, const ColorMap& colormap, const Trajectory *traj_colormap = nullptr);
160
171 void remove_tube(const TubeVector *tube);
172
176
190 void add_trajectory(const TrajectoryVector *traj, const std::string& name, int index_x, int index_y, const std::string& color = DEFAULT_TRAJMAP_COLOR, bool vehicle_display = DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ);
191
206 void add_trajectory(const TrajectoryVector *traj, const std::string& name, int index_x, int index_y, int index_heading, const std::string& color = DEFAULT_TRAJMAP_COLOR, bool vehicle_display = DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ);
207
214 void set_trajectory_name(const TrajectoryVector *traj, const std::string& name);
215
222 void set_trajectory_color(const TrajectoryVector *traj, const std::string& color);
223
232 void set_trajectory_color(const TrajectoryVector *traj, const ColorMap& colormap, const Trajectory *traj_colormap = nullptr);
233
240 void set_vehicle_display(const TrajectoryVector *traj, bool vehicle_display);
241
253
257
264 void draw_vehicle(const Vector& pose, float size = -1);
265
273 void draw_vehicle(const Vector& pose, const vibes::Params& params, float size = -1);
274
282 void draw_vehicle(double t, const TrajectoryVector *traj, float size = -1);
283
292 void draw_vehicle(double t, const TrajectoryVector *traj, const vibes::Params& params, float size = -1);
293
302 void add_beacon(const Beacon& beacon, const std::string& color = DEFAULT_BEACON_COLOR);
303
312 void add_beacon(const IntervalVector& beacon, const std::string& color = DEFAULT_BEACON_COLOR);
313
321 void add_beacon(const Beacon& beacon, double width, const std::string& color = DEFAULT_BEACON_COLOR);
322
330 void add_beacon(const Vector& beacon, double width, const std::string& color = DEFAULT_BEACON_COLOR);
331
342 void add_beacons(const std::vector<Beacon>& v_beacons, const std::string& color = DEFAULT_BEACON_COLOR);
343
353 void add_beacons(const std::vector<Beacon>& v_beacons, double width, const std::string& color = DEFAULT_BEACON_COLOR);
354
361 void add_landmarks(const std::vector<IntervalVector>& v_m, const std::string& color = DEFAULT_BEACON_COLOR);
362
370 void add_landmarks(const std::vector<Vector>& v_m, double width, const std::string& color = DEFAULT_BEACON_COLOR);
371
383 void add_observation(const IntervalVector& obs, const Vector& pose, const std::string& color = DEFAULT_OBS_COLOR);
384
396 void add_observations(const std::vector<IntervalVector>& v_obs, const Vector& pose, const std::string& color = DEFAULT_OBS_COLOR);
397
409 void add_observation(const IntervalVector& obs, const TrajectoryVector *traj, const std::string& color = DEFAULT_OBS_COLOR);
410
422 void add_observations(const std::vector<IntervalVector>& v_obs, const TrajectoryVector *traj, const std::string& color = DEFAULT_OBS_COLOR);
423
435 double heading(double t, const TrajectoryVector *traj) const;
436
438
439 protected:
440
447 const IntervalVector draw_tube(const TubeVector *tube);
448
458 const IntervalVector draw_tube_background(const TubeVector *tube);
459
469 const IntervalVector draw_trajectory(const TrajectoryVector *traj, float points_size = 0.);
470
476 void draw_slices(const TubeVector *tube);
477
487 void draw_beacon(const Beacon& beacon, const std::string& color, const vibes::Params& params);
488
497 void draw_beacon(const Beacon& beacon, double width, const std::string& color, const vibes::Params& params);
498
511 void draw_observation(const IntervalVector& obs, const Vector& pose, const std::string& color = "", const vibes::Params& params = vibes::Params());
512
525 void draw_observation(const IntervalVector& obs, const TrajectoryVector *traj, const std::string& color = "", const vibes::Params& params = vibes::Params());
526
527
528 protected:
529
535 {
536 std::string name;
537 std::string color = "";
538 std::pair<ColorMap,const Trajectory*> color_map;
539 const Tube *tube_x_copy = nullptr, *tube_y_copy;
540 bool from_first_to_last = !true;
541 int index_x, index_y;
542 };
543
549 {
550 std::string name;
551 std::string color = "";
552 std::pair<ColorMap,const Trajectory*> color_map;
553 int index_x, index_y, index_heading = -1;
554 bool vehicle_display = DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ;
555 };
556
557 std::map<const TubeVector*,FigMapTubeParams> m_map_tubes;
558 std::map<const TrajectoryVector*,FigMapTrajParams> m_map_trajs;
559
562 bool m_smooth_drawing = false;
563 float m_robot_size = 5.5;
564 bool _no_axis_limits = false;
565
566 unsigned int m_tube_max_nb_disp_slices = TUBE_MAX_NB_DISPLAYED_SLICES;
567 unsigned int m_traj_max_nb_disp_points = TRAJ_MAX_NB_DISPLAYED_POINTS;
568 };
569}
570
571#endif
Associates colors to a range of values.
Definition codac_ColorMap.h:32
int width() const
Returns the width of this figure.
const std::string name() const
Returns the name of this figure.
One dimensional trajectory , defined as a temporal map of values.
Definition codac_Trajectory.h:35
n-dimensional trajectory , defined as a temporal map of vector values
Definition codac_TrajectoryVector.h:38
One dimensional tube , defined as an interval of scalar trajectories.
Definition codac_Tube.h:48
n-dimensional tube , defined as an interval of n-dimensional trajectories
Definition codac_TubeVector.h:39
Two-dimensional graphical item based on the VIBes viewer.
Definition codac_VIBesFig.h:38
Two-dimensional graphical item to project dynamical items (tubes, trajectories, etc....
Definition codac_VIBesFigMap.h:46
void add_observation(const IntervalVector &obs, const Vector &pose, const std::string &color=DEFAULT_OBS_COLOR)
Adds a range-and-bearing uncertain observation to the map, in a static context.
void set_trajectory_color(const TrajectoryVector *traj, const std::string &color)
Sets constant color properties for a given trajectory.
void add_beacons(const std::vector< Beacon > &v_beacons, double width, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a set of Beacon objects to the map with a specific width.
void draw_vehicle(double t, const TrajectoryVector *traj, float size=-1)
Draws a vehicle on top of its trajectory.
bool m_draw_tubes_backgrounds
if true, will highlight tubes contractions
Definition codac_VIBesFigMap.h:561
void add_trajectory(const TrajectoryVector *traj, const std::string &name, int index_x, int index_y, const std::string &color=DEFAULT_TRAJMAP_COLOR, bool vehicle_display=DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ)
Adds a trajectory vector object (x,y) to this figure.
void set_tube_name(const TubeVector *tube, const std::string &name)
Sets a new name for a tube.
void draw_vehicle(const Vector &pose, const vibes::Params &params, float size=-1)
Draws a vehicle with a given pose.
void draw_vehicle(const Vector &pose, float size=-1)
Draws a vehicle with a given pose.
~VIBesFigMap()
VIBesFigMap destructor.
void show(float robot_size)
Displays this figure with a custom robot size.
const IntervalVector draw_trajectory(const TrajectoryVector *traj, float points_size=0.)
Draws a trajectory.
void smooth_tube_drawing(bool smooth)
Enables the smoothing of tubes.
void draw_observation(const IntervalVector &obs, const Vector &pose, const std::string &color="", const vibes::Params &params=vibes::Params())
Draws a range-and-bearing uncertain observation on the map in static situation.
void set_tube_color(const TubeVector *tube, const std::string &color)
Sets constant color properties for a given tube.
void draw_observation(const IntervalVector &obs, const TrajectoryVector *traj, const std::string &color="", const vibes::Params &params=vibes::Params())
Draws a range-and-bearing uncertain observation on the map in dynamic situation.
void set_traj_max_disp_points(int max)
Limits the number of points to be displayed for trajectories.
void add_tube(const TubeVector *tube, const std::string &name, int index_x, int index_y)
Adds a tube vector object to this figure.
float m_robot_size
if 0, no robot display
Definition codac_VIBesFigMap.h:563
void add_landmarks(const std::vector< Vector > &v_m, double width, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a set of landmarks to the map with a specific width.
void remove_tube(const TubeVector *tube)
Removes a tube from this figure.
void enable_tubes_backgrounds(bool enable=true)
Enables the display of previous versions of the tubes, in order to highlight the contractions of thes...
void add_beacons(const std::vector< Beacon > &v_beacons, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a set of Beacon objects to the map.
double heading(double t, const TrajectoryVector *traj) const
Returns actual or estimated heading related to some TrajectoryVector at t.
void restrict_tdomain(const Interval &restricted_tdomain)
Restricts the display of the dynamical items to a part of their tdomain only.
void add_trajectory(const TrajectoryVector *traj, const std::string &name, int index_x, int index_y, int index_heading, const std::string &color=DEFAULT_TRAJMAP_COLOR, bool vehicle_display=DEFAULT_VEHICLE_DISPLAY_ON_EACH_TRAJ)
Adds a trajectory vector object (x,y,heading) to this figure.
unsigned int m_tube_max_nb_disp_slices
limit for slices display
Definition codac_VIBesFigMap.h:566
void set_tube_color(const TubeVector *tube, const ColorMap &colormap, const Trajectory *traj_colormap=nullptr)
Sets a color map for a given tube.
void add_beacon(const Beacon &beacon, double width, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a Beacon object to the map with a specific width.
void add_observations(const std::vector< IntervalVector > &v_obs, const Vector &pose, const std::string &color=DEFAULT_OBS_COLOR)
Adds a set of range-and-bearing uncertain observations to the map, in a static context.
void add_beacon(const Vector &beacon, double width, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a Beacon object to the map with a specific width (from a Vector)
void remove_trajectory(const TrajectoryVector *traj)
Removes a trajectory from this figure.
void add_beacon(const IntervalVector &beacon, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a Beacon object to the map (from an IntervalVector)
std::map< const TubeVector *, FigMapTubeParams > m_map_tubes
map of Tube objects to be displayed, together with parameters
Definition codac_VIBesFigMap.h:557
VIBesFigMap(const std::string &fig_name)
Creates a VIBesFigMap.
void set_trajectory_name(const TrajectoryVector *traj, const std::string &name)
Sets a new name for a trajectory.
void draw_beacon(const Beacon &beacon, double width, const std::string &color, const vibes::Params &params)
Draws a Beacon object with a specific width.
void show()
Displays this figure.
void set_trajectory_color(const TrajectoryVector *traj, const ColorMap &colormap, const Trajectory *traj_colormap=nullptr)
Sets a color map for a given trajectory.
void set_vehicle_display(const TrajectoryVector *traj, bool vehicle_display)
Displays a vehicle at the end of a trajectory.
void add_observation(const IntervalVector &obs, const TrajectoryVector *traj, const std::string &color=DEFAULT_OBS_COLOR)
Adds a range-and-bearing uncertain observation to the map, in a dynamic context.
void draw_slices(const TubeVector *tube)
Draws the slices of a tube.
void draw_vehicle(double t, const TrajectoryVector *traj, const vibes::Params &params, float size=-1)
Draws a vehicle on top of its trajectory.
const IntervalVector draw_tube(const TubeVector *tube)
Draws a tube.
void set_tube_max_disp_slices(int max)
Limits the number of slices to be displayed for tubes.
unsigned int m_traj_max_nb_disp_points
limit for traj points display
Definition codac_VIBesFigMap.h:567
std::map< const TrajectoryVector *, FigMapTrajParams > m_map_trajs
map of Trajectory objects to be displayed, together with parameters
Definition codac_VIBesFigMap.h:558
Interval m_restricted_tdomain
restricts the display to a part of the temporal domain
Definition codac_VIBesFigMap.h:560
void add_landmarks(const std::vector< IntervalVector > &v_m, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a set of boxed landmarks to the map.
const IntervalVector draw_tube_background(const TubeVector *tube)
Draws the background of a tube.
void add_observations(const std::vector< IntervalVector > &v_obs, const TrajectoryVector *traj, const std::string &color=DEFAULT_OBS_COLOR)
Adds a set of range-and-bearing uncertain observations to the map, in a dynamic context.
void add_beacon(const Beacon &beacon, const std::string &color=DEFAULT_BEACON_COLOR)
Adds a Beacon object to the map.
void draw_beacon(const Beacon &beacon, const std::string &color, const vibes::Params &params)
Draws a Beacon object.
bool m_smooth_drawing
if true, a smooth rendering of tubes will be done
Definition codac_VIBesFigMap.h:562
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition codac_capd_helpers.h:9
const Trajectory max(const Trajectory &y, const Trajectory &x)
Specifies some parameters related to a Trajectory display.
Definition codac_VIBesFigMap.h:549
std::pair< ColorMap, const Trajectory * > color_map
custom colormap of the trajectory
Definition codac_VIBesFigMap.h:552
bool vehicle_display
boolean for vehicle display
Definition codac_VIBesFigMap.h:554
int index_heading
integer references for state components ; -1: not defined
Definition codac_VIBesFigMap.h:553
std::string color
constant color of the trajectory
Definition codac_VIBesFigMap.h:551
std::string name
human readable identifier of the tube
Definition codac_VIBesFigMap.h:550
Specifies some parameters related to a Tube display.
Definition codac_VIBesFigMap.h:535
int index_y
integer references for state components
Definition codac_VIBesFigMap.h:541
std::string name
human readable identifier of the tube
Definition codac_VIBesFigMap.h:536
std::pair< ColorMap, const Trajectory * > color_map
custom colormap of the tube
Definition codac_VIBesFigMap.h:538
const Tube * tube_y_copy
to display previous values in background, before any new contraction
Definition codac_VIBesFigMap.h:539
bool from_first_to_last
order of slices display (each one on top of the next/previous one)
Definition codac_VIBesFigMap.h:540
std::string color
constant color of the tube
Definition codac_VIBesFigMap.h:537