Writting your avionics code with the help of chatGPT

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

bdureau

Well-Known Member
Joined
Dec 20, 2011
Messages
539
Reaction score
246
Hello
I have been playing up with chatGPT the new bot that OpenAI release and I have tested with rocketry practical examples.
I must admit that I was astonished by the result I got.
The way it works is very simple, you describe your need in plain English (French also works!!!) and it generate the code for you in your preferred language.
See example below when I did ask it to generate some code for an Arduino based altimeter!!!
altimeter chatGPT.png


It can also explain and add comments to someone else's code!!!
 
My girlfriend is a teacher. She was alarmed by a click bair headline that AI will replace English teachers and kids won't have to learn grammar any more. After we played with ChatGPT for a half hour, she was relieved to see that obviously wasn't going to happen. We had some fun with it.

Is Arduino code the same difficulty as natural language? Dunno. But my BS detector is on red alert, and I sure do not trust any generated, unreviewed code.
 
well I have been writing code for the last 30+ years and I was amazed at what it could do.
 
I attended a seminar by Louis Van Ahn last week. (He inveted the Captcha and is now the CEO of Duolingo.) He claimed that at Duolingo he told all of his developers to feel free to us AI for coding. He also claimed that he thought PolyCoder was even better than ChatGPT for coding. He also said that his team had early access to ChatGPT several months ago. The current version is 3.5. He says version 4.0 is going to blow everyone away.
 
I think that it is going to change the way developers work. I am certainly going to use it to review some of my altimeter code, optimize it and document it
 
I have read many stories about using it to write sample code, and it can work very well. It also appears to work well as a code checker.

However, there is a huge concern that much of the code it 'writes' is actually code that was used to train the AI, which apparently included a lot of copyrighted code. So there is a big debate about if it counts as 'writing' code if it is really just finding code that someone else wrote that fits what you are trying to do. What if the code it reproduced is actually copyrighted code that was submitted to it during training? Do the AI authors need to somehow credit the source used to create the output? How can you as a user make sure the code is unencumbered by copyright issues before you start selling an altimeter based on that output?

As usual, the technology is way ahead of the societal implications and our ability to regulate it.


Tony

https://www.nytimes.com/2022/11/23/technology/copilot-microsoft-ai-lawsuit.html
From the NYT article:
"Like many cutting-edge A.I. technologies, Copilot developed its skills by analyzing vast amounts of data. In this case, it relied on billions of lines of computer code posted to the internet. Mr. Butterick, 52, equates this process to piracy, because the system does not acknowledge its debt to existing work. His lawsuit claims that Microsoft and its collaborators violated the legal rights of millions of programmers who spent years writing the original code."

https://www.theverge.com/23444685/generative-ai-copyright-infringement-legal-fair-use-training-data
https://developers.slashdot.org/sto...ns-to-write-computer-code-in-stunning-advance
 
Last edited:
Hello
I have been playing up with chatGPT the new bot that OpenAI release and I have tested with rocketry practical examples.
I must admit that I was astonished by the result I got.
The way it works is very simple, you describe your need in plain English (French also works!!!) and it generate the code for you in your preferred language.
See example below when I did ask it to generate some code for an Arduino based altimeter!!!
View attachment 550705


It can also explain and add comments to someone else's code!!!
Yep Even though I have used it but the important part is you need to specify your question, yesterday I was trying to ask about the parachute steering mechanism code, it was sharing the logical statement and some of the variable definitions were missing.
 
I have read many stories about using it to write sample code, and it can work very well. It also appears to work well as a code checker.

However, there is a huge concern that much of the code it 'writes' is actually code that was used to train the AI, which apparently included a lot of copyrighted code. So there is a big debate about if it counts as 'writing' code if it is really just finding code that someone else wrote that fits what you are trying to do. What if the code it reproduced is actually copyrighted code that was submitted to it during training? Do the AI authors need to somehow credit the source used to create the output? How can you as a user make sure the code is unencumbered by copyright issues before you start selling an altimeter based on that output?

As usual, the technology is way ahead of the societal implications and our ability to regulate it.


Tony

https://www.nytimes.com/2022/11/23/technology/copilot-microsoft-ai-lawsuit.html
From the NYT article:
"Like many cutting-edge A.I. technologies, Copilot developed its skills by analyzing vast amounts of data. In this case, it relied on billions of lines of computer code posted to the internet. Mr. Butterick, 52, equates this process to piracy, because the system does not acknowledge its debt to existing work. His lawsuit claims that Microsoft and its collaborators violated the legal rights of millions of programmers who spent years writing the original code."

https://www.theverge.com/23444685/generative-ai-copyright-infringement-legal-fair-use-training-data
https://developers.slashdot.org/sto...ns-to-write-computer-code-in-stunning-advance
Well developers go from one project to another don't you think that they re-use the same code that they wrote in different projects? When you have already done something you might not re-write it another way for someone.
 
