Skip to content

Commit b751aec

Browse files
committed
bug fixed and color to vehicle added
1 parent 647c233 commit b751aec

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

config/driver1.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ x_A_1 : [40, 30, 23, 23]
2020
y_A_1 : [8, 8, 0, -50]
2121
theta_A_1: [3.14, 3.14, -1.72, -1.72]
2222

23-
driving_style: "Constant"
23+
driving_style: "Constant"
24+
color: [0, 0, 1, 1]

config/driver2.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ x_A_1 : [-2, 17, 23, 23]
2020
y_A_1 : [4, 4, 0, -50]
2121
theta_A_1: [0, 0, -1.72, -1.72]
2222

23-
driving_style: "Constant"
23+
driving_style: "Constant"
24+
color: [1, 0, 1, 1]

config/driver3.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ x_A_1 : [53, 30, 23, 23]
2020
y_A_1 : [8, 8, 0, -50]
2121
theta_A_1: [3.14, 3.14, -1.72, -1.72]
2222

23-
driving_style: "Constant"
23+
driving_style: "Constant"
24+
color: [0, 1, 1, 1]

config/driver4.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ x_A_1 : [-17, 20, 23, 23]
2020
y_A_1 : [4, 4, 0, -50]
2121
theta_A_1: [0, 0, -1.72, -1.72]
2222

23-
driving_style: "Conservative"
23+
driving_style: "Conservative"
24+
color: [0.5, 0, 0.5, 1]

src/DriverModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ DriverModel::DriverModel(){
100100

101101
//pose_R = {initi_ego_x, initi_ego_y, PI/2};
102102
pose_R = {0, 0, 0, 0, 0, 0};
103-
state = {initi_obs_x, initi_obs_y, PI, initi_obs_v, 1, 0};
103+
state = init_obs;
104104

105105
poseR_sub = n_.subscribe("pose_R", 100, &DriverModel::Callback, this);
106106

src/driver_node.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main(int argc, char** argv){
77
ros::init(argc, argv, "DriverModel");
88
ros::NodeHandle n;
99
ros::Rate r(2.5);
10-
ros::Publisher veh_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 100);
10+
ros::Publisher veh_pub = n.advertise<visualization_msgs::Marker>("/visualization_marker", 100);
1111

1212
uint32_t shape = visualization_msgs::Marker::CUBE;
1313

@@ -28,6 +28,13 @@ int main(int argc, char** argv){
2828
return 0;
2929
}
3030

31+
vector<double> color;
32+
if (!n.getParam("color", color))
33+
{
34+
ROS_ERROR("Parameter 'color' not set");
35+
return 0;
36+
}
37+
3138
Obs_veh.type = shape;
3239

3340
Obs_veh.action = visualization_msgs::Marker::ADD;
@@ -38,10 +45,10 @@ int main(int argc, char** argv){
3845
Obs_veh.scale.z = 1;
3946

4047

41-
Obs_veh.color.r = 0.0f;
42-
Obs_veh.color.g = 0.0f;
43-
Obs_veh.color.b = 1.0f;
44-
Obs_veh.color.a = 1.0;
48+
Obs_veh.color.r = color[0];
49+
Obs_veh.color.g = color[1];
50+
Obs_veh.color.b = color[2];
51+
Obs_veh.color.a = color[3];
4552

4653
Obs_veh.lifetime = ros::Duration();
4754

@@ -55,6 +62,8 @@ int main(int argc, char** argv){
5562
// state_A[4] = 1;
5663
// else
5764
// state_A[4] = 0;
65+
ROS_INFO_STREAM("Initial condition " << Obs_veh.ns << " " << Driver.state[0] << " " << Driver.state[1] << " " << Driver.state[2]
66+
<< " " << Driver.state[3]<< " " << Driver.state[4] << " " << Driver.state[5]);
5867

5968
double dis;
6069
double min_dis = 999;

0 commit comments

Comments
 (0)