Skip to content

Commit

Permalink
Merge pull request #2711 from JdeRobot/adding-follow-line-ackermann
Browse files Browse the repository at this point in the history
Follow Line Adding Ackermann scalings and universes
  • Loading branch information
javizqh authored Sep 12, 2024
2 parents 8dd6666 + 649bc18 commit ceb4cb6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Binary file modified db.sqlite3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const SpecificFollowLine = (props) => {
setLapTime(null)
switch (context.mapSelected) {
case "follow_line_default_ros2":
circuitName = "simple";
circuitName = "default";
setCircuitImg(defaultCircuit);
break;
case "follow_line_montmelo_ros2":
Expand All @@ -79,7 +79,23 @@ const SpecificFollowLine = (props) => {
setCircuitImg(montrealCircuit);
break;
case "follow_line_nurburgring_ros2":
circuitName = "nürburgring";
circuitName = "ngb";
setCircuitImg(ngbCircuit);
break;
case "follow_line_default_ack_ros2":
circuitName = "default ack";
setCircuitImg(defaultCircuit);
break;
case "follow_line_montmelo_ack_ros2":
circuitName = "montmelo ack";
setCircuitImg(montmeloCircuit);
break;
case "follow_line_montreal_ack_ros2":
circuitName = "montreal ack";
setCircuitImg(montrealCircuit);
break;
case "follow_line_nurburgring_ack_ros2":
circuitName = "ngb ack";
setCircuitImg(ngbCircuit);
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
export const getCarPose = (circuit, position) => {
var scaleX, scaleY, offsetX, offsetY;
let ackUniverse = circuit.includes("ack")
let ackMultiplier = 1;
let pose = position.substring( 1, position.length - 1);
let pos = pose.split(",").map(function (item) {
return parseFloat(item);
});

if (ackUniverse) {
circuit = circuit.replace(" ack","")
ackMultiplier = 3
}

switch (circuit) {
case "simple":
case "default":
scaleY = 1.25; offsetY = 77
scaleX = -2.6; offsetX = 151
break;
Expand All @@ -19,7 +26,7 @@ export const getCarPose = (circuit, position) => {
scaleY = 0.685; offsetY = 77
scaleX = -0.48; offsetX = 151
break;
case "nürburgring":
case "ngb":
scaleY = 1.5; offsetY = 77
scaleX = -1.495; offsetX = 151
break;
Expand All @@ -29,8 +36,8 @@ export const getCarPose = (circuit, position) => {
break;
}

var x = Math.round(pos[0]) * scaleX + offsetX;
var y = Math.round(pos[1]) * scaleY + offsetY;
var x = Math.round(pos[0]) * scaleX / ackMultiplier + offsetX;
var y = Math.round(pos[1]) * scaleY / ackMultiplier + offsetY;

return [x,y];
};

0 comments on commit ceb4cb6

Please sign in to comment.