Programm language for robotic - Page 1
Forum section: electronics / general

author: Irukandji
author_rank: Contributor
timestamp: July 19, 2019, 12:15:12 pm
content: Hi guys,i want to learn a programming language. Which language i must learn for programming robots or autonomous cars? Can i learn robotic language with an Arduino?best regards

author: ataradov
author_rank: Super Contributor
timestamp: July 19, 2019, 06:14:07 pm
content: C/C++/Python. Arduino - depends on the depth you want to go. You definitely can't do anything close to modern understanding of an "autonomous car", but you can do basic robotics stuff.

author: techman-001
author_rank: Frequent Contributor
timestamp: July 19, 2019, 10:22:37 pm
content: Quote from: Irukandji on July 19, 2019, 12:15:12 pmForth of course, Arduino is for artists who want a quickly built light display for their ice sculpture etc.With Forth you can leverage the inbuilt programmer machine interactivity using Words like " 30 forward", 100 left" for robots, plus Forth is big in Germany, see the German Forth Orghttps://forth-ev.de/Autonomous cars ? Join Google or Tesla or a university as this isn't a hobby area and would be controlled by all kinds of safety and government regulations.

author: TK
author_rank: Super Contributor
timestamp: July 19, 2019, 11:53:05 pm
content: For simple robots, probably Arduino is the best option. For autonomous driving robots: python because of the extensive deep learning frameworks available for python.

author: Irukandji
author_rank: Contributor
timestamp: July 20, 2019, 08:59:14 am
content: Thanks so much for your help. If i understand it right, it would be helpful to understand python and c or c++ programming language. Plus Forth i never hear that before thanks.

author: techman-001
author_rank: Frequent Contributor
timestamp: July 20, 2019, 09:11:38 am
content: Quote from: Irukandji on July 20, 2019, 08:59:14 amEight Forth powered MCU's were on the Philae Lander robot that accompanied the Rosetta spacecraft until it separated to land on comet 67P/Churyumov–Gerasimenko, in12 November 2014.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 22, 2019, 10:15:09 am
content: A programming language is just a programming language."arduino" is not a programming language.That said. The language itself is not a very important factor.Probably a lot more important are the tools and libraries available in the language you want to use, and if that language fits with your personality.[Python rant]For example, there are a bunch of reasons I quite dislike Python, such as the complete dependence on whitespace, the lack of strong typing and variable declaration (A single typo will just create a new variable instead of generate a syntax error, and may go unnoticed untill that line of code is actually executed, which easily creates hard to find bugs Yuck). But I am still interested in Python because it seems to become the defacto standard language for scripting stuff (KiCad, FreeCAD, Sigrok, etc).[/Python rant]Your choice may also depend on what sort of "robot" you want to build. From small carts such as line following carts or "micro mouse" to the autonomous vehicles that are tle latest craze in the last few years. Or are you more interested in "industral type" robot arms?Search the web a bit for projects similar to your interest, and look at the available documentation / libraries / etc.You can also do some searches on sites such as github and gitlab. There is a lot of code over there, and such sites are not well indexed by regular search engines.Hackaday also has a quite extensive overview of all kind of robotic related projects:https://hackaday.com/?s=robotLast but not least, have a look at Robot Operating System (ROS)http://www.ros.org/https://rosindustrial.org/

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 22, 2019, 10:51:02 am
content: always C/C++.... i can command the robot to goto(x,y) with my dead reckon and sensories library, i can do deep learning with proper library downloaded from the net and installed, i can show my face old 50 years from now, if i know the algorithm... if you want a working robot while you wiggle your foot on the chair (aka very little work), just buy a ready made robot.

author: raptor1956
author_rank: Frequent Contributor
timestamp: July 30, 2019, 01:39:09 am
content: Most commercial robots from companies like Fanuc or Kuka have there own programming environment allowing the user to program in a Basic like way using a teach pendant and robot specific operators/commands. Interfacing to them is a different issue with the various flavors of C being dominant.Brian

author: Rick Law
author_rank: Super Contributor
timestamp: July 30, 2019, 02:38:58 am
content: Quote from: Irukandji on July 19, 2019, 12:15:12 pmre: "...autonomous cars..."First, Arduino is not a language. Second, I don't think Arduino will ever be a good answer for "autonomous cars". Arduino is a specific implementation of a MCU (computer) to do experimentation and education. It is a simple implementation of hardware (MCU) and software working together. I can for example do some simple input (sensors), make some decision, and do some hardware effect (such as showing the sensor value or turning on a light). The hardware capabilities is very limited even with the "bigger better" Arduino boards. The space to store program is also very limited.The Arduino implementation choose C++ as the language it used to program the MCU. "Autonomous cars" will need far more hardware and far more software capabilities than what is available in the Arduino environment.

