Recommended Posts

Posted (edited)

 

I want to launch a model rocket with a stability assist system and trajectory system. I want to code it myself but I honestly have no idea what I'm doing. Further I'm terrible at coding in general. Is their any very simple to use code, simpler that kOS, that I can use for this? I would be fine with drag and drop but I cant find anything for robotics that can run multiple programs. Just programs that do a do b do c etc. Any suggestions?

Also it would need to run with any simulator that could handle it only because the rocket will take time and money I don't have and I would want the software done before I finalize the design.

Edited by Cheif Operations Director

Share this post


Link to post
Share on other sites

I think you'd pretty much need to be a Mary Sue to pull all that off without any coding experience. Why not start smaller?

Share this post


Link to post
Share on other sites
Just now, PakledHostage said:

I think you'd pretty much need to be a Mary Sue to pull all that off without any coding experience. Why not start smaller?

Because I don't have a choice I've already tested what I need too to get to a guided rocket. 

What I want is a 4 fin and 4 thruster input system. 

Here is what I want to say

Execute:Motor 1-Fin (1.3 seconds)

Execute: Motor3-Fin (1.3 Seconds) invert

that could be a flight program really simple

 

for the "SAS"

I would say if sensor A is triggered Trigger thruster B until Sensor A is no longer past perimeters.

This way I could have a (relatively) good flight plan along with control and "SAS"

Share this post


Link to post
Share on other sites

Languages like Scratch and Blockly allow you to program visually. But how to connect it to your hardware?

Share this post


Link to post
Share on other sites
Just now, Kerbart said:

Languages like Scratch and Blockly allow you to program visually. But how to connect it to your hardware?

This is why I need help I have 0 Idea what I'm doing.

How would that would work anyways.

Share this post


Link to post
Share on other sites

For a controller you quickly end up with an Arduino or something along those lines. That'll still require some knowledge of electronics on how to hook things up.

Spend a bit more and you get a microcontroller that runs on MicroPython. Yes, it's a programming language, but fairly easy to learn. And you wouldn't need much more than the commands to trigger the servos, and a sleep command anyway.

  • Like 1

Share this post


Link to post
Share on other sites

My biggest question is how do you "use" a computer.

If I presume I've compelled my software then how do I put it into a computer inside and get it to execute those commands.

Share this post


Link to post
Share on other sites
42 minutes ago, Cheif Operations Director said:

My biggest question is how do you "use" a computer.


I'd say drop by the appropriate forums for the computer you've chosen and ask there...  You're more likely to find people there with the appropriate knowledge and skills.

 

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, DerekL1963 said:


I'd say drop by the appropriate forums for the computer you've chosen and ask there...  

 

Or start with a smaller project and work up towards your goal over the course of several projects. You [Cheif Operations Director] railed against Rey's character in TLJ ad infinitum because she went straight from zero experience to Jedi level experience, and now you want to do something similar in real life... Go get an Arduino (or similar system) and start playing with it. Wax on, wax off.

Edited by PakledHostage
  • Like 3

Share this post


Link to post
Share on other sites

This is a big job you've given yourself, but it's doable. It won't be easy or quick, but you'll get there if you stick with it. Check out this example for what people have already done:

http://www.instructables.com/id/Radio-Telemetry-for-a-Model-Rocket/

13 hours ago, Cheif Operations Director said:

 I cant find anything for robotics that can run multiple programs. Just programs that do a do b do c etc. Any suggestions?

Most of the time you don't need multiple programs. Your single program just goes through the steps quick enough that it's as if they're happening at the same time. For example, your program could check the rocket's orientation, then correct the pitch, then correct the yaw, then correct the roll, then check the orientation again and so on. If it's doing this hundreds of times a second (programs can be very fast), it doesn't matter that the actions aren't happening at the same time. This is how most programs work, which is why you're having difficulty finding anything different.

 

8 hours ago, Cheif Operations Director said:

Is their any drag and drop that can be used for Robotics that is a bit more advanced than mindstorms :) 

