Smart Dots, version 0.2 – Orbit Point, Improved PID Control

In this update, I was confusing myself with (0,0) being in the upper left corner of the screen, so I changed it so that (0,0) is at the center.  No noticeable effect on the actual sim, but makes thinking about angles and things a little easier (for me).  I also implemented the orbit point functionality – pretty easy because it uses the already created MoveToPoint function.  I wanted to make the dots automatically space themselves evenly out along the orbit by speeding up if there is a dot close behind or slowing down if another dot is close in front, but couldn’t get it to work very well, so left that bit commented out.

I also redid MoveToPoint to be a better example of a PID controller.  (I tried to implement the diagram found here, fig 6.7.)  The gains now are set good enough for the default max velocity and acceleration; probably would need retuning if those are changed.

Download: smartdots_v0.2.zip.  Prerequisites are Python and Pygame.  Main script to run is smartdots.py.  Controls are listed in the status area above the dot box; also run with the -h option to see all other command line options.

I’m not really sure where smart dots will go from here.  “Avoid obstacles” is unimplemented, but after that I’m kind of out of ideas.  It’s not really a game… I guess the “game” portion of this project was for me getting the dots to do what I want them to – it was kind of fun watching them move and orbit a point.  (If you turn on orbit point, then move the action point around, there is some interesting behavior as the dots move while rotating…)  But for now “development” on Smart Dots will probably be on hold, unless I can think of somewhere to go with it.

Advertisements

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: