Skip to content
Snippets Groups Projects
Commit 2c47a9f8 authored by Josef Jiru's avatar Josef Jiru
Browse files

Merge branch '5-add-further-get-functions-to-traci-vehicle' into 'master'

Resolve "Add further get functions to traci-vehicle"

Closes #5

See merge request ezcar2x/ns3/traci!6
parents 6be4785f 1091e661
No related branches found
No related tags found
No related merge requests found
...@@ -32,9 +32,10 @@ Vehicle::Vehicle (Ptr<TraCi> traci, std::string id) ...@@ -32,9 +32,10 @@ Vehicle::Vehicle (Ptr<TraCi> traci, std::string id)
: m_traci (traci), m_id (id), : m_traci (traci), m_id (id),
m_position (m_traci, id), m_position (m_traci, id),
m_length (m_traci, id), m_width (m_traci, id), m_height (m_traci, id), m_length (m_traci, id), m_width (m_traci, id), m_height (m_traci, id),
m_speed (m_traci, id), m_speed_lateral (m_traci, id), m_maxSpeed (m_traci, id), m_speed (m_traci, id), m_speedLateral (m_traci, id), m_maxSpeed (m_traci, id),
m_heading (m_traci, id), m_acceleration (m_traci, id), m_maxSpeedLateral (m_traci, id), m_heading (m_traci, id), m_acceleration (m_traci, id),
m_lane_idx (m_traci, id), m_road_id (m_traci, id), m_color (m_traci, id) m_maxAcceleration (m_traci, id), m_maxDeceleration (m_traci, id),
m_laneIdx (m_traci, id), m_roadId (m_traci, id), m_color (m_traci, id)
{ {
} }
...@@ -120,7 +121,13 @@ Vehicle::GetMaxSpeed (bool forceReload) const ...@@ -120,7 +121,13 @@ Vehicle::GetMaxSpeed (bool forceReload) const
double double
Vehicle::GetSpeedLateral (bool forceReload) const Vehicle::GetSpeedLateral (bool forceReload) const
{ {
return m_speed_lateral.GetValue (forceReload); return m_speedLateral.GetValue (forceReload);
}
double
Vehicle::GetMaxSpeedLateral (bool forceReload) const
{
return m_maxSpeedLateral.GetValue (forceReload);
} }
Heading Heading
...@@ -144,16 +151,28 @@ Vehicle::GetAcceleration (bool forceReload) const ...@@ -144,16 +151,28 @@ Vehicle::GetAcceleration (bool forceReload) const
return m_acceleration.GetValue (forceReload); return m_acceleration.GetValue (forceReload);
} }
double
Vehicle::GetMaxAcceleration (bool forceReload) const
{
return m_maxAcceleration.GetValue (forceReload);
}
double
Vehicle::GetMaxDeceleration (bool forceReload) const
{
return m_maxDeceleration.GetValue (forceReload);
}
int int
Vehicle::GetLaneIndex (bool forceReload) const Vehicle::GetLaneIndex (bool forceReload) const
{ {
return m_lane_idx.GetValue (forceReload); return m_laneIdx.GetValue (forceReload);
} }
std::string std::string
Vehicle::GetRoadID (bool forceReload) const Vehicle::GetRoadID (bool forceReload) const
{ {
return m_road_id.GetValue (forceReload); return m_roadId.GetValue (forceReload);
} }
Color Color
......
...@@ -133,6 +133,10 @@ public: ...@@ -133,6 +133,10 @@ public:
double double
GetSpeedLateral (bool forceReload = false) const; GetSpeedLateral (bool forceReload = false) const;
//! Get max lateral speed in m/s
double
GetMaxSpeedLateral (bool forceReload = false) const;
//! Get current heading //! Get current heading
Heading Heading
GetHeading (bool forceReload = false) const; GetHeading (bool forceReload = false) const;
...@@ -145,6 +149,14 @@ public: ...@@ -145,6 +149,14 @@ public:
double double
GetAcceleration (bool forceReload = false) const; GetAcceleration (bool forceReload = false) const;
//! Get max acceleration
double
GetMaxAcceleration (bool forceReload = false) const;
//! Get max deceleration
double
GetMaxDeceleration (bool forceReload = false) const;
//! Get current lane idx //! Get current lane idx
int int
GetLaneIndex (bool forceReload = false) const; GetLaneIndex (bool forceReload = false) const;
...@@ -266,12 +278,15 @@ private: ...@@ -266,12 +278,15 @@ private:
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_WIDTH, true> m_width; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_WIDTH, true> m_width;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_HEIGHT, true> m_height; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_HEIGHT, true> m_height;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED> m_speed; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED> m_speed;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_LAT> m_speed_lateral; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_LAT> m_speedLateral;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED> m_maxSpeed; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED> m_maxSpeed;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED> m_maxSpeedLateral;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ANGLE> m_heading; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ANGLE> m_heading;
CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCELERATION> m_acceleration; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCELERATION> m_acceleration;
CachedVariable<int, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANE_INDEX> m_lane_idx; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCEL> m_maxAcceleration;
CachedVariable<std::string, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROAD_ID> m_road_id; CachedVariable<double, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_DECEL> m_maxDeceleration;
CachedVariable<int, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANE_INDEX> m_laneIdx;
CachedVariable<std::string, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROAD_ID> m_roadId;
CachedVariable<Color, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_COLOR> m_color; CachedVariable<Color, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_COLOR> m_color;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment