Map Format
Maps can be provided in YAML, XML or via callbacks. The prefered file format is XML. YAML is supported for backwards compability.
XML Format
Each road segment is specified with a “way” tag (i.e., <way> </way>). Each waypoint in the road segment is specified with an nd tag, defining x, y and theta of the waypoint.
To define roads along these set of waypoints each way tag should have one or more lane tags that define what type of road are present along the given waypoints. The lane tag has the following properties
typeDefines the type of this lane. Options:
roadorsidewalk.widthWidth of the lane in meters.
two_wayCreates a lane on both sides of the road segment if set to
1.0.
The following example code further illustrates the XML map format.
<?xml version="1.0" encoding="UTF-8"?>
<way>
<nd x="-10" y="0" theta="0"/>
<nd x="20" y="0" theta="0"/>
<nd x="30" y="0" theta="0"/>
<nd x="40" y="0" theta="0"/>
<nd x="50" y="10" theta="1.5708"/>
<nd x="50" y="30" theta="1.5708"/>
<nd x="50" y="100" theta="1.5708"/>
<lane type="road" width="4.0" two_way="1"/>
<lane type="sidewalk" width="2.0" two_way="1"/>
</way>
<way>
<nd x="44" y="30" theta="0."/>
<nd x="58" y="30" theta="0."/>
<lane type="crosswalk" width="2.0" two_way="0"/>
</way>
This code generates the following roadmap (Large red cubes denote the input waypoints).
Example roadmap.
YAML Format
The YAML format defines under global_path the x, y and theta as a vector and assumes that the road consists of a road with sidewalks.
An example in the YAML format is given below.
global_path:
x: [7.895972, 7.881607, 7.758807, 7.569584, 7.310801, 6.982501, 6.504322, 6.061651, 5.441044, 4.915406, 4.288904, 3.644696, 3.080289, 2.494215, 1.853787, 1.232112, 0.626144, -0.017747, -0.641883, -1.305144, -1.918638, -2.565948, -3.165801, -3.753398, -4.354930, -4.865262, -5.512772, -6.023556, -6.675223, -7.231330, -7.820451, -8.413261, -9.021603, -9.642767, -10.305252, -10.919902, -11.547425, -12.232014, -12.872225, -13.578660, -14.217835, -14.905883, -15.547168, -16.232174, -16.880021, -17.526835, -18.213366, -18.889320, -19.515706, -20.149861, -20.742684, -21.414105, -22.068189, -22.823415, -23.664820, -24.759402, -25.955933, -27.299237, -28.711305, -30.285176, -31.848696, -33.375894, -34.919968, -36.503307, -38.010682, -39.589457, -41.169666, -42.663610, -44.196368, -45.711929, -47.215337, -48.705459, -50.059309, -51.374370, -52.465865, -53.408030, -54.121254, -54.557081, -54.742163, -54.664467, -54.340954, -53.846254, -53.274154, -52.622911, -51.959258, -51.280255, -50.578179, -49.896681, -49.194859, -48.492858, -47.822563, -47.117584, -46.451629, -45.746581, -45.108351, -44.416892, -43.794390, -43.110434, -42.488638, -41.822707, -41.199815, -40.512481, -39.899951, -39.256519, -38.649045, -38.001051, -37.392569, -36.742914, -36.139318, -35.492667, -34.863249, -34.191749, -33.560894, -32.889992, -32.261069, -31.644488, -30.955000, -30.279210, -29.684644, -29.045921, -28.421155, -27.816132, -27.051766, -26.181997, -25.064462, -23.979239, -22.704088, -21.356169, -19.870098, -18.484056, -16.985976, -15.567901, -14.108047, -12.691748, -11.286748, -9.883437, -8.479849, -7.072716, -5.644651, -4.236779, -2.848677, -1.462160, -0.143345, 1.109374, 2.221674, 3.129969, 3.821414, 4.227484, 4.365739, 4.254160, 3.957025, 3.553861, 3.095938, 2.556500, 2.020227, 1.478947, 0.894843, 0.294044, -0.305016, -0.925851, -1.561813, -2.183928, -2.810882, -3.466887, -4.088609, -4.761114, -5.369002, -6.015489, -6.629123, -7.285021, -7.932153, -8.576398, -9.245398, -9.907652, -10.528458, -11.145881, -11.754477, -12.360879]
y: [-12.907369, -12.846733, -12.590434, -12.174398, -11.587226, -10.821759, -9.702180, -8.648991, -7.151203, -5.938694, -4.414332, -2.882325, -1.497578, -0.075970, 1.469404, 2.947703, 4.385203, 5.934238, 7.392343, 8.917711, 10.347990, 11.854688, 13.274039, 14.674856, 16.126339, 17.353141, 18.917269, 20.149444, 21.723573, 23.075288, 24.486413, 25.913686, 27.371246, 28.836526, 30.406602, 31.855986, 33.321135, 34.923397, 36.391934, 38.010117, 39.503106, 41.124918, 42.667544, 44.294108, 45.827957, 47.339593, 48.966720, 50.542586, 51.995948, 53.520840, 54.911760, 56.336384, 57.641052, 58.964210, 60.136437, 61.167794, 61.887614, 62.462901, 62.753387, 62.761354, 62.579125, 62.246071, 61.762561, 61.183375, 60.597692, 59.961227, 59.296748, 58.600545, 57.913169, 57.245964, 56.568227, 55.917662, 55.219578, 54.370206, 53.414385, 52.290712, 51.081000, 49.737543, 48.303020, 46.777880, 45.225130, 43.622841, 42.067906, 40.398340, 38.742629, 37.097939, 35.432920, 33.737301, 32.079364, 30.460314, 28.887174, 27.236404, 25.679857, 24.018882, 22.517725, 20.862055, 19.371051, 17.733224, 16.233616, 14.629551, 13.160789, 11.574699, 10.152131, 8.614113, 7.199723, 5.674939, 4.253050, 2.737804, 1.271422, -0.257707, -1.743149, -3.324924, -4.779781, -6.366467, -7.876818, -9.339471, -10.956695, -12.532133, -13.977207, -15.522356, -17.001398, -18.191815, -19.527272, -20.605756, -21.690863, -22.425210, -23.009691, -23.207715, -23.134838, -22.913223, -22.423652, -21.915425, -21.421893, -20.846512, -20.253006, -19.675098, -19.087715, -18.494825, -17.891832, -17.305349, -16.740058, -16.146343, -15.509331, -14.725874, -13.860937, -12.835272, -11.641438, -10.364973, -9.023874, -7.645771, -6.253082, -4.886960, -3.541236, -2.145182, -0.693320, 0.729180, 2.199077, 3.674576, 5.138225, 6.615887, 8.105207, 9.594927, 11.072049, 12.604297, 14.018815, 15.523186, 16.941003, 18.534936, 20.021780, 21.619208, 23.174120, 24.709016, 26.272264, 27.837415, 29.346058, 30.845182, 32.331474, 33.802325]
theta: [1.976592, 1.976661, 1.977063, 1.978404, 1.977202, 1.975206, 1.973670, 1.972211, 1.969555, 1.970376, 1.977030, 1.983167, 1.985302, 1.986495, 1.988274, 1.989324, 1.990275, 1.990957, 1.991062, 1.991651, 1.989041, 1.984532, 1.981047, 1.980564, 1.978895, 1.978096, 1.976545, 1.975738, 1.974594, 1.974646, 1.974708, 1.975704, 1.977872, 1.978285, 1.977752, 1.977733, 1.977669, 1.978373, 1.979540, 1.979137, 1.977930, 1.976310, 1.974508, 1.972336, 1.970282, 1.969267, 1.971953, 1.972397, 1.971344, 1.970536, 1.970450, 1.978253, 2.022145, 2.122578, 2.263732, 2.436774, 2.629764, 2.831719, 3.024206, -3.092183, -2.963427, -2.871036, -2.806881, -2.772771, -2.761498, -2.755258, -2.745092, -2.739105, -2.736031, -2.733377, -2.731443, -2.708985, -2.635000, -2.503661, -2.357213, -2.196946, -2.005941, -1.804488, -1.612850, -1.437823, -1.313993, -1.240058, -1.203946, -1.191947, -1.182254, -1.170001, -1.167626, -1.167596, -1.166440, -1.166071, -1.164719, -1.162029, -1.159899, -1.159666, -1.161747, -1.164620, -1.166206, -1.168584, -1.170028, -1.168662, -1.167221, -1.166933, -1.166756, -1.165446, -1.164942, -1.163880, -1.164689, -1.167036, -1.167176, -1.167812, -1.168093, -1.168339, -1.168450, -1.168755, -1.170397, -1.171183, -1.171467, -1.172268, -1.173929, -1.174118, -1.161694, -1.115923, -0.998522, -0.842046, -0.639541, -0.448633, -0.241695, -0.059174, 0.096696, 0.201206, 0.279522, 0.335781, 0.368203, 0.381145, 0.387306, 0.391684, 0.393298, 0.392281, 0.390682, 0.388856, 0.392202, 0.422978, 0.489962, 0.607114, 0.775286, 0.956017, 1.160395, 1.368590, 1.559796, 1.720720, 1.826745, 1.887088, 1.912025, 1.923787, 1.937414, 1.950897, 1.960132, 1.967585, 1.974220, 1.977774, 1.980751, 1.982069, 1.982655, 1.983213, 1.983264, 1.981003, 1.979489, 1.979950, 1.980934, 1.981972, 1.981534, 1.982406, 1.983267, 1.979900, 1.976551, 1.974448, 1.974374, 1.978689]
Callbacks
Waypoints can be supplied by a callback through ROS via a nav_msgs Path message. The road around the waypoint is assumed to be a two-way road with 4m width and a two-way sidewalk with 2m width.
The topic to listen to can be set in settings.yaml.
An example callback is given below:
void WaypointsCallback(const nav_msgs::Path &msg)
{
int waypoint_count = 0;
theta_.clear();
x_.clear();
y_.clear();
for (size_t i = 0; i < msg.poses.size(); i += 2)
{
theta_.push_back(RosTools::quaternionToAngle(msg.poses[i].pose));
x_.push_back(msg.poses[i].pose.position.x);
y_.push_back(msg.poses[i].pose.position.y);
waypoint_count++;
}
// Load points into an object
if (external_waypoints_callback_)
(controller_->*external_waypoints_callback_)();
}