The first thing to know is that you're almost definitely going to have to type your programs, especially if you want to do something unusual or difficult like controlling a rocket. Break the problem down into individual steps, and solve each one before moving on to the next. All of the steps will need lots of researching and reading to figure out what you need to know, and where you should look for answers.

  1. Figure out what the problem you want to solve is. You want to control a model rocket using your own code. Code needs hardware to run on.
  2. What hardware should you use? It needs to be small and lightweight so that it can fit on the rocket, not use a lot of power so you don't need a big battery, and be a common enough piece of hardware that you'll be able to easily get help for getting started. Some kind of small Arduino would be suitable for this.
  3. We know roughly what kind of hardware we'll need. How do we program it? Arduino has its own Arduino language, which is basically C++.
  4. So how do we write Arduino code to control a rocket? Again, break it down into steps. Step one is learning how to set everything up so that you can make code that does something, anything. This is normally what's called a "Hello World!" program, where you write a program that displays "Hello World!" on the screen and nothing else.
  5. Expand your program: Can you make it print something like this with the right timing?
    3...
    2...
    1...
    Launch!
    Burnout!
  6. Expand your test program. Pretend it has a throttle like in KSP, that you can set between 0 and 100. Can you make it set the throttle to 100 when it reaches "Launch!", and slowly reduce it to 50 after a couple of seconds, printing it out to the screen every second? What if, instead of a throttle, you had a fin that could rotate between 0 and 100?
  7. Once you know how to write simple programs, you can start getting your Arduino to do things. Your research will likely point you towards model servo motors. How do you attach them to your Arduino? How do you control them with the Arduino? How to you control them well? What is a PID controller? How do you write a PID controller?
  8. Keep learning, keep researching your next step, and split it down into smaller steps as much as you can. Other people have already done the things you'll need to do, some might even have released designs or software that you can use straight away.

Good luck!

Share this post


Link to post
Share on other sites
1 hour ago, PakledHostage said:

Or start with a smaller project and work up towards your goal over the course of several projects. You [Cheif Operations Director] railed against Rey's character in TLJ ad infinitum because she went straight from zero experience to Jedi level experience, and now you want to do something similar in real life... Go get an Arduino (or similar system) and start playing with it. Wax on, wax off.

Seriously... 

I didn't say I wasn't going to get help, I just wanted to know if their is any code. 

How would you suggest I start smaller. Other than an electronic gyro, which you be a complete total nightmare what other guidance system could I do. I would love to do it but in the end I don't know how I would? Examples?

Share this post


Link to post
Share on other sites
27 minutes ago, pizzaoverhead said:

This is a big job you've given yourself, but it's doable. It won't be easy or quick, but you'll get there if you stick with it. Check out this example for what people have already done:

http://www.instructables.com/id/Radio-Telemetry-for-a-Model-Rocket/

Most of the time you don't need multiple programs. Your single program just goes through the steps quick enough that it's as if they're happening at the same time. For example, your program could check the rocket's orientation, then correct the pitch, then correct the yaw, then correct the roll, then check the orientation again and so on. If it's doing this hundreds of times a second (programs can be very fast), it doesn't matter that the actions aren't happening at the same time. This is how most programs work, which is why you're having difficulty finding anything different.

 

The first thing to know is that you're almost definitely going to have to type your programs, especially if you want to do something unusual or difficult like controlling a rocket. Break the problem down into individual steps, and solve each one before moving on to the next. All of the steps will need lots of researching and reading to figure out what you need to know, and where you should look for answers.

  1. Figure out what the problem you want to solve is. You want to control a model rocket using your own code. Code needs hardware to run on.
  2. What hardware should you use? It needs to be small and lightweight so that it can fit on the rocket, not use a lot of power so you don't need a big battery, and be a common enough piece of hardware that you'll be able to easily get help for getting started. Some kind of small Arduino would be suitable for this.
  3. We know roughly what kind of hardware we'll need. How do we program it? Arduino has its own Arduino language, which is basically C++.
  4. So how do we write Arduino code to control a rocket? Again, break it down into steps. Step one is learning how to set everything up so that you can make code that does something, anything. This is normally what's called a "Hello World!" program, where you write a program that displays "Hello World!" on the screen and nothing else.
  5. Expand your program: Can you make it print something like this with the right timing?
    3...
    2...
    1...
    Launch!
    Burnout!
  6. Expand your test program. Pretend it has a throttle like in KSP, that you can set between 0 and 100. Can you make it set the throttle to 100 when it reaches "Launch!", and slowly reduce it to 50 after a couple of seconds, printing it out to the screen every second? What if, instead of a throttle, you had a fin that could rotate between 0 and 100?
  7. Once you know how to write simple programs, you can start getting your Arduino to do things. Your research will likely point you towards model servo motors. How do you attach them to your Arduino? How do you control them with the Arduino? How to you control them well? What is a PID controller? How do you write a PID controller?
  8. Keep learning, keep researching your next step, and split it down into smaller steps as much as you can. Other people have already done the things you'll need to do, some might even have released designs or software that you can use straight away.