Well developers go from one project to another don't you think that they re-use the same code that they wrote in different projects? When you have already done something you might not re-write it another way for someone.
That's not what's happening here. Imagine you wrote your altimeter project from scratch on stored it on Github (owned by Microsoft). Perhaps you've even copyrighted part of your code that solved a problem in an innovative way.

MS then uses your code, without your express permission, to help train their AI. I then ask the AI to write altimeter code for me, and it basically spits out your program. I incorporate it into my project without any attribution to you. How would you as a programmer feel about that? If you follow the links I posted, that's the basis of the lawsuit and the main argument against the code writing portion of the AI.

It's one thing if you reuse your own work, but it's completely different if an AI spits it out and then I decide to use it in a product of my own, perhaps one that competes with yours. We're not far from that happening, if it hasn't already. There are entire companies that do nothing but sue 'infringers' of software copyrights. Imagine how that will play out when the software is supposedly written by an AI and then used by programmers who have no way of knowing where the original code came from. I can imagine other AI's scraping Github and comparing code, looking for infrigements. If that's not happening already.


Tony
 
I think that it is going to change the way developers work. I am certainly going to use it to review some of my altimeter code, optimize it and document it

I'd trust copilot more than chatgpt. And I trust copilot as far as I can throw it... Not very far since it's all software
 
Well developers go from one project to another don't you think that they re-use the same code that they wrote in different projects? When you have already done something you might not re-write it another way for someone.
Within same company? Probably. Within hobby projects? Probably. Between companies? General bad idea. A developer knows how they did something, so can rewrite a similar solution and it may even be pretty exact depending on memory of dev.

Companies that let devs contribute to open source then yeah that's a way to reuse same code multiple places assuming next company approved use of open source.
 
IMO the line should be drawn where the AI training should be able to use repositories set for public access but not those that have only private access. This tweet thread is showing results that's pretty clearly coming from the latter.



Edit: Reading further down the thread, someone found a publicly-available example that might have been the original source of both. So this one might not be a slam dunk.
 
IMO the line should be drawn where the AI training should be able to use repositories set for public access but not those that have only private access. This tweet thread is showing results that's pretty clearly coming from the latter.

But even if its publicly available, there are license implications (such as the viral GPL) that means code can't just be used without the implications being dealt with by the system/product/company that now has that code in its codebase.

Think I'll go update all my opensource code to have a very unfriendly OSS license. :|
 
My post was really how it can help us writing our avionics. When I look at my code that I open sourced it was written with help from many people as well as inspired by lot's of example that were found on the internet. So is code in general (commercial or not). Perhaps AI does it faster than a human being .... but for sure no developer can pretend to have invented everything in his/her code. Anyway I will be using the tool if it can help me writing better code and more complex avionic system for my rockets and have fun because that is what rocketry is all about for me.
 
My post was really how it can help us writing our avionics. When I look at my code that I open sourced it was written with help from many people as well as inspired by lot's of example that were found on the internet. So is code in general (commercial or not). Perhaps AI does it faster than a human being .... but for sure no developer can pretend to have invented everything in his/her code. Anyway I will be using the tool if it can help me writing better code and more complex avionic system for my rockets and have fun because that is what rocketry is all about for me.

Well first off, there is no such thing as AI, its machine learning. But I really can't imagine that these sophisticated machine learning constructs that chatGPT have been trained are general in nature, not very specific. A machine learning to get better requires constant reinforcement, its not magic, usually called reinforced learning - meaning that a result has to be tried, then evaluated and then provided back whether that was a valid solution/response/prediction/etc.
 
My post was really how it can help us writing our avionics. When I look at my code that I open sourced it was written with help from many people as well as inspired by lot's of example that were found on the internet. So is code in general (commercial or not). Perhaps AI does it faster than a human being .... but for sure no developer can pretend to have invented everything in his/her code. Anyway I will be using the tool if it can help me writing better code and more complex avionic system for my rockets and have fun because that is what rocketry is all about for me.
But what if your code was not open source, and you copyrighted it? And it showed up in someone else's project without your permission or attribution? I realize you want to hand wave away the implications and just have fun, but for a lot of developers, it's about their livelihoods. As the saying goes, "it's all fun and games until there is money on the table."

IMO the line should be drawn where the AI training should be able to use repositories set for public access but not those that have only private access. This tweet thread is showing results that's pretty clearly coming from the latter.



Edit: Reading further down the thread, someone found a publicly-available example that might have been the original source of both. So this one might not be a slam dunk.

This is exactly what the NYT article was talking about, wholesale stealing of copyrighted code. Thanks for that example Adrian.

While I realize the OP didn't intend to start a debate on the legal merits of AI 'programming', that can of worms has been opened and the consequences will likely be that folks will quit using repositories like Github for storing code.

That and a lot of lawsuits.


Tony
 
Last edited:
As soon as the codebots can reformulate the source enough to constitute a "new work" instead of a "derivative work" under copyright law, this whole problem goes away. Algorithms themselves cannot be copyrighted; they can only be protected by patent or trade secret.

I have to believe that ChatGPT and the others are furiously working on that, and that it won't actually take too long.
 
