Git Product home page Git Product logo

konics's Introduction

konics

This is an autocross simulation engine for MIT AFSAE. For most users, you should run konics using Docker to ensure consistent behavior. On the other hand, if you need every bit of performance, this should work out-of-the box on macOS and Windows 10; if you use some other OS, you will need to compile POV-Ray yourself and make sure the povray binary can be found on your PATH.

Note: The new proton rendering engine is much, much faster than povray. However, it doesn't run on headless servers yet and is highly experimental. If you want to try it out, run the proton app in the experimental directory. See this YouTube video if you run into problems setting it up. Note that if you are doing deep learning on the GPU, you may want to run this with --blacklist-accelerated-compositing --blacklist-webgl so it doesn't use your discrete GPU.

setup

Let's break down the below commands. First we pull the latest build of konics from the Docker Hub - if it says not found, that's probably because it's private and you should email me for access. Next we run the container with the -p flag which passes port 8888 in the image (jupyter) to port 8888 on our local machine. We also add a shared volume using the -v flag so that our current directory is available inside the machine as /host.

docker pull kevz/konics:v2
docker run -it -p 8888:8888 -v $(pwd):/host kevz/konics:v2

If you want to get back to basics, you can always run docker run -it kevz/konics:v2 bash and do linux-y things, just for fun. The konics library is on the PYTHONPATH so you should be able to import it from any script.

usage

Now that we have the latest and greatest version of konics, let's try importing the Drive object which provides a car-like interface for moving through the simulated world and the make_wt helper function which makes it easy to dynamically generate a world and track from a map id.

  • Note: Another option is to import the World and Track objects and manually construct a world by dynamically importing the map that you want. However, since dynamic imports are tricky and annoying to use, we provide this helper method for loading the 12 built-in maps. *
from konics.core import Drive
from konics.utils import make_wt

We make a world-track tuple from map "alfa" - see letters A-L in the NATO phonetic alphabet for the other map ids - and then create a Drive object for moving around in our new world. We also get the pose/position at time 0 for the track and move our driver there.

  • Note: The time parameter as used in the parametric equations is independent of the actual time it takes to drive around a track. One is a mathematical convenience, the other is how you win. *
world, track = make_wt("alfa")
drive = Drive(world)
drive.set_pose(track.get_pose(0.0))

Now that our world is ready and our driver is in place, we can start driving through the track. The below code alternates between turning slightly left and right, driving forwards and taking pictures after each movement.

from scipy.misc import imsave

drive.move(0.1)
for i in range(10):
    imsave(str(i) + ".png", drive.render())
    drive.move(-0.2 if i % 2 == 0 else 0.2)

The end.

konics's People

Contributors

k15z avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.