Skip to content

Commit

Permalink
part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jagheterfredrik committed Nov 11, 2024
1 parent 58385ab commit e7f64ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions common/java/ai.flow.common/transformations/Camera.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class Camera {
public static final boolean FORCE_TELE_CAM_F3 = false;

public static float
FocalX = 930f,
FocalY = 930f,
FocalX = 1930f,
FocalY = 1930f,
CenterX = 640f, //632
CenterY = 360f; //358

Expand Down
1 change: 1 addition & 0 deletions selfdrive/controls/lib/lane_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def parse_model(self, md):
if self.updateOptions <= 0:
self.updateOptions = 100
self.UseModelPath = self.Options.get_bool("UseModelPath")
self.get_camera_offset()

lane_lines = md.laneLines
edges = md.roadEdges
Expand Down
14 changes: 9 additions & 5 deletions selfdrive/ui/java/ai.flow.app/OnRoadScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ public void clicked(InputEvent event, float x, float y) {
animationSunset = GifDecoder.loadGIFAnimation(Animation.PlayMode.LOOP, Gdx.files.internal("gifs/sunset.gif").read());
animationNight = GifDecoder.loadGIFAnimation(Animation.PlayMode.LOOP, Gdx.files.internal("gifs/night.gif").read());

getLaneOffset();

sh = new ZMQSubHandler(true);
sh.createSubscribers(Arrays.asList("lateralPlan", cameraTopic, cameraBufferTopic, deviceStateTopic, calibrationTopic, carStateTopic, controlsStateTopic, modelTopic, "roadCameraBuffer", "roadCameraState"));
}
Expand Down Expand Up @@ -770,16 +772,18 @@ public void resize(int width, int height) {
stageSettings.getViewport().update(width, height);
}

private float getLaneOffset() {
private float laneOffset = 0.08f;

private void getLaneOffset() {
try {
return Float.parseFloat(params.getString("LaneCameraOffset"));
laneOffset = Float.parseFloat(params.getString("LaneCameraOffset"));
} catch (NumberFormatException exc) {
return 0.08f;
laneOffset = 0.08f;
}
}

private void shiftLaneOffset(float delta) {
float laneOffset = getLaneOffset();
getLaneOffset();
laneOffset += delta;
params.put("LaneCameraOffset", Float.toString(laneOffset));
}
Expand Down Expand Up @@ -841,7 +845,7 @@ public void render(float delta) {
appContext.font.setColor(1, 1, 1, 1);
appContext.font.draw(batch, "L1: " + Line1 + "\nL2: " + Line2,3,200);
appContext.font.draw(batch, utils.F2 ? "Medium Model" : "Big Model", Gdx.graphics.getWidth() - 450f, 300f);
appContext.font.draw(batch, "COff: " + getLaneOffset(), Gdx.graphics.getWidth() - 450f, 225f);
appContext.font.draw(batch, "COff: " + laneOffset, Gdx.graphics.getWidth() - 450f, 225f);
appContext.font.draw(batch, tempStr + ", " + ModelExecutorF3.AvgIterationTime + "ms", Gdx.graphics.getWidth() - 450f, 150f);
appContext.font.draw(batch, IPstring, Gdx.graphics.getWidth() - 450f, 75f);
batch.end();
Expand Down

0 comments on commit e7f64ef

Please sign in to comment.