r/ComputerCraft

▲ 197 r/ComputerCraft+1 crossposts

Hello community,

I made this relatively basic robotic autopilot for my create airship for create aeronautics. You can find the link to the code here. It works pretty decent allowing the 120-odd long airship to end up always within 20 blocks and 20 degrees of the desired pose. Also keeps itself stable to within like 0.2 degrees

Pathfinding is implemented through using dubin's paths which allow vehicles that can only travel forward and turn to end up at any desired point in 2d space (x,y,orientation) through the shortest path possible. Some considerations are that Dubin's original paper required the points to be distinct, so for example 0,0,0 to 0,0,0 is mapped to a circular path when the shortest path in reality the correct choice would just be to not move.

Heres a link to a decent more in depth explanation https://gieseanw.wordpress.com/2012/10/21/a-comprehensive-step-by-step-tutorial-to-computing-dubins-paths/

Heres a desmos calculator which is a more visual way to play around with the paths (and is also the math the code implements) https://www.desmos.com/calculator/vbocmzun5r

Actual control is implemented using a stanley control which comes from SAIL labs 2005 winning submission for DARPA autonomous car race. Lowkey it does not work that well as the airship has way too much inertia and "drifts" and I should've just stuck with pure pursuit so I might change it. I don't have any experience in UAVs really so if anyone has better ideas (or better yet pull requests) for control I'm happy to hear (merge) those

link to stanley control paper https://ai.stanford.edu/~gabeh/papers/hoffmann_stanley_control07.pdf

I had claude make a little simulation which works sorta well to display how a blimp might behave under certain config values which hopefully makes it easier to understand how to mess with config values for your airship to make it actually work.

Additionally, the code also has a stabilization PID controller, relatively straight forward.

Code is still somewhat cooked. You need basalt for UI (I'm not a good UI designer). Also I was trying to figure out how to get it to display a map on the screen with the path that was being followed but lowk couldn't get it to work.

Code is located at this repository https://github.com/catmajor/Autonomous-Autopilot (please feed me stars for my github clout)

This was my first time touching CC/lua so theres some work to be done refactoring wise (did not realize there was a native vector class)

If you want to use it you'll need to clone it and copy it to a computer in your game. Your vehicle will (very likely) need to be tuned, and most definetly will need to be configured for the specific control peripherals. (Also make sure to install basalt if you want to use the gui) The needed values are in config.lua, and most of the update logic is in flight_controller.lua. Also, I am using CC: Sable for positioning because CC's gps is kind of innacurate but you can use it and if you do so you'll need to change code in gps.lua. You'll typically want to set your min turn radius to be a bit bigger than your actual min (the more the better usually). The stanley_k / front axle variable really depends on how much inertia your vehicle has.

u/Donut_101 — 10 days ago

Need ideas for package manager.

Im working on simple package manager for computercraft.. I would like to hear some ideas on what I should add...

github.com
u/Olivierus303 — 8 days ago
▲ 113 r/ComputerCraft+1 crossposts

PID-stabilized quadcopter :3

It stabilizes height, x and z angles through the gimbal sensor and the y angle (heading) with auxiliar motors on the side. Now i want to make an autopilot however i have not figured out yet how to get the current ship coordinate. Anyways here's the source code :)

u/Mega2223 — 4 days ago

CC:Zombies! Version: 0.6

First time ever making a post advertising a project of mine, so im just gonna keep it short and simple.
CC:Zombies is basically a de-make of classic CoD zombies to CC:Tweaked. It currently has two maps bundled in the installer, with more on the way.

  1. Nacht Der Untoten (No EE)
  2. Nuketown 1975 (+ a small easter egg)

Right now, it has:
Singleplayer
Doors
Points System, both bo2 and bo6 (change your preferance in settings)
Fully working settings menu (Minus FOV)
Keybind readjustion
Mystery Box
8 working perks (theres not 8 perks in each map, though.)
Effecient(ish) rendering systems
Experimental Modding support.
The ability to change map colors & add/remove blocks in the middle of the game.
Press ] to play the easter egg song on maps that dont have an EE song quest! (At the moment, no map has an EE song quest, so this applies to all.)
Nacht Der Untoten's EE Song: Undone
Nuketown 1975's EE Song: Come Back Down

What it DOESNT have.
Multiplayer (Will be coming in the form of a mod)
Drops system
Balance (Some guns are OP. will be fixed by the time 1.0 comes around.)

Updates are.. kinda rare? ish?

Planned updates are 0.6.5, 0.7, 0.8,0.9,1.0

0.6.5 will be adding multiplayer, bug fixes, and removing bad code.

Found at https://pinestore.cc/projects/228/cc-zombies-0-6-updated-

https://preview.redd.it/xyigisbrrfzg1.png?width=658&format=png&auto=webp&s=af5645bff6ddb0d79dc84e241a642b7e7d4a6353

https://preview.redd.it/vrqfej2mrfzg1.png?width=669&format=png&auto=webp&s=0f65423eb99fb3f23724859f7ab8cf48a674043f

https://preview.redd.it/ur2w5rhnrfzg1.png?width=658&format=png&auto=webp&s=c12d929bc534889045c7193e02aaf0d3026f210c

https://preview.redd.it/uhs5rzucrfzg1.png?width=662&format=png&auto=webp&s=4264ce33a5732b569a315e75c87d04a896e8c8a0

reddit.com
u/Dull-Experience-2670 — 9 days ago
▲ 82 r/ComputerCraft+1 crossposts

I'm trying to make my own implementation of MQTT inside CC!

You can connect to a broker, publish to topics, and subscribe to them! Also a timeout system to make sure it doesn't infinitely remember computers and keep sending data.

It doesn't have any way to actually make sure it received messages, so I need to add that to make it more consistent.

Also, the mqtt.lua library for the clients is automatically downloaded from the broker computer for easy updating!

u/IJustAteABaguette — 6 days ago

reading peripheral takes a tick?

is this right? i'm trying to read the fluid contents of two tanks, but i just noticed that when i do that, my program starts only being able to execute every other tick... and if i add a third, it only executes every 3 ticks. is there anything i can do to make this only take one tick? could i do these reads in parallel, somehow, and then store the results for use in the main program?

reddit.com
u/AmberGoop — 4 days ago