Skip to content

Python script to export user-selected or randomly generated waypoints into CSV format.

Notifications You must be signed in to change notification settings

winstxnhdw/WaypointGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Waypoint Generator

A simple python script to export generated waypoints into a CSV file. Waypoints can either be user-selected or randomly selected.

Table of Contents

Installation

Install dependencies

pip install matplotlib

Optional install for circular waypoint generation

pip install numpy

Usage

# Run the script
$ python main.py <flag> <value>
Optional arguments:
  -h, --help                  show this help message and exit
  -r, --random                generates a user-selected amount of random waypoints
  -c, --click                 generates user-selected waypoint positions   
  -z, --three-dimensional     allows user to change the z-axis of a created waypoint
  -s, --scroll-sensitivity    sets the scroll sensitivity of the mouse when setting the z-axis

Press Z to undo a selected waypoint or revert to a previously generated set of waypoints.

Press X to clear selected waypoints or to generate a new set of randomly generated waypoints.

Press C to connect the last and first waypoints.

Scroll to increase the z-axis of the waypoint if the --three-dimensional flag is used.

Scroll to decrease the z-axis of the waypoint if the --three-dimensional flag is used.

Generated waypoints are only exported at exit.

User Selected Waypoints

$ python main.py -c
$ python main.py -c -z --scroll-sensitivity 1

Randomly Generated Waypoints

The generated waypoints are passed piecewise through an algorithm that ensures that each line segment never intersects with each other.

$ python main.py -r <number-of-waypoints>

Circular Generated Waypoints

circle_wp_gen.py is a CLI script for generating waypoints of a certain radius and smoothness. The user can choose to define smoothness with point density or the angle between every point.

$ cd circle
$ python circle_wp_gen.py -a <x-radius> -b <y-radius>
Optional arguments:
  -h, --help       show this help message and exit
  -a, --xradius    radius of an ellipse on the x-axis
  -b, --yradius    radius of an ellipse on the y-axis 

The numpy library is required to run this script.

Additional Information

Exported waypoints can be imported using the pandas or csv module.

pandas module example

from pandas import read_csv

df = read_csv('waypoints.csv')
x = df['X-axis'].values
y = df['Y-axis'].values

csv module example

import csv

with open('waypoints.csv', newline='') as f:
    rows = list(csv.reader(f, delimiter=','))
    x, y = [[float(i) for i in row] for row in zip(*rows[1:])]