23 #include <ros/console.h>
97 int plot_distance = 400;
103 double r = 0,
g = 0, b = 0;
104 std::stringstream ss_hashtag, ss_color, ss_tl_icon;
110 double x_from = from.get<0>();
111 double y_from = from.get<1>();
114 double x_to = to.get<0>();
115 double y_to = to.get<1>();
117 std::pair<double,double> pos_coord = std::make_pair(x_from,y_from);
120 if(distance_to_object > plot_distance)
124 ss_hashtag <<
"#con::"<< (int) x_from <<
"::"<< (
int) y_from<<
"::" << (int) x_to<<
"::" << (
int)y_to;
125 ss_tl_icon << ss_hashtag.str() <<
"::icon";
138 ROS_DEBUG_STREAM(
"Received new states.");
139 ROS_DEBUG_STREAM(
"x_from: " << x_from <<
"; y_from: " << y_from);
140 ROS_DEBUG_STREAM(
"state: " << state);
147 tl_img =
"../images/tl_yellow.png";
152 tl_img =
"../images/tl_green.png";
157 tl_img =
"../images/tl_red.png";
162 tl_img =
"../images/tl_red_yellow.png";
166 tl_img =
"../images/tl_green.png";
171 tl_img =
"../images/tl_green.png";
177 tl_img =
"../images/tl_yellow.png";
182 tl_img =
"../images/tl_yellow.png";
187 tl_img =
"../images/tl_yellow.png";
190 std::cout <<
"Unknown state: " << state << std::endl;
191 tl_img =
"../images/tl_yellow.png";
196 ss_color <<
"LineColor=" <<
r <<
"," <<
g <<
"," << b;
198 double heading = std::numeric_limits<double>::quiet_NaN();
225 return std::numeric_limits<double>::quiet_NaN();
230 if (borders_near_connection_point.size() == 0)
231 return std::numeric_limits<double>::quiet_NaN();
234 pred = borders_near_connection_point[0];
243 void removeDistanceBased(std::unordered_map<std::string, std::pair<double,double>> &visible_objects,
int distance)
246 std::vector<std::string> remove;
248 for(
auto it = visible_objects.begin();it!=visible_objects.end();it++)
250 auto coord = (*it).second;
252 if(distance_to_object > distance) remove.push_back((*it).first);
255 for(
auto it = remove.begin();it!=remove.end();it++)
258 visible_objects.erase((*it));
268 double distance_x = v_pos_x - point.first;
269 double distance_y = v_pos_y - point.second;
271 return (std::sqrt((distance_x * distance_x) + (distance_y*distance_y)));
a optimzed plotting application to plot map borders, vehicles and environment information and backgro...
Definition: plot_trafficlights.h:34
void removeDistanceBased(std::unordered_map< std::string, std::pair< double, double >> &visible_objects, int distance)
Definition: plot_trafficlights.h:243
bool plot_connection_lines
Definition: plot_trafficlights.h:39
virtual void plotTLConnections()
Definition: plot_trafficlights.h:94
PlotTrafficLights(DLR_TS::PlotLab::AFigureStub *figure, std::string prefix, bool connection_lines=false)
Definition: plot_trafficlights.h:54
DLR_TS::PlotLab::AFigureStub * figure_
Definition: plot_trafficlights.h:46
std::unordered_map< std::string, std::pair< double, double > > visible_TCD_controller_
Definition: plot_trafficlights.h:50
adore::mad::AFeed< adore::env::BorderBased::Border > * borderfeed_
Definition: plot_trafficlights.h:38
adore::mad::AReader< adore::env::VehicleMotionState9d > * positionReader_
Definition: plot_trafficlights.h:36
void run()
Definition: plot_trafficlights.h:73
double getDistanceToPoint(std::pair< double, double > &point)
Definition: plot_trafficlights.h:262
~PlotTrafficLights()
Definition: plot_trafficlights.h:65
adore::mad::AFeed< adore::env::ControlledConnection > * tl_controller_feed_
Definition: plot_trafficlights.h:37
adore::env::VehicleMotionState9d position_
Definition: plot_trafficlights.h:47
adore::env::BorderBased::BorderSet borderSet_
Definition: plot_trafficlights.h:51
double getHeadingFromMap(double x, double y)
Definition: plot_trafficlights.h:222
double getHeadingOfLine(double x1, double y1, double x2, double y2)
Definition: plot_trafficlights.h:217
std::string prefix_
Definition: plot_trafficlights.h:48
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
virtual TControlledConnectionFeed * getControlledConnectionFeed()=0
virtual TBorderFeed * getBorderFeed()=0
efficiently store borders in boost R-tree
Definition: borderset.h:99
BorderSubSet getBordersAtPoint(double x, double y, double max_lane_width)
get all borders at the given point
Definition: borderset.h:403
void insert_border(Border *b, bool force_insert=false)
insert new border into this
Definition: borderset.h:225
int size()
number of borders in this
Definition: borderset.h:1497
Definition: controlledconnection.h:81
const TID & getID() const
Definition: controlledconnection.h:100
ConnectionState::EConnectionState getState_byMinTime(double t) const
Definition: controlledconnection.h:118
static adore::env::AFactory * get()
Definition: afactory.h:236
virtual void getNext(T &value)=0
virtual bool hasNext() const =0
virtual void getData(T &value)=0
virtual bool hasUpdate() const =0
adoreMatrix< T, n+1, 0 > & getData()
Definition: llinearpiecewisefunction.h:147
void plotLine(std::string hashtag, double x0, double y0, double x1, double y1, double z, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:209
std::vector< Border * > BorderSubSet
Definition: borderset.h:92
EConnectionState
Definition: controlledconnection.h:36
@ PROTECTED___MOVEMENT___ALLOWED
Definition: controlledconnection.h:43
@ STOP___AND___REMAIN
Definition: controlledconnection.h:40
@ PERMISSIVE___MOVEMENT___ALLOWED
Definition: controlledconnection.h:42
@ DARK
Definition: controlledconnection.h:38
@ STOP___THEN___PROCEED
Definition: controlledconnection.h:39
@ PERMISSIVE__CLEARANCE
Definition: controlledconnection.h:44
@ CAUTION___CONFLICTING___TRAFFIC
Definition: controlledconnection.h:46
@ PRE___MOVEMENT
Definition: controlledconnection.h:41
@ PROTECTED__CLEARANCE
Definition: controlledconnection.h:45
ALFunction< T, T > * heading(AScalarToN< T, 2 > *df)
Definition: heading.h:114
interval< T > atan2(interval< T > y, interval< T > x)
Definition: intervalarithmetic.h:234
x
Definition: adore_set_goal.py:30
g
Definition: adore_set_goal.py:29
y
Definition: adore_set_goal.py:31
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
r
Definition: adore_suppress_lanechanges.py:209
Definition: areaofeffectconverter.h:20
The border struct contains data of the smallest.
Definition: border.h:62
Tborderpath * m_path
Definition: border.h:70
Tboost_point getFrom() const
Definition: vectoridentifier.h:65
Tboost_point getTo() const
Definition: vectoridentifier.h:66
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39
double getX() const
Get the x-coordinate.
Definition: vehiclemotionstate9d.h:54
double getY() const
Get the y-coordinate.
Definition: vehiclemotionstate9d.h:60
double getTime() const
Get the time.
Definition: vehiclemotionstate9d.h:48