Good luck!

Is what your say is that drag and drop CAN NOT do what I need to to or that it's not the best.

Share this post


Link to post
Share on other sites

Try Arduino, it is simple and enjoyable to work with. I could start making useful code the same day I put my hands on it.I work as a programmer tho, so I had a jump start, but I think you'll find it manageable anyway.

I think it would be fine to start working directly to your goal.

1. First step, get some LED light to blink on it. This requires you to learn how to connect it to your computer, to load a new firmware into it and the basic commands you can use.
2. Connect a sensor to it, for example a resistor or a voltage input. Now you'll learn how to interface analog inputs to it, and how to show this somewhere (debug log or something).
3. Start using the sensor data to control something. There is a ready made module in Arduino to control servos so there is only a few lines of code to take the analog value and send it directly to the servos.
4. Implement a PID regulator. Use the regulator to connect input (lets say gyro), expected value (your current planned heading) and output (servo control for wings). Now you have a SAS system!

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, Katten said:

Try Arduino, it is simple and enjoyable to work with. I could start making useful code the same day I put my hands on it.I work as a programmer tho, so I had a jump start, but I think you'll find it manageable anyway.

I think it would be fine to start working directly to your goal.

1. First step, get some LED light to blink on it. This requires you to learn how to connect it to your computer, to load a new firmware into it and the basic commands you can use.
2. Connect a sensor to it, for example a resistor or a voltage input. Now you'll learn how to interface analog inputs to it, and how to show this somewhere (debug log or something).
3. Start using the sensor data to control something. There is a ready made module in Arduino to control servos so there is only a few lines of code to take the analog value and send it directly to the servos.
4. Implement a PID regulator. Use the regulator to connect input (lets say gyro), expected value (your current planned heading) and output (servo control for wings). Now you have a SAS system!

That sounds exactly like what I need. My one question is can it 

Preform more than 2 programs completely serperate of each other and

Also which ones do I get. I'm tpan ametures ameture to the realm of computers

What is the benefit  of differant ones.

Share this post


Link to post
Share on other sites
Posted (edited)

Yes it can.

This is a basic structure of such a software:

main()
{
	SAS_Init();
	Trajectory_Init();

	while(1)
	{
		SAS_Run();
		Trajectory_Run();
	}
}

Notice that none of the _Run-functions are allowed to "stop" the program. They can only do some calculations, and the return. The program will then continue to loop over the run functions, so that all parts of the software gets a chance to do its thing. So in other words, don't use a lengthy while loop or delay in the run functions.

Edited by Katten

Share this post


Link to post
Share on other sites

At the risk of stating the obvious, a model rocket with a novice-programmed guidance system is probably much more dangerous than a typical one that just goes straight up and pops a parachute. Think about what you're going to do if it starts heading in your direction. Range safety first.

Share this post


Link to post
Share on other sites

And if I do a stop program for the fins it won't stop everything else.

Just now, HebaruSan said:

At the risk of stating the obvious, a model rocket with a novice-programmed guidance system is probably much more dangerous than a typical one that just goes straight up and pops a parachute. Think about what you're going to do if it starts heading in your direction. Range safety first.

I know I'm going static fire it and use an air duster to test the SAS System. All while I'm at a safe distance. 

2 minutes ago, HebaruSan said:

At the risk of stating the obvious, a model rocket with a novice-programmed guidance system is probably much more dangerous than a typical one that just goes straight up and pops a parachute. Think about what you're going to do if it starts heading in your direction. Range safety first.

I'm not going to make an P Class rocket with ametuer coding and launching it from time square. 

5 minutes ago, Katten said:

Yes it can.

This is a basic structure of such a software:

main()
{
	SAS_Init();
	Trajectory_Init();

	while(1)
	{
		SAS_Run();
		Trajectory_Run();
	}
}

