]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/commitdiff
Make init and goal parts of first and last segments
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Sun, 19 Mar 2023 21:35:21 +0000 (22:35 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 20 Mar 2023 10:10:14 +0000 (11:10 +0100)
rrts/src/rrts.cc

index dcf8dedd35ae43c32052eb11a985f14d55e8a1a5..39b351687cb0a3d70b24c308ce867dd70a64ed01 100644 (file)
@@ -457,6 +457,13 @@ RRTS::json(void) const
                        }
                        i++;
                }
+               // Initial point is part of the first segment.
+               jvo["paths"][j][0][3] = jvo["paths"][j][1][3];
+               jvo["paths"][j][0][4] = jvo["paths"][j][1][4];
+               // Goal point is part of the last segment.
+               jvo["paths"][j][i - 1][3] = jvo["paths"][j][i - 2][3];
+               jvo["paths"][j][i - 1][4] = jvo["paths"][j][i - 2][4];
+               // --
                jvo["costs"][j] = path.back().cc();
                j++;
        }
@@ -480,8 +487,14 @@ RRTS::json(void) const
                }
                i++;
        }
+       // Initial point is part of the first segment.
+       jvo["path"][0][3] = jvo["path"][1][3];
+       jvo["path"][0][4] = jvo["path"][1][4];
+       // Goal point is part of the last segment.
+       jvo["path"][i - 1][3] = jvo["path"][i - 2][3];
+       jvo["path"][i - 1][4] = jvo["path"][i - 2][4];
+       // --
        jvo["costs"][j] = this->_path.back()->cc();
-       j++;
        jvo["goal_cc"] = this->_goal.cc(); // TODO remove, use the following
        jvo["cost"] = this->path_cost();
        jvo["time"] = this->scnt();