Skip to content

Commit 53de862

Browse files
committed
mutac: change terrain from flat plain to real heights
1 parent 55207d8 commit 53de862

File tree

29 files changed

+437
-150
lines changed

29 files changed

+437
-150
lines changed

.vscode/c_cpp_properties.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"configurations": [
3+
{
4+
"browse": {
5+
"databaseFilename": "${default}",
6+
"limitSymbolsToIncludedHeaders": false
7+
},
8+
"includePath": [
9+
"/home/rodri/catkin_ws/devel/include/**",
10+
"/opt/ros/noetic/include/**",
11+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/control/autopilot/include/**",
12+
"/home/rodri/catkin_ws/src/multi_uav_test_area_coverage/execution_monitor/include/**",
13+
"/home/rodri/catkin_ws/src/flightmare/flightlib/include/**",
14+
"/home/rodri/catkin_ws/src/flightmare/flightros/include/**",
15+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/utils/manual_flight_assistant/include/**",
16+
"/home/rodri/catkin_ws/src/mav_comm/mav_msgs/include/**",
17+
"/home/rodri/catkin_ws/src/mav_comm/mav_planning_msgs/include/**",
18+
"/home/rodri/catkin_ws/src/multi_uav_test_area_coverage/multi_robot_simulator/include/**",
19+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/trajectory_planning/polynomial_trajectories/include/**",
20+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/control/position_controller/include/**",
21+
"/home/rodri/catkin_ws/src/rpg_quadrotor_common/quadrotor_common/include/**",
22+
"/home/rodri/catkin_ws/src/rotors_simulator/rotors_control/include/**",
23+
"/home/rodri/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/include/**",
24+
"/home/rodri/catkin_ws/src/rotors_simulator/rotors_hil_interface/include/**",
25+
"/home/rodri/catkin_ws/src/rotors_simulator/rotors_joy_interface/include/**",
26+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/test/rpg_quadrotor_integration_test/include/**",
27+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/simulation/rpg_rotors_interface/include/**",
28+
"/home/rodri/catkin_ws/src/rpg_single_board_io/include/**",
29+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/bridges/sbus_bridge/include/**",
30+
"/home/rodri/catkin_ws/src/rpg_quadrotor_common/state_predictor/include/**",
31+
"/home/rodri/catkin_ws/src/rpg_quadrotor_control/trajectory_planning/trajectory_generation_helper/include/**",
32+
"/usr/include/**",
33+
"/home/rodri/catkin_ws/src/multi_uav_test_area_coverage/planner/src/multi_uav_planning_binpat/planning_binpat/include",
34+
"/home/rodri/catkin_ws/src/multi_uav_test_area_coverage/performance_evaluation/performance_evaluator/include"
35+
],
36+
"name": "ROS",
37+
"intelliSenseMode": "gcc-x64",
38+
"compilerPath": "/usr/bin/gcc",
39+
"cStandard": "gnu11",
40+
"cppStandard": "c++14"
41+
}
42+
],
43+
"version": 4
44+
}

.vscode/settings.json

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"python.autoComplete.extraPaths": [
3+
"/home/rodri/catkin_ws/devel/lib/python3/dist-packages",
4+
"/opt/ros/noetic/lib/python3/dist-packages"
5+
],
6+
"files.associations": {
7+
"cctype": "cpp",
8+
"clocale": "cpp",
9+
"cmath": "cpp",
10+
"csignal": "cpp",
11+
"cstdarg": "cpp",
12+
"cstddef": "cpp",
13+
"cstdio": "cpp",
14+
"cstdlib": "cpp",
15+
"cstring": "cpp",
16+
"ctime": "cpp",
17+
"cwchar": "cpp",
18+
"cwctype": "cpp",
19+
"any": "cpp",
20+
"array": "cpp",
21+
"atomic": "cpp",
22+
"hash_map": "cpp",
23+
"hash_set": "cpp",
24+
"strstream": "cpp",
25+
"*.tcc": "cpp",
26+
"bitset": "cpp",
27+
"chrono": "cpp",
28+
"codecvt": "cpp",
29+
"complex": "cpp",
30+
"condition_variable": "cpp",
31+
"cstdint": "cpp",
32+
"deque": "cpp",
33+
"forward_list": "cpp",
34+
"list": "cpp",
35+
"unordered_map": "cpp",
36+
"unordered_set": "cpp",
37+
"vector": "cpp",
38+
"exception": "cpp",
39+
"algorithm": "cpp",
40+
"filesystem": "cpp",
41+
"functional": "cpp",
42+
"iterator": "cpp",
43+
"map": "cpp",
44+
"memory": "cpp",
45+
"memory_resource": "cpp",
46+
"numeric": "cpp",
47+
"optional": "cpp",
48+
"random": "cpp",
49+
"ratio": "cpp",
50+
"regex": "cpp",
51+
"set": "cpp",
52+
"string": "cpp",
53+
"string_view": "cpp",
54+
"system_error": "cpp",
55+
"tuple": "cpp",
56+
"type_traits": "cpp",
57+
"utility": "cpp",
58+
"fstream": "cpp",
59+
"future": "cpp",
60+
"initializer_list": "cpp",
61+
"iomanip": "cpp",
62+
"iosfwd": "cpp",
63+
"iostream": "cpp",
64+
"istream": "cpp",
65+
"limits": "cpp",
66+
"mutex": "cpp",
67+
"new": "cpp",
68+
"ostream": "cpp",
69+
"shared_mutex": "cpp",
70+
"sstream": "cpp",
71+
"stdexcept": "cpp",
72+
"streambuf": "cpp",
73+
"thread": "cpp",
74+
"cfenv": "cpp",
75+
"cinttypes": "cpp",
76+
"typeindex": "cpp",
77+
"typeinfo": "cpp",
78+
"valarray": "cpp",
79+
"variant": "cpp",
80+
"bit": "cpp",
81+
"*.ipp": "cpp"
82+
},
83+
"python.analysis.extraPaths": [
84+
"/home/rodri/catkin_ws/devel/lib/python3/dist-packages",
85+
"/opt/ros/noetic/lib/python3/dist-packages"
86+
]
87+
}

execution_monitor/src/execution_monitor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ ExecutionMonitor::ExecutionMonitor(int id) {
5555
pose_sub = nh.subscribe("drone_pose", 100, &LocalDrone::positionCallBack, dynamic_cast<MonitorData*>(drone.get()));
5656
battery_sub = nh.subscribe("battery_state", 100, &LocalDrone::batteryCallBack, drone.get());
5757

58-
trj_sub = nh.subscribe("/mutac/planned_paths", 100, &ExecutionMonitor::trajectoryCallBack, this);
58+
//trj_sub = nh.subscribe("/mutac/planned_paths", 100, &ExecutionMonitor::trajectoryCallBack, this);
59+
trj_sub = nh.subscribe("/mutac/real_planned_paths", 100, &ExecutionMonitor::trajectoryCallBack, this);
5960
alarm_sub = nh.subscribe("/mutac/drone_alarm", 100, &ExecutionMonitor::cameraCallBack, this);
6061
}
6162

execution_monitor/src/global_monitor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ GlobalMonitor::GlobalMonitor() {
5353
pose_subs.push_back(nh.subscribe("drone" + to_string(i+1) + "/drone_pose", 1, &GlobalDrone::positionCallBack, drone.get()));
5454
}
5555

56-
trj_sub = nh.subscribe("planned_paths", 100, &GlobalMonitor::trajectoryCallBack, this);
56+
//trj_sub = nh.subscribe("planned_paths", 100, &GlobalMonitor::trajectoryCallBack, this);
57+
trj_sub = nh.subscribe("real_planned_paths", 100, &GlobalMonitor::trajectoryCallBack, this);
5758
events_sub = nh.subscribe("drone_events", 100, &GlobalMonitor::eventCallBack, this);
5859
covered_sub = nh.subscribe("covered_points", 100, &GlobalMonitor::waypointCallBack, this);
5960

multi_robot_simulator/include/simulator/flightmare_simulator.h

+16
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ class Simulator {
8989

9090
ros::Subscriber path_sub;
9191

92+
ros::Publisher real_path_pub;
93+
94+
9295
std::vector<ros::Publisher> pose_pubs;
9396
std::vector<ros::Publisher> speed_pubs;
9497

@@ -101,6 +104,19 @@ class Simulator {
101104

102105
double battery_per_min;
103106

107+
int terrain_altitude[11][28] = {
108+
{30, 29, 29, 28, 27, 27, 25, 24, 23, 21, 21, 18, 18, 17, 17, 16, 16, 16, 16, 16, 16, 17, 17, 15, 14, 11, 11, 11},
109+
{32, 31, 31, 31, 31, 30, 30, 29, 27, 27, 27, 26, 25, 26, 25, 25, 25, 25, 23, 23, 23, 23, 22, 21, 20, 19, 19, 18},
110+
{30, 30, 29, 29, 30, 28, 29, 27, 29, 28, 27, 27, 26, 26, 26, 26, 25, 26, 24, 25, 24, 24, 23, 23, 22, 22, 21, 20},
111+
{27, 27, 26, 26, 26, 26, 27, 25, 27, 26, 24, 24, 25, 24, 25, 25, 24, 24, 25, 25, 25, 25, 24, 24, 23, 22, 21, 20},
112+
{26, 25, 24, 24, 23, 23, 24, 22, 23, 21, 21, 21, 21, 21, 22, 21, 21, 21, 23, 22, 23, 22, 23, 22, 22, 21, 21, 20},
113+
{25, 24, 25, 24, 23, 24, 23, 23, 22, 22, 21, 20, 19, 18, 18, 17, 16, 16, 19, 16, 17, 16, 19, 16, 19, 17, 17, 18},
114+
{27, 26, 25, 25, 24, 24, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 13, 14, 12, 13, 11, 11, 10, 12, 11},
115+
{28, 27, 26, 26, 25, 25, 25, 24, 23, 23, 23, 22, 21, 21, 20, 19, 18, 16, 16, 14, 13, 12, 11, 9, 8, 7, 6, 3},
116+
{27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 22, 21, 20, 19, 18, 17, 14, 15, 12, 10, 9, 8, 7, 6, 4, 2, 0},
117+
{26, 26, 25, 25, 25, 24, 24, 23, 23, 23, 22, 22, 21, 21, 19, 18, 17, 16, 13, 13, 12, 11, 10, 8, 5, 6, 5, 2},
118+
{24, 24, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22, 21, 21, 20, 20, 18, 18, 16, 16, 14, 14, 12, 12, 9, 9, 7, 7}};
119+
104120
private:
105121
void connectROS();
106122
void configDrones();

multi_robot_simulator/src/simulator/flightmare_simulator.cpp

+44-3
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,63 @@ void Simulator::connectROS() {
181181
path_sub = nh.subscribe("planned_paths", 100, &Simulator::pathCallback, this);
182182

183183
// Publishers
184+
real_path_pub = nh.advertise<mutac_msgs::Plan>("real_planned_paths", 16u);
184185
for (int i = 0; i < n_drones; i++) {
185186
pose_pubs.push_back(nh.advertise<geometry_msgs::Pose>("drone" + std::to_string(i+1) + "/drone_pose", 100));
186187
speed_pubs.push_back(nh.advertise<geometry_msgs::Twist>("drone" + std::to_string(i+1) + "/drone_twist", 100));
187188
}
188189
}
189190

190191
void Simulator::pathCallback(const mutac_msgs::Plan &msg) {
192+
193+
//es el punto 3 el principio del camino (0, 1, 2 tienen otra altura, por lo que probablemente n, n-1 y n-2 tambien)
194+
195+
mutac_msgs::Plan temp = msg;
196+
191197
for (size_t i = 0; i < msg.paths.size(); i++) {
192-
int droneID = msg.paths[i].identifier.natural;
198+
for (size_t j = 1; j < msg.paths[i].points.size() - 1; j++) {
199+
double valor_altura = -11.1;
200+
double real_x = temp.paths[i].points[j].point.x + 13.5;
201+
double real_y = (-1) * temp.paths[i].points[j].point.y + 22.6;
202+
203+
double diff_x = (real_x*10)/244 - round((real_x*10)/244);
204+
205+
if(diff_x < 0) {
206+
valor_altura += ( (1 - ((-1)*diff_x))*terrain_altitude[(int) round((real_x*10)/244)][(int) round((real_y*27)/126)] + ((-1)*diff_x)*terrain_altitude[(int) round((real_x*10)/244) - 1][(int) round((real_y*27)/126)]);
207+
} else {
208+
valor_altura += ( (1 - diff_x)*terrain_altitude[(int) round((real_x*10)/244)][(int) round((real_y*27)/126)] + diff_x*terrain_altitude[(int) round((real_x*10)/244) + 1][(int) round((real_y*27)/126)]);
209+
}
210+
211+
if(valor_altura > 100)
212+
std::cout << valor_altura << ", " << diff_x << " - " << real_x << " , " << terrain_altitude[(int) round((real_x*10)/244)][(int) round((real_y*27)/126)] << " + " << ((-1)*diff_x)*terrain_altitude[((int) round((real_x*10)/244)) - 1][(int) round((real_y*27)/126)] << " ... " << ((int) round((real_x*10)/244)) - 1 << std::endl;
213+
214+
temp.paths[i].points[j].point.z = temp.paths[i].points[j].point.z + valor_altura;
215+
}
216+
}
217+
218+
219+
real_path_pub.publish(temp);
220+
221+
222+
/*std::cout << temp.paths[0].points[2]
223+
<< temp.paths[0].points[3]
224+
<< temp.paths[1].points[2]
225+
<< temp.paths[1].points[3]
226+
<< temp.paths[2].points[2]
227+
<< temp.paths[2].points[3];*/
228+
229+
//for (size_t i = 0; i < msg.paths.size(); i++) {
230+
for (size_t i = 0; i < temp.paths.size(); i++) {
231+
//int droneID = msg.paths[i].identifier.natural;
232+
int droneID = temp.paths[i].identifier.natural;
193233

194234
if ((size_t)droneID > drones.size() - 1 || droneID < 0) {
195235
std::cout << "WARNING: Trajectory received for a drone that doesn't exists." << std::endl;
196236
return;
197237
}
198238

199-
std::vector<mutac_msgs::LabeledPoint> path = msg.paths[i].points;
239+
//std::vector<mutac_msgs::LabeledPoint> path = msg.paths[i].points;
240+
std::vector<mutac_msgs::LabeledPoint> path = temp.paths[i].points;
200241

201242
if (path.size() < 2) {
202243
std::cout << "WARNING: Trajectoy needs to have at leat 2 waypoints." << std::endl;
@@ -212,7 +253,7 @@ void Simulator::pathCallback(const mutac_msgs::Plan &msg) {
212253
drones[droneID]->clearTrjPoints();
213254

214255
// Add the points of the new plan
215-
for (size_t i = 1; i < path.size(); i++) {
256+
for (size_t i = 1; i < path.size(); i++) {
216257
drones[droneID]->addPoint(std::vector<double>{path[i].point.x, path[i].point.y, path[i].point.z});
217258
}
218259

performance_evaluation/performance_evaluator/src/metricsGenerator.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ MetricsGenerator::MetricsGenerator() {
5656

5757
metrics_pub = nh.advertise<mutac_msgs::Metrics>("performance_metrics", 100);
5858
state_sub = nh.subscribe("drone_events", 100, &MetricsGenerator::stateCallBack, this);
59-
trj_sub = nh.subscribe("planned_paths", 100, &MetricsGenerator::trajectoryCallBack, this);
59+
//trj_sub = nh.subscribe("planned_paths", 100, &MetricsGenerator::trajectoryCallBack, this);real_planned_paths
60+
trj_sub = nh.subscribe("real_planned_paths", 100, &MetricsGenerator::trajectoryCallBack, this);
6061
}
6162

6263
// Sends messages with the global metrics and the drones metrics with a frequency of 10Hz

performance_evaluation/performance_viewer/config.yaml

+14-16
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,25 @@
33
##################################
44

55
# Map image path
6-
img_path: ${MUTAC_WS}/performance_evaluation/performance_viewer/src/performance_viewer/resources/Map.png
6+
img_path: ${MUTAC_WS}/performance_evaluation/performance_viewer/src/performance_viewer/resources/solarfarm.png
77

88
# Top left corner and bottom right corner coordinates from the map
99
img_coordinates:
10-
top: [900, 55]
11-
bottom: [55, 445]
10+
top: [-13.61, 22.61]
11+
bottom: [230.75, -104.03]
1212

1313
# Points that form the region to inspect
1414
regions:
1515
area1:
16-
- [540, 345]
17-
- [635, 120]
18-
- [825, 120]
19-
- [730, 345]
20-
- [540, 345]
16+
- [-5, 8]
17+
- [58.85, 10]
18+
- [80.17, -91.83]
19+
- [22.86, -92.60]
20+
- [-5, 8]
2121
area2:
22-
- [560, 112]
23-
- [520, 232]
24-
- [480, 232]
25-
- [410, 212]
26-
- [140, 192]
27-
- [240, 112]
28-
- [560, 112]
29-
22+
- [75, 5.5]
23+
- [185, 9]
24+
- [215, -35]
25+
- [97.5, -60]
26+
- [89.58, -60]
27+
- [75, 5.5]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
##################################
2+
# Performance viewer config file #
3+
##################################
4+
5+
# Map image path
6+
img_path: ${MUTAC_WS}/performance_evaluation/performance_viewer/src/performance_viewer/resources/Map.png
7+
8+
# Top left corner and bottom right corner coordinates from the map
9+
img_coordinates:
10+
top: [900, 55]
11+
bottom: [55, 445]
12+
13+
# Points that form the region to inspect
14+
regions:
15+
area1:
16+
- [540, 345]
17+
- [635, 120]
18+
- [825, 120]
19+
- [730, 345]
20+
- [540, 345]
21+
area2:
22+
- [560, 112]
23+
- [520, 232]
24+
- [480, 232]
25+
- [410, 212]
26+
- [140, 192]
27+
- [240, 112]
28+
- [560, 112]
29+

performance_evaluation/performance_viewer/src/performance_viewer/Map.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def show_inspected_regions(self, show):
319319

320320
def subscribe(self):
321321
# Planned trajectories topic
322-
rospy.Subscriber("planned_paths", Plan, self.trajectory_callback)
322+
rospy.Subscriber("real_planned_paths", Plan, self.trajectory_callback)
323323

324324
# Lost drones topic
325325
rospy.Subscriber("drone_events", State, self.state_callback)
Loading

0 commit comments

Comments
 (0)