Notice that none of the _Run-functions are allowed to "stop" the program. They can only do some calculations, and the return. The program will then continue to loop over the run functions, so that all parts of the software gets a chance to do its thing. So in other words, don't use a lengthy while loop or delay in the run functions.

Is their a "radio control" feature I could Program into this arduino

Share this post


Link to post
Share on other sites
Posted (edited)
41 minutes ago, Cheif Operations Director said:

How would you suggest I start smaller. Other than an electronic gyro, which you be a complete total nightmare what other guidance system could I do. I would love to do it but in the end I don't know how I would? Examples?

Get an Arduino. 

Make it blink an LED. 

Make it blink an LED at a variable rate in response to some input. 

Make it output a more complex signal like serial. Make it move a servo.

Make it read a voltage (0-5 volts) and output the reading over serial.

Make it move a servo.

Make it move a servo in response to an input voltage.

Make it read a simple MEMS gyro and output the rate of rotation on a serial link.

Make it move a servo in response to the MEMS gyro.

Learn linear algebra and quaternions.

Learn control theory.

Wax on, wax off.

Edited by PakledHostage

Share this post


Link to post
Share on other sites
26 minutes ago, Cheif Operations Director said:

Is what your say is that drag and drop CAN NOT do what I need to to or that it's not the best.

If you want to learn to swim, you're going to have to get wet.

Share this post


Link to post
Share on other sites
5 minutes ago, Cheif Operations Director said:

Is their a "radio control" feature I could Program into this arduino

Yes! I'm sure you'll find plenty tutorials on the subject.
https://www.sparkfun.com/tutorials/348

Share this post


Link to post
Share on other sites

Most of you have been a very good help, thanks!

I have a few more question, does Arduino sell motors that can turn both directions. This would be (obviously) nessicary for control.

17 minutes ago, Katten said:

Yes! I'm sure you'll find plenty tutorials on the subject.
https://www.sparkfun.com/tutorials/348

 

Share this post


Link to post
Share on other sites
Posted (edited)
24 minutes ago, Cheif Operations Director said:

Most of you have been a very good help, thanks!

I have a few more question, does Arduino sell motors that can turn both directions. This would be (obviously) nessicary for control.

Buy a servo. Servo City is one place you can get them online. Servos typically respond to a pulse signal at about 25 - 50 Hz ( although higher quality servos typically use far higher frequency signals). The width of each individual pulse (in microseconds)  within the stream of pulses tells the servo where to move within its range of motion. There are sample Arduino projects that will help you learn how to write a program to do this. 

But you'll need to be able to do more than just read a gyro in a single axis and move a servo in response. You need dugital signal processing algorithms to filter the noise out of your sensors, math to process the inputs into an estimation of your rocket's current state in 3D, control logic (control theory) to come up with a reasonable algorithm to keep your rocket going where you want it to, etc. 

But trust me, this isn't going to be a "My First Project" project. I have an engineering degree and I do this stuff for a living, so I am all too aware that the devil is in the details. I have no doubt that you could pull it off if you are dedicated enough, but don't expect to do this as a first project. Start small and work up to it. 

Edited by PakledHostage

Share this post


Link to post
Share on other sites
2 minutes ago, PakledHostage said:

Buy a servo. Servo City is one place you can get them online. Servos typically respond to a pulse signal at about 25 - 50 Hz. The width of each individual pulse (in microseconds)  within the stream of pulses tells the servo where to move within its range of motion. There are sample Arduino projects that will help you learn how to write a program to do this. 

But you'll need to be able to do more than just read a gyro in a single axis and move a servo in response. You need dugital signal processing algorithms to filter the noise out of your sensors, math to process the inputs into an estimation of your rocket's current state in 3D, control logic (control theory) to come up with a reasonable algorithm to keep your rocket going where you want it to, etc. 

But trust me, this isn't going to be a "My First Project" project. I have an engineering degree and I do this stuff for a living, so I am all too aware that the devil is in the details. I have no doubt that you could pull it off if you are dedicated enough, but don't expect to do this as a first project. Start small and work up to it. 

How could I start smaller for a guidance system other than turn motors for 1.3 seconds and then free fly

the SAS program won't fly anytime soon but all it is , is this

If sensor A is triggered

Fire Thruster A

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now