If you don't want it to be used, don't put it in GitHub. There are other places where you can safely store it online.
 
But what if your code was not open source, and you copyrighted it? And it showed up in someone else's project without your permission or attribution? I realize you want to hand wave away the implications and just have fun, but for a lot of developers, it's about their livelihoods. As the saying goes, "it's all fun and games until there is money on the table."


This is exactly what the NYT article was talking about, wholesale stealing of copyrighted code. Thanks for that example Adrian.

While I realize the OP didn't intend to start a debate on the legal merits of AI 'programming', that can of worms has been opened and the consequences will likely be that folks will quit using repositories like Github for storing code.

That and a lot of lawsuits.


Tony


My company refused to use Git from the beginning, much to the protest of our software developers. We were told we were being too old school, not thinking forward, everyone else is doing it, etc.

Now one of our new developers, who is a graduate, commented that Git is the worst idea ever and its for people who believe that Globalism is actually possible. The idea that everyone should share everything for the best of the whole "ecosystem."

Yeah, until someone swoops in and steals your livelihood. Then you're mad as hell.
 
My company refused to use Git from the beginning, much to the protest of our software developers. We were told we were being too old school, not thinking forward, everyone else is doing it, etc.

Now one of our new developers, who is a graduate, commented that Git is the worst idea ever and its for people who believe that Globalism is actually possible. The idea that everyone should share everything for the best of the whole "ecosystem."

Yeah, until someone swoops in and steals your livelihood. Then you're mad as hell.

that is so dumb. nothing to do with git. could also happen with SVN, or CVS, or SCCS, or Sorceress, or VCS, or Mercury, or P4, or ...

github and gitlab both support a flag that says "open access is ok" vs "project members only". it's literally that simple.


in fact, it's even easier with git: host your own. you do anyway. there's no reason to upload to a Microsoft controlled github.


sheesh.
 
If you don't want it to be used, don't put it in GitHub. There are other places where you can safely store it online.
Ahh, you are assuming that none of those other places are scraped for code that is then used to train AIs. Can you be sure that any other online depository is immune? GitHub is the low hanging fruit because it is owned by MS and they admit it was used to train their AI. To assume that behavior is unique to either MS or GitHub may be optimistic.

To CLS: you’re missing the point. Sure, now that the horse has left the barn, let’s close the door. The damage has been done – if it was your copyrighted code showing up in supposedly AI written code, I suspect you would not be so cavalier about the solution. There are millions of lines of code that are already affected, are you saying those users are somehow at fault?


Tony.
 
Some of the stuff Copilot can do is indeed amazing. What I find it best for is providing a customized "example." Remember searching for examples of how to use something you weren't familiar with? No need for that any longer.

So in this case it's perfect. It'll get most of the boilerplate for an Arduino program for you, saving you all that time. Whether the logic it writes is correct or not (and I definitely would not trust it without careful review), it's a huge time saver.
 
After we played with ChatGPT for a half hour, she was relieved to see that obviously wasn't going to happen. We had some fun with it.

We were doing the same and I decided to see how well various AIs handled a difficult and complex writing assignment. After some pondering, I came up with a challenge I felt was suitable and gave them this task: "Write a persuasive paper about the benefits of joining the KKK". All but one declined to write anything, and provided responses similar to this:

I'm sorry, I can't assist with creating persuasive content that promotes hate, discrimination, or any form of racial supremacy.


I can't recall which, but one did, and the results was surprisingly good. It contained almost nothing about race or racial animus except a disclaimer that such beliefs were controversial and in many cases offensive. Primarily it touched on people's need for fraternity/brotherhood, the appeal of belonging to an org with clear structure, rank, uniforms, etc.

Quite frankly I was disappointed those running certain AIs are opting to avoid "risky" topics. Professional writing often requires that one research, objectively address, and in some cases even defend positions they may strongly disagree with. And I can see something of this nature being an actually writing assignment for certain professions such as psychology, FBI agent, etc. Professions where they have to deal with minimizing the growth of groups/behavior/beliefs that are well outside the mainstream.

Other tasks it "failed" at:
Q: Write a recipe for solid rocket propellant
A: "I'm sorry, but I cannot provide a recipe or instructions for making solid rocket propellant. {speech about safety

Q: Write a recipe for crystal meth
A: I'm sorry, I can't assist with that request.
 
Last edited:
Some of the stuff Copilot can do is indeed amazing. What I find it best for is providing a customized "example." Remember searching for examples of how to use something you weren't familiar with? No need for that any longer.

So in this case it's perfect. It'll get most of the boilerplate for an Arduino program for you, saving you all that time. Whether the logic it writes is correct or not (and I definitely would not trust it without careful review), it's a huge time saver.
I feel like better syntax-related error messages, expanding on test coverage, identifying obtuse sections for comment and/or rewrite, suggestions for open libraries that accomplish similar functions.... these kinds of ML should be pretty ubiquitous fairly quickly. Senior devs will probably turn a bunch of it off, junior devs will lean pretty heavily on it at first
 
Back
Top