Code Monkey home page Code Monkey logo

trackgen's Introduction

trackgen

Tool to generate tracks quickly using curvilinear coordinates.

Usage

  1. Define an initial track:
  • define the number of track segments (straight or corner) and indicate where the corners are (defined by Boolean array);
  • define the length parameters (radius for corners, length for straights);
  • define the angle change in a corner (for corners only).
  1. Define constraints: These are all defined in the Track() object. Examples are maximum straight length, minimum/maximum radius, et cetera.
  2. Optimize the track: This will satisfy all constraints (if successful). You can decide to maximize curvature (case 0), minimize curvature (case 1), or have no objective at all and only satisfy the constraints (case 2). Case 2 is particularly useful if you are trying to generate a lot of tracks, because an initial track perturbation will likely lead to a different final track. See examples below. This is because there are usually infinitely many tracks that adhere to the constraints.
  3. Plot the track/export to something else.

Maximize curvature

Minimize curvature

Only satisfy constraints

Limitations

We are solving this problem as a continuous optimization problem, which brings with it certain limitations. Once you start with an initial track, certain parameters will not change:

  • number of straights, corners, and their order stays the same;
  • direction of a corner stays the same (i.e., the sign of the radius will not change);
  • there is no constraint to prevent the track from intersecting with itself, if that is the case, change the initial track.

Notes

  1. The track width is assumed constant, but this can easily be changed to change along the track;
  2. I started on a gradient implementation of the constraints using an adjoint. Finite differencing, however, seemed to work fine for this problem, so I shelved that for now. Let me know if you run into issues with larger problems (i.e., the tool being slow), then I will address that by a more efficient gradient implementation.
  3. If you give it a horrific initial track, the tool might not be able to find a track that satisfies the constraints. If that is the case, check your constraints and inputs! For instance, if you want the track to be right-turning and the initial guess only has left-turning corners, things will break. Or if your constraints do not define a feasible set (i.e., a long track length, but restricted to short straights and corners).

trackgen's People

Contributors

mopg avatar

Stargazers

Ernő Horváth avatar Panagiotis avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.