author: kenshi
author_rank: Contributor
timestamp: August 05, 2019, 12:39:58 pm
content: Industrial robots have their own languages, and they're pretty easy in my experience. I play with ABB robots, which use RAPID. It's an interpreted procedural language that mostly uses move and I/O commands, so if you know one or two computer programming languages, you can pick up on the basics like syntax extremely quickly and just read the manual on instructions, functions, and data types for the details.For instance, a function that makes a single weld on a part might be something like this:PROC Weld_Side_ASet roInFixtureA;Move WeldA1, v2000, z200, tMIG_TORCH;Move WeldA2, v300, z50, tMIG_TORCH;ArcLStart w101_start, v50, fine, wd101, sd101, tMIG_TORCH;ArcLEnd w101_end, v200, fine, wd101, sd101, tMIG_TORCH;Move WeldA2, v50, z50, tMIG_TORCH;Move WeldA1, v300, z50, tMIG_TORCH;Reset roInFixtureA;PulseDO \PLength:=1.0,roWeldAComplete;MoveJAbs pHome, v2000, fine, tMIG_TORCH;END PROCPretty simple. It starts off telling the PLC that it's in fixture A so it doesn't try to open the clamps or anything. Then there are some move commands which have as parameters a position, speed, flyby zone, and the tool being used. The flyby zone gives a radius around a point in which it can curve to change trajectory for the next point. Fine means it has to go to that exact point. There are ArcLStart and ArcLEnd instructions to start and end a straight line MIG weld, respectively. They have the same parameters as the Move commands but add welddata and seamdata which contain weld parameters. The flyby zone is fine so the weld starts and stops in a predictable position. Then you let the PLC know the robot is no longer in the fixture and that it completed the weld by pulsing that output on for one second. Finally the robot goes home. (You use MoveJAbs for that because the home position uses a data type for the position that has the angles for each joint of the robot instead of the intended location and angle of the tool.Anyway, that's a pretty simple weld procedure to give you an idea. I think learning pretty much any computer language will make learning something like RAPID a piece of cake.

author: rstofer
author_rank: Super Contributor
timestamp: September 05, 2019, 06:09:25 pm
content: If you're starting from nowhere, you might as well start with the Arduino platform using the C language. The Arduinno libraries are indeed written in C++ but most of the user code I have seen is written in C. When somebody wants to propose a language, see how many operating system kernels are written in the language. Then look at Real Time Operating Systems (RTOSs) and see which languages are used. Python won't show up, neither will Fortran. I would be amazed if C++ showed up. Fast code is written in C. It started with Unix and it is still true today.There are thousands of Arduino projects on the Internet. Everything that can be done, has been done. It's all out there!Later on, after mastering the Arduino, you can transition to the underlying avr-libc libraries and write code directly for the ATmega328P. You can get as detailed as you want and the chip is pretty amazing for what it is. There are larger variants of the ATmega chip family and all are supported by avr-gcc (the compiler/linker) and avr-libc (the C library).You will be working at the lowest level of automation, sensors and actuators. You won't be doing high level stuff like curing world hunger. These, and similar, processors are intended to control. Don't be surprised when you find out there are more than 100 such processors in the modern automobile. Divide and conquer! It's cheaper to build 100 small systems than it is to incorporate all the logic into a single processor, even if it is orders of magnitude more capable.Eventually, you will migrate to one of the ARM processors. Maybe the Teensy 4.0 which is a blazing fast (600 MHz) ARM processor with gobs of memory (like 2 MB of flash memory for code and 1 MB of RAM). Why would you gravitate to this platform? Well, there's a plug-in for the Arduino toolchain and the TeensyDuino provides all the Arduino library functions rewritten for the ARM. User code can be written that runs on both the ATmega and the Teensy platform, unchanged. Not all code, of course, particularly not low level code, but a lot of the standard functions (A/D, PWM, Serial) all work.Or you could skip the ATmega328P experience and move straight to the Teensy. It is essentially pin compatible (compare to Arduino Nano), it is source code compatible (for the most part) and it has a LOT more memory and a much brighter future. It's $20.https://www.pjrc.com/store/teensy40.htmlI have 3 of these. I used to have 4 but my dog thought the prototype board would make an excellent chew toy!I like the 'stamp' format that is compatible with prototype boards. The more I think about it, the more convinced I become that skipping the ATmega328P and going for the Teensy 4.0 is the right way to go. Cheap, fast and lots of memory!

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 09, 2019, 04:08:53 pm
content: Quote from: rstofer on September 05, 2019, 06:09:25 pmYup. Well, the Arduino "framework" uses a very small subset of C++ from what I've seen, mainly to make use of namespaces (which C definitely lacks) and basic class stuff.Quote from: rstofer on September 05, 2019, 06:09:25 pmI personally never recommend using the Arduino platform (), but if you want to, I definitely agree with you there. Many MCUs are now supported by Arduino. At least pick some that are reasonably powerful and modern.

author: legacy
author_rank: Super Contributor
timestamp: September 09, 2019, 07:15:00 pm
content: A couple of kits by NVIDIA for machine vision and machine learning are based on a C++ SDK and C++ frameworks.

author: Siwastaja
author_rank: Super Contributor
timestamp: September 30, 2019, 01:47:05 pm
content: Yes, by all means start by playing around with Arduino, a motor control shield and a few simple motors.It gets you going in a fairly simple manner, and you start learning about the very basic concepts. The start needs to be fun, and artistic is not a bad choice.Then you can slowly move on to professional stuff, almost always written in C or C++ for software, VHDL or Verilog for hardware.

author: jackthomson41
author_rank: Regular Contributor
timestamp: October 10, 2019, 03:55:16 pm
content: Yeah for robotics and particularly automation,Arduino Starter Kitsare best to learn. You can find a lot of tutorials online teaching from basics to pro.When I was learning Arduino, I have used Proteus Simulation software and have simulated Arduino in it, that way I didn't have to waste time on hardware assembling and have learnt Arduino coding quickly. So I would suggest you to do the same, download Arduino Library for Proteus and simulate it.

author: krayvonk
author_rank: Regular Contributor
timestamp: October 10, 2019, 11:31:21 pm
content: You need a portable computer to stick in a robots head, you cant just get your desktop and add legs to it... hang on maybe you can but it would be pretty heavy. and it would probably crash the slightest bump.

author: rstofer
author_rank: Super Contributor
timestamp: October 17, 2019, 04:43:21 pm
content: Quote from: krayvonk on October 10, 2019, 11:31:21 pmSome of the larger wheeled robots do indeed use a laptop and some of them are using the on-board camera for machine vision. There will be lower level uCs doing the grunt work of driving motors and capturing sensor data. I would expect all of the low level code to be written in C and it's pretty clear that Linux is written in C. OTOH, vision libraries may very well be written in Python. OpenCV supports a Python interface but it also supports C++ and Java. For this type of thing, I would want to use C++ for the speed. Interpreted languages, like Java and Python might slow down the process. Or not... Try them and see!Start with C, branch out to other languages as required. C++ is fairly easy to learn after C.

author: petert
author_rank: Regular Contributor
timestamp: March 19, 2020, 10:42:30 am
content: I am surprised nobody suggestedV-REP, an open source robot simulator.It's especially useful if you want to make an autonomous car, because it allows you to collect training data, by recording vision sensor frames. It also has car models and allows you to design/decorate the environment.The hardest part is training a reliable neural net.If you want to do it in real hardware, I definitely would start with a robotics kits and Arduino. It's easy to program servos/motors there, and the rest can be controlled in any language you wish, either remotely, or on the robot itself.Donkey Carhas become somewhat of a standard for the more ambitious hobbyist.

author: petert
author_rank: Regular Contributor
timestamp: March 19, 2020, 10:46:45 am
content: Quote from: krayvonk on October 10, 2019, 11:31:21 pmThat's what single board computers are for. Before that the small ITX boards were useful, too.There is a large variety today, from Raspberry Pi 4 to Nvidia Jetson Nano (good for deep learning).So yes, you could work on a desktop initially, for training or making the control code, then transfer it to a SBC.Controlling hardware, such as wheels, is still best done with a microcontroller, rather than trying to fight an OS or trying to use a real time one.

author: petert
author_rank: Regular Contributor
timestamp: March 19, 2020, 10:56:21 am
content: Quote from: Rick Law on July 30, 2019, 02:38:58 amIt's quite popular actually, for this purpose. You can control a toy car rather easily with Arduino, so it's fun. Then if you want vision based control, you can solve that with a SBC, that in turn controls the Arduino / delegates direct motor control to the Arduino.There is no reason to start with overly complex or overly optimized systems. If there are abstractions and higher level platforms, use them.Quote from: Rick Law on July 30, 2019, 02:38:58 amHow so? Most autonomous car projects from the well-known companies use a laptop and interface with the car using its CAN-bus (or similar interface). Add in a microcontroller and you are set. But you won't be allowed to do that anyways, so you can as well learn with toy cars. All you need is a camera, a SBC to process the image or other sensors, and a microcontroller to control the steering/motors.

author: MarkMLl
author_rank: Frequent Contributor
timestamp: March 21, 2020, 01:29:20 pm
content: Quote from: Irukandji on July 19, 2019, 12:15:12 pmFor some very constrained interpretation of the word "robotic".I'm sorry, but I date back to an era when "the white heat of technology" was going to provide us with intelligent and dextrous mechanical assistants in home, office and factory. But instead its greatest contribution to industrial productivity has been the invention of the vibrator.MarkMLl

author: brucehoult
author_rank: Super Contributor
timestamp: March 21, 2020, 01:57:00 pm
content: Quote from: petert on March 19, 2020, 10:56:21 amI think you'd find that while you might see a laptop, it's being used only to monitor what is going on, not to do the heavy work pf analyzing sensor data from cameras, LIDAR etc.There has been a bit documented about Tesla's current "HW3" full self-driving computer that has been going into their cars since mid 2019. There was a presentation on it at "Hot Chips" in August.https://www.anandtech.com/show/14766/hot-chips-31-live-blogs-tesla-solution-for-full-self-drivingIt has a ML accelerator with an array of 96x96 MAC units, 12x A72 CPUs, 1x GPU

author: petert
author_rank: Regular Contributor
timestamp: March 21, 2020, 11:25:35 pm
content: Quote from: brucehoult on March 21, 2020, 01:57:00 pmI have worked on robots in Uni, and that's what the laptops were used for: data processing (SLAM, LIDAR etc.), but also data visualization, and monitoring.QuoteCertainly, you could use accelerators, but you can get started without all that processing power.There is no reason to discourage people from getting into this, by making them believe you cannot do without all of that hardware. Actually, most accelerators did not exist when research started.An Arduino, a NVIDIA Jetson Nano, and (optionally a laptop) is perfectly fine for first steps. Research institutes use the more powerful Jetson platforms for actual products.

author: brucehoult
author_rank: Super Contributor
timestamp: March 22, 2020, 12:56:59 am
content: Quote from: petert on March 21, 2020, 11:25:35 pmPlaying around at home or at uni is very different from your "Most autonomous car projects from the well-known companies", assuming that by "well-known companies" you meant Tesla, Mercedes, Google etc rather than SparkFun.

author: petert
author_rank: Regular Contributor
timestamp: March 27, 2020, 06:35:58 am
content: The OP wanted to get into it, and asked this:QuoteQuote from: brucehoult on March 22, 2020, 12:56:59 amWhat you say just discourages for no reason, given the phrasing of the OPs question.What you call "playing around in uni" is the research that is the precursor for what we have today. Optimizing and refining are another question (though obviously, there is still a *lot* to do, even in professional systems, today).Unis who collaborate with the "big" companies do actually use what I mentioned previously. The algorithms are the same, the approaches, too. Actually MIT has an online course which does just that, and collaborates with Tesla. Mercedes collaborates with unis as well, and they do exactly that.Other unis collaborate with emergency services. Then there is the DARPA challenge.All of them do/did train and test with laptops/PCs originally, look it up. Over time they added accelerators, but it was not how it started. I know, because I participated (embedded AI accelerators are still new -- today NVIDIA is one of the largest players in the automotive market). A lot of training happens on PCs using simulations. But as mentioned already, you can have accelerators in small form factors today, such as the Jetson. The processing power suffices.My point being: you can perfectly get started without needing a real car. It's how most "real" companies did it, too. A lot of research even focuses just on the collected training data (and simulations). Calling that playing around is just unwarranted arrogance.

author: brucehoult
author_rank: Super Contributor
timestamp: March 31, 2020, 01:42:01 am
content: No, I'm not discouraging anyone from doing anything, and *especially* not from playing around with cheap hardware. Most of what I do myself is that kind of playing around -- no arrogance involved, it's a great way to learn.What I am doing is disagreeing with your assertion that laptops, K210 boards or even the Jetson are what serious autonomous driving companies such as Tesla are using.

author: petert
author_rank: Regular Contributor
timestamp: April 02, 2020, 03:56:51 pm
content: I think we agree on what matters most, then. I don't think the rest is worth debating, just that I saw how things developed over time as several projects started, before they got more professional. I am not making it up, and I am not playing, either. *shrugs*Anyways, peace.Edit, have some links:https://www.nvidia.com/en-us/self-driving-cars/partners/mercedes/and more generally:https://www.nvidia.com/en-us/self-driving-cars/partners/https://en.wikipedia.org/wiki/Nvidia_DriveThis also shows that Jetson is meant as en entry product for development:https://developer.nvidia.com/drive/faqThen there are these links:https://developer.nvidia.com/embedded/community/jetson-projectshttps://developer.nvidia.com/embedded/diy-ai-raceThe hardware shares a lot in common, the software can be used on various platforms, the major difference are performance and connectivity options. When you look at the timeline of the product development (of the hardware accelerators), they are quite new. Software development for autonomous driving however is not that recent. Even GPU computing in professional contexts is relatively new. I.e., there was no other option but using normal computers and laptops (and embedded controllers for sensors). I would consider that serious work (and development).That's just what a quick search could find, a lot of projects have no public website.Tesla decided to get as much in house as possible, this is not what most manufacturers do, and not how Tesla started either.https://electrek.co/2017/08/09/tesla-autopilot-2-5-hardware-computer-autonomous-driving/Quote

author: eugenenine
author_rank: Frequent Contributor
timestamp: April 02, 2020, 07:24:15 pm
content: Don't get stuck on one language, there are many to choose from and all have advantages and disadvantages depending on the use.In college I started with Pic microcontrollers and programmed them with assembly (Parallax's 8051 like at the time) and designed a complex robot where it had a network of tiny PIC micontrollers which could more parts and read sensors and perform 'reflex' actions quickly which communicating with another central processor (68k at the time) running a higher level language. So I was planning for at least two languages just for one robot.

