Been working on trying to better understand PID so I built a very basic version for a factory Im going to build
Most people play in as small a modpack as possible and don’t really have even such basic addons.
Overall tho it is pretty useful…
But while the blurry code on the left side of the vid is undeniably a PID, I also don’t exactly understand how it’s applicable to a plain conveyor that has no inertia (doesn’t it just instantly go to whichever RPM you set it to?..)
A somewhat more visual PID test could be using a Phys bearing from CWK or a simple bearing from Takeoff with just a stick on it
And try pointing it in different directions
Ah ok, thank you! I was showing it on the conveyor because not only do I plan on using it for CWK, I also intend to use it for a factory I had in mind. However, I understand it may have been a better idea to show it in a much more visible way.
I mean at least i don’t complain about not knowing how to code and asking for people to implement things to do it for me
Plus, at the moment im still working out the controller. The code itself was me trying to get a better idea of how it functions and testing it that way just helped.
https://discord.com/channels/244934352092397568/594132226375942154/1112374697422749726
Here’s a little sequence of messages that should give you a general understanding of what it is and how it screws you over.
Oh yeah i actually encountered that while playing around with the PID the controllers don’t like to be changed too often so i just os.sleep the program although it messes with the errors a bit but it worked kinda
local speed_controller = peripheral.find("redstoneIntegrator")
local tally = 0
local speed = 0
local tick_timer
local function every_tick()
tick_timer = os.startTimer(0.05)
while(true) do
event, timer = os.pullEvent("timer")
if timer == tick_timer then
tick_timer = os.startTimer(0.05)
if tally > 0 then
tally = tally - 1
end
end
end
end
local function main_loop()
while(true) do
local new_speed = 5 -- here is your code setting speed
if tally <= 117 then
--(we don't want to ever reach 128)
if speed != new_speed then
speed_controller.setAnalogOutput("north", new_speed)
tally = tally + 10
end
end
os.sleep(0)
end
end
parallel.waitForAny(every_tick, main_loop)
You’d actually want something that observes the rate of desired change and reduces it/puts through full rate of change depending on whether the tally is high or low
something that will basically put through increments of change depending on how high or low the tick tally is?
Yep.
os.sleep(1) (or even 0.6 which should be sufficient) basically just puts a damper on your reaction speed.
This would just make it slightly slower on fine adjustments IF it is saturated.
I’m glad. Best of luck with the future PID experiments! And may none of your bearings or speed controllers ever pop off :P
This conversation is on Discord · Reply there
