Jump to content

Cheif Operations Director

Members
  • Posts

    1,633
  • Joined

  • Last visited

Everything posted by Cheif Operations Director

  1. First I can not call this again I need a variable in the range does something x times and not for x seconds Simplification plus it was a repeat of the code for the same sensor I may change it to input1 input 2 etc Let me try making it a function with a variable
  2. Because I may only need the code to check its sensors for 2 seconds
  3. I've done that before not a problem I could always do while time.clock()<b: print("Hello World") time.sleep(0.10) Let me run it
  4. I should be more specific def function1(b) while time.clock()<b: print("Hello World") function1(2) #this means that this will print hello world until time is in excess of 2 seconds. In python two I had a bug where I could call the function again after the first call but it would not do anything I suspect (on a conjecture) it was because of some sort of memory problem.
  5. Ok cool. Out of curiosity do you know if this is a way to do "time.clock()<b" after python 3.2? That this did in python 2 was have a clock counting infinitely until it was greater than the b value then it stopped. This way I had a de facto timer.
  6. Ok heres what going to happen. Im going to learn python to an intermediate level. If it does not do what I want to which seems likely I will learn C. Which IDE is best for learning C
  7. Is it possible to use the new suits without using the neon lights?
  8. A one ton guided missile lol. In all seriousness I will try to use some of those compressed air canisters you use for dusting computers. Obviously not those specifically but something like that. Something in Principle similar to this: To begin with the flight of my rocket will first look something like the one below but just have a gravity turn and be bigger. And to answer your question the reason im not learning C yet is because many people have told me that Python is easier to learn. Furthermore I do not know anybody in person who can code in C but I do know people who can code in Python. Part of the reason Quick note: Im thinking and doing research on it now on weather using 3D printed parts may be cheaper, stronger, and easier to use. Im still looking into it.
  9. #Constant Variables T1 = 2 a = 0 #---------------Import Section import time import timeit #---------------Class Section class Calculator: def addition (x,y): add = x+y print(add) def subtraction (x,y): sub = x-y print(sub) def multiplication (x,y): mult = x*y print(mult) def division (x,y): div = x/y print(div) #--------------Functions #---Math def add1(x,y): Calculator.addition(x,y) def sub1(x,y): Calculator.subtraction(x,y) def mutl(x,y): Calculator.multiplication(x,y) def div(x,y): Calculator.division(x,y) def repeatingchecks(b): while time.clock()<b: voltage4(0) voltage3(0) voltage2(0) voltage1(0) #---Engine Control def RME(A1): Temp #---------------Flight Code Section Secondary a = 0 def voltage1(b1): global c1 c1 = b1 + 0 if c1 > a: print("Activate Response 1") print("The Value of Voltage +", c1) #Open RCS Valve Code elif c1==0: print("No Excessive Aerodynamic Forces sensor1") pass #---Sensor 2 a = 0 def voltage2(b2): global c2 c2 = b2 + 0 if c2 > a: print("Activate Response 2") print("The Value of Voltage +", c2) #Open RCS Valve Code elif c2==0: print("No Excessive Aerodynamic Forces sensor2") pass #---Sensor 3 a = 0 def voltage3(b3): global c3 c3 = b3 + 0 if c3 > a: print("Activate Response 3") print("The Value of Voltage +", c3) #Open RCS Valve Code elif c3==0: print("No Excessive Aerodynamic Forces sensor3") pass #---Sensor 4 a = 0 def voltage4(b4): global c4 c4 = b4 + 0 if c4 > a: print("Activate Response 4") print("The Value of Voltage +", c4) #Open RCS Valve Code elif c4==0: print("No Excessive Aerodynamic Forces sensor4") pass #---------------Primary Code Section repeatingchecks(2) TT = 1 time.sleep (TT) print("Hello World") I have more things that will be programs then that. The latest version this works as intended is Python 3.2.8. Does anyone have an alternative to time.clock() ?
  10. It will turn a motor which will open a valve that releases pressurized gas from a tank to counter the wind. This is pretty much KSPs SAS + RCS dumbed down Not sure how to code that I need more experience on the software end of things first.
  11. def repeatingchecks(b): while time.clock()<b: voltage4(0) voltage3(0) voltage2(0) voltage1(0) This works in python 2 but not in python 3.3 anyone know the alternatives im trying to fix it now but not a lot of success
  12. If you offset the sensors inside the rocket or put a "cup" or cone spthing around it will deflect the air I think I have a soltuion I tried using time.clock and it worked using python 2 I'm going to need to convert it to python 3
  13. I guess I need a way of creating a subgroup of sorts where this function can operate and print it's result outside of the subgroup
  14.  But you told it to! Yes I did but the whole point of putting it into a callable function was to make it run infinitely in the background. This program need to be able to run that loop and check to ensure the system is working ASWELL as run the rest of the code.
  15. You could get a digital one right? Also these sensors are simply to test if wind is hitting the rocket.
  16. def repeatingchecks(): time.sleep(T1) while 1>0: time.sleep (T1) voltage4(1) voltage3(0) voltage2(0) voltage1(0) When I call "repeatingchecks()" it still gets me stuck in a loop If you said something feel free to post it
  17. I shalt never disregard a piece of possibly useful information! Lol
  18. T1 = 0.25 while 1>0: time.sleep (T1) voltage4(1) voltage3(0) voltage2(0) voltage1(0) This seems to resolve the issue but im not sure if it takes up more or less ram is their a way to check and sorry for the rant that would rival a presidential candidate during a debate.
  19. Sure but when I do the code needs to be able to replace the values with a number. When this happens should I replace all those temporary numbers with the b values and let the sensor define them? Their has to be a better way to tell the code the scan multiple time a second #---------------Import Section import time #---------------Class Section class Calculator: def addition (x,y): add = x+y print(add) def subtraction (x,y): sub = x-y print(sub) def multiplication (x,y): mult = x*y print(mult) def division (x,y): div = x/y print(div) #--------------Functions def add1(x,y): Calculator.addition(x,y) def sub1(x,y): Calculator.subtraction(x,y) def mutl(x,y): Calculator.multiplication(x,y) def div(x,y): Calculator.division(x,y) def RME(): hi #---------------Flight Code Section Secondary a = 0 def voltage1(b1): global c1 c1 = b1 + 0 if c1 > a: print("Activate Response 1") print("The Value of Voltage +", c1) #Open RCS Valve Code elif c1==0: print("No Excessive Aerodynamic Forces sensor1") pass voltage1(0) #---Sensor 2 a = 0 def voltage2(b2): global c2 c2 = b2 + 0 if c2 > a: print("Activate Response 2") print("The Value of Voltage +", c2) #Open RCS Valve Code elif c2==0: print("No Excessive Aerodynamic Forces sensor2") pass voltage2(0) #---Sensor 3 a = 0 def voltage3(b3): global c3 c3 = b3 + 0 if c3 > a: print("Activate Response 3") print("The Value of Voltage +", c3) #Open RCS Valve Code elif c3==0: print("No Excessive Aerodynamic Forces sensor3") pass voltage3(1) #---Sensor 4 a = 0 def voltage4(b4): global c4 c4 = b4 + 0 if c4 > a: print("Activate Response 4") print("The Value of Voltage +", c4) #Open RCS Valve Code elif c4==0: print("No Excessive Aerodynamic Forces sensor4") pass voltage4(0) while 1>0: voltage4(0) voltage3(0) voltage2(0) voltage1(0) #---------------Primary Code Section TT = 1 time.sleep (TT) print("Hello World") Everything I put in bold is redundant Furthur more it updates hundreds of times a second which puts unnessicary stain on a system
  20. Again I can not. Remember this is an RCS System that is automated. If a sensor is trigger (meaning the rocket off course) it inputs a value greater than 1 into those b places. This means that I can not write an number into a code because that number is determined by things like the wind on the day of launch. I tested it with numbers and it worked as intended but as I stated above that is just to ensure success of the system the numbers need to come from a sensor.
×
×
  • Create New...