Jump to content

Cheif Operations Director

Members
  • Posts

    1,633
  • Joined

  • Last visited

Everything posted by Cheif Operations Director

  1. Ok I fixed that. It still is demanding a value for b1 b2 b3 b4 I tried testing it will numbers and it works as intended but the numbers will be inputed from a sensor in flight thus I can not when this program is actually running type in the numbers
  2. I still got the message for sensor #1 only even though I put it last It did not work with the parent empty I need to call the function without inputing a value. The whole point is that it will reassess if their is a change to the value
  3. while 1>0: voltage4(b4) voltage3(b3) voltage2(b2) voltage1(b1) Did not work remember the values for the functions need to be empty
  4. while 1>0: voltage4 voltage3 voltage2 voltage1 Didn't work #---------------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 while c1 > a: print("Activate Response") print("The Value of Voltage +", c1) #Open RCS Valve Code while c1==0: print("No Excessive Aerodynamic Forces sensor1") pass voltage1(0) #---Sensor 2 a = 0 def voltage2(b2): global c2 c2 = b2 + 0 while c2 > a: print("Activate Response") print("The Value of Voltage +", c2) #Open RCS Valve Code while c2==0: print("No Excessive Aerodynamic Forces sensor2") pass voltage2(0) #---Sensor 3 a = 0 def voltage3(b3): global c3 c3 = b3 + 0 while c3 > a: print("Activate Response") print("The Value of Voltage +", c3) #Open RCS Valve Code while c3==0: print("No Excessive Aerodynamic Forces sensor3") pass voltage3(0) #---Sensor 4 a = 0 def voltage4(b4): global c4 c4 = b4 + 0 while c4 > a: print("Activate Response") print("The Value of Voltage +", c4) #Open RCS Valve Code while c4==0: print("No Excessive Aerodynamic Forces sensor4") pass voltage4(0) while 1>0: voltage4 voltage3 voltage2 voltage1
  5. Ok let me try it for my own knowledge why is this the way the logic works?
  6. Ok back again. It occurred to me that since the sensors will need to adjust the course of the rocket more than once that my old code would be insufficient because it would only check for corrections at the moment of launch. Thus at the beginning of each code section I added while 1>0 Since this is always true it is an infinite loop. I tested this however but only the first sensor fired correctly. Furthermore it seemed like the rest of the program halted. Here is the full code: Flight Computer Mk3 -New Additions: More versatile calculator infinite corrections in theory Main Engine Firing ----------------------------------------------------------Copy-----------------------------------Below-------------------------------------------------This--------------------------------Line---------------------------------------------------------------- #---------------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(): Undefined Temperarily #---------------Flight Code Section Secondary while 1>0: a = 0 def voltage1(b1): global c1 c1 = b1 + 0 if c1 > a: print("Activate Response") print("The Value of Voltage +", c1) #Open RCS Valve Code elif c1==0: print("No Excessive Aerodynamic Forces sensor1") pass voltage1(0) #---Sensor 2 while 1>0: a = 0 def voltage2(b2): global c2 c2 = b2 + 0 if c2 > a: print("Activate Response") print("The Value of Voltage +", c2) #Open RCS Valve Code elif c2==0: print("No Excessive Aerodynamic Forces sensor2") pass voltage2(0) #---Sensor 3 while 1>0: a = 0 def voltage3(b3): global c3 c3 = b3 + 0 if c3 > a: print("Activate Response") print("The Value of Voltage +", c3) #Open RCS Valve Code elif c3==0: print("No Excessive Aerodynamic Forces sensor3") pass voltage3(0) #---Sensor 4 while 1>0: a = 0 def voltage4(b4): global c4 c4 = b4 + 0 if c4 > a: print("Activate Response") print("The Value of Voltage +", c4) #Open RCS Valve Code elif c4==0: print("No Excessive Aerodynamic Forces sensor4") pass voltage4(0) #---------------Primary Code Section TT = 1 time.sleep (TT) print("Hello World")
  7. I was joking but for my own curiosity I guess both of them
  8. I understand that How did that program/service work?
  9. Yes how can I create a UI for "Mission Control" sort of thing for testing this code?
  10. All the print txt are called sensor 2 I fixed that As a note how hard is it to create an UI in Python. Perhaps I can create a basic system so I can test a theoretical rocket.
  11. err your right #---------------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) #---------------Flight Code Section Secondary a = 0 def voltage1(b1): global c1 c1 = b1 + 0 if c1 > a: print("Activate Response") print("The Value of Voltage +", c1) elif c1==0: print("No Excessive Aerodynamic Forces sensor2") voltage1(0) #---Sensor 2 a = 0 def voltage2(b2): global c2 c2 = b2 + 0 if c2 > a: print("Activate Response") print("The Value of Voltage +", c2) elif c2==0: print("No Excessive Aerodynamic Forces sensor2") voltage2(0) #---Sensor 3 a = 0 def voltage3(b3): global c3 c3 = b3 + 0 if c3 > a: print("Activate Response") print("The Value of Voltage +", c3) elif c3==0: print("No Excessive Aerodynamic Forces sensor2") voltage3(0) #---Sensor 4 a = 0 def voltage4(b4): global c4 c4 = b4 + 0 if c4 > a: print("Activate Response") print("The Value of Voltage +", c4) elif c4==0: print("No Excessive Aerodynamic Forces sensor2") voltage4(0) #---------------Primary Code Section TT = 10 time.sleep (TT) print("Hello World") I think I managed to adapt it well enough
  12. Yes but why? I code I have seems to work so what is the difference?
  13. if cc1>0: uses an if statement im not sure what you mean. Yes most (not all) of those prints will be replaced when I actually know how to interface the hardware. The comedy of that just occurred on me however How does it work differently if I change it to the other way
  14. That's old school I guess it depends on the fortran but still Most recent version was released 6 months ago
  15. Do any of you see any areas in the flight computer above that may need improvement for what I have now. Again note that once I have the full code written out to print a text I will add sections so it can interface with the hardware. The last section basically tells the rocket from the moment of launch to wait 10 second and then begin a gravity turn. I inserted the calculator so any calculations when I develop this further are able to be done.
  16. Lol on 8 I suppose so. I want to eventually know C but as of noon yesterday I knew literally nothing when it came to this type of coding this is my first full day of it and I do not want to undertake a more advanced language on my first try.
  17. Its not going to be an Estes rocket but it will not be a high powered rocket either. https://arduino.stackexchange.com/questions/105/programming-an-arduino-using-python-rather-than-c-c I found this online and was wondering as to everyone's opinion This is all the code for the guidance system as of right now. ---------------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) #---------------Flight Code Section Secondary a = 0 def voltage1(bb1): global cc1 cc1= bb1+0 voltage1(0) if cc1>0: print("Activate Response sensor1") print("The Value of Voltage sensor1 +", cc1) elif cc1==0: print("No Excessive Aerodynamic Forces sensor1") #---Sensor 2 a = 0 def voltage2(bb2): global cc2 cc2 = bb2+0 voltage2(0) if cc2>0: print("Activate Response sensor2") print("The Value of Voltage sensor2 +", cc2) elif cc2==0: print("No Excessive Aerodynamic Forces sensor2") #---Sensor 3 a = 0 def voltage3(bb3): global cc3 cc3 = bb3+0 voltage3(0) if cc3>0: print("Activate Response sensor3") print("The Value of Voltage sensor3 +", cc3) elif cc3==0: print("No Excessive Aerodynamic Forces sensor3") #---Sensor 4 a = 0 def voltage4(bb4): global cc4 cc4 = bb4+0 voltage4(0) if cc4>0: print("Activate Response sensor4") print("The Value of Voltage sensor4 +", cc4) elif cc4==0: print("No Excessive Aerodynamic Forces sensor4") #---------------Primary Code Section TT = 10 time.sleep (TT) print("Hello World") Also what I hear which is why I took Python
  18. Ok I will. I seem to be getting a similar consensus so I will look into it more.
  19. I suppose I will start looking at hardware. Is their any reason why I could not use Python to make a guidance system/flight computer from a technical perspective?
  20. It works thanks and cool. Also that quote from Slavoj im not sure he said it do you have a citation?
  21. Why would Python not be right for mounting it inside of the rocket. Others have mentioned Arduinos and Im not against it but based on what ive seen Python seems to be the better language overall. The hardware I have not really determined yet I wanted to get the code working in some form so I could get the right stuff instead of buying things to realize they will not work.
  22. Here is the rundown: I want this function to only be activated when a value is inserted into it for example (1). I want this that is inserted (b) = a new value (c). Then I want the code to evaluate if c is larger than a (0). If it is do something if it is not do not do something. this is supposed to happen a few times a second. I making this for a guidance system for a model rocket. Basically if a sensor is triggered is causes the b value (voltage) to be >0. Thus this code will then activate a new system the print line is temporary. it just conveys the idea If the sensor is not triggered then no response a = 0 def voltage(b): global c c= b+0 voltage(b) if c>a: print("Activate Response") print("The Value of Voltage-", c) I think this may have resolved the issues. On the fifth line you will need to replace the b value with a number.
  23. a = 0 def voltage(b): global c c= b+0 return c if c>a: print("Activate Response") In terms of operation here is the debugged version The result is suppose to become the c value. I did that and in terms of the result I got from the console it was the same thing with or without it (the if > statement) a = 0 def voltage(b): global c c= b+0 return c if c>a: print("Activate Response" How do I tell the code to only do the if statement if b is greater than 0 Once this is done the problem is resolved I think
×
×
  • Create New...