author: norn
author_rank: Newbie
timestamp: May 20, 2020, 04:01:06 pm
content: My 2 cents would be to learn C++/Python and start playing around with ROS. One of the great things about ROS is you can start programming robots without any robotic hardware at all! Gazebo is a simulator that connects really well with ROS to let you simulate many robots that most of us could never dream of affording. You can "program" the robot in C++ or Python.To get real, fundamental knowledge about how robots work, I would recommend building a 2 wheeled differential drive robot from scratch. You will lean a lot from this process. Try getting it to drive in a straight line! Not as easy as it might sound.

author: rpiloverbd
author_rank: Regular Contributor
timestamp: December 01, 2021, 09:33:56 am
content: The question is very old but I am still answering. Newcomers may find it helpful. I think it's always better to start with basic C. Then move to microcontroller programming like programming AVR or PIC microcontrollers in C. Then start Arduino and the list goes on----

author: Vtile
author_rank: Super Contributor
timestamp: January 16, 2022, 11:10:20 am
content: Arduino ecosystem is way to go for learning (and seriuous "non production" projects). I wish there would have been such when I was learning the ropes (or even interpret basics consoles etc. which now are again found after some 10..20 year hibernation).In my opinion you need to differentiate two different layers of systems. The layer where many tote the C-language family, that is the control electronics hardware layer, where all the heap and other memory wanking "REAL programming" happens, in this layer your system knowledge focus is inward to uCUs and chips or computer internals. Second layer is the operational layer of system where your focus is outwards, how the environment and process you need to operate will behave. Your system knowledge is therefore not in the control device hardware (not only), but on instrumentation, logic, chemistry, physics etc. in this level you do not want to be heap wanking the memory etc. real programmers do that, but have full freedom (timely) to design and implement the contol of external things without the need to invest a huge amount to babysit the controller system itself. This dualism is not separation between Ie. object orientation vs procedural language, but general focus and abstraction of tasks.Mentioned Forth is harder to start with and is niche language for certain fields (some exposure to it might not be a bad thing as it is so different), ie. in space exploration due to its nature of on-fly (re-)programmability as hybrid compiled & interpreted RTOS&program model, it was (is?) also used in some firmware layers.All that said, I wish there would have been Arduino available, when I did ask same type of questions.Tl:dr There is no such thing as "real programmers", closest to that do get computer scientist, but internet knows that those usually are wrong and are not true real programmers.

author: rpiloverbd
author_rank: Regular Contributor
timestamp: February 01, 2022, 12:46:51 pm
content: You can easily do it with Arduino.