Well that horizontal tracking can be fixed by adding input "Tfinder" and wire it to the Target finder and then add line:
Tfinder == 0 -> Thrust = 0;
And for that elevation, im not sure how elevation works.
This is my first expression chip. The little bit of programming knowledge knowledge let me start this off without too much problems, but then I get snagged on debugging. Never was my strong suit.
I was making a chip for a 3 tier tracking platform.
Here is my code:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>N@ Tracking Chip
I@ Bearing Elevation
O@ Thrust Length
#Horizontal Tracking
If Bearing > 0 -> Thrust = 1;
If Bearing < -1 -> Thrust = -1;
If Bearing = 0 -> Thrust = 0;
#Vertical Tracking
If Elevation < 0 -> Length = 5
If Elevation > 0 -> (Length = floor(Elevation) + 50);</div>
Here are the problems I seem to be having:
For Horizontal Tracking, as long as it has a target, it tracks perfectly. As soon as it looses its target however, it's giving the thrusters a value of 1 and it just spins in place until a new target is found. I originally added third horizontal tracking line to fix this, but it didn't do anything. Not sure what is wrong with it.
For Vertical Tracking, as soon as the target is above 0, it gets the elevation of the target, but kind of jumps up and down a bit like the hydraulic length is varying by a few numbers. I also have no idea what is going on there either.
Any help would of course be greatly appreciated.
Well that horizontal tracking can be fixed by adding input "Tfinder" and wire it to the Target finder and then add line:
Tfinder == 0 -> Thrust = 0;
And for that elevation, im not sure how elevation works.
Righto I'll try that thank you.
The only reason I added 50 to the elevation to begin with is because it tracks people's feet, adding 50 puts it to about chest level...
Though I suppose if I can't fix it I can just let it track the feet...
Lol it didn't work.
I looked at all the lines again and they make sense, not sure why they don't work.
I hooked up screens to the chip to see what values it was giving off, and they are giving off the right values I want. The thing is, the thrusters and hydraulic aren't reflecting those values. >.>
I've been playing around with it and I haven't gotten anywhere.
If anybody has any other ideas that would be excellent. >.>
Well, for that elevation if you add 50 to it and some guy goes far away from the turret it will just fire over them, so you need to calculate the distance using the elevation and distance of the target, check -orb- 's perfect hs turret tutorial, also for the bearing you could use delta, orb has also tutorial on that. And one think i have to note: when you post you get an "Edit" Button as extra.![]()
I'll check that out thanks.
I'm still figuring out how to apply all these concepts to make a working chip. >.>
Edit: I actually watched the video on the smart turret, and I should be able to code that in no time. Thanks for the help.
Now I've gotten the horizontal to work perfectly thanks to some new coding, but using an accumulator for the vertical, my chip is giving out a constant value of 1 for reset, rendering the accumulator, useless.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>@N Vertical
@I Accum
@O Reset
#Vertical
If Accum < 0 -> Reset = 1;
If Accum > 75 -> Reset =1;
If Accum > 0 & Accum < 75 -> Reset = 0;</div>
That gives out a constant value of 1 for reset for some reason, no matter what the value of the accumulator is. The accumulator being connected to the elevation of a beacon sensor.
Sorry for the trouble people. >.>
"If" is unnecessary and has no purpose.
Have you tried simply connecting a constant with a value between 0 and 75? and see if it works? Because if you are using an accumulator it is very possible that it accumulates quicker than what the debugger updates, and all you see is reset all the time.
And although it doesn't really matter, you forgot the case where Accum is equal to 0 or 75.
Code:@N Vertical @I Accum @O Reset Reset = 1; Accum > 0 & Accum < 75 -> Reset = 0;Are two shorter ways of coding the same thing.Code:@N Vertical @I Accum @O Reset Reset = Accum < 0 | Accum > 75
Thanks so much.
I wasn't expecting help from -the- expression gate person.
Though, why wouldn't "If" be needed in that particular case if you don't mind me asking.
Bookmarks