Git Product home page Git Product logo

fsdviewer's Introduction

fsdviewer

simple 2d viewer for formula student driverless software

This simple library was written to help the development of algorithms(slam and path planning). The idea is simple, you can add one function to your main loop, pass a list of what you want to draw and thats it.

Features

  • Draw cones(circles) in multiple colors and sizes
  • Draw Multiple Cars
  • Draw lines between cones
  • Draw lines between lines
  • Move and zoom in and out

Tutorial

Install via pip

pip3 install fsd-viewer-jpvolt

Import the library

from fsdviewer import viewer2d # import viewer
from fsdviewer.viewer2d import Car, Cone, Line, LineMiddle # import drawable objects

Create 4 lists, one for each drawable object type

conesList = []
linesList = []
middleLineList = []
carList = []

update the lists with what you want to draw

### your code 
coneList.append(Cone(color='red', x=10, y=10, size=5))

Add draw call to your main loop

### your code ...
while(true): ### your main loop
    viewer2d.draw(conesList, linesList, middleLineList, carList)

And that´s it.

Creating drawable objects

Cones

cone = Cone(color='blue', x=10, y=10, size=5))

x, y and size are in pixels units Avaliable cone colors:

  • 'blue'
  • 'yellow'
  • 'orange'
  • 'green'
  • 'black'

Lines

Lines creates lines bettween cones

line = Line(cone1=0, cone1=2, color='red',  size=5))

cone1 and cone2 are cones index in cone lists Avaliable line colors:

  • 'red'
  • 'blue'
  • 'yellow'
  • 'orange'
  • 'green'

MiddleLines

MiddleLine creates a line bettween lines

mline = MiddleLine(cone1=0, cone2=1,cone3=3, cone4=4 color='red',  size=5))

cone1, cone2, cone3, cone4 are cones index on cone list to be connected with line Avaliable line colors:

  • 'red'
  • 'blue'
  • 'yellow'
  • 'orange'
  • 'green'

Cars

car = Car(x=10, y=10, rot=0.5, color='black')

x, y are in pixels rot is the rotation of the car, in radians Avaliable car colors:

  • 'blue'
  • 'green'
  • 'blue'

fsdviewer's People

Contributors

jpvolt avatar jpvoltdev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rafael-cirino

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.