Notifications
Clear all

c++ for coding higher levels?

10 Posts
5 Users
0 Likes
1,561 Views
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
Topic starter  

From a thread in the Python section:

Posted by: @frogandtoad

@casey

Posted by: @casey

Its been over a decade since I last used C++ and when I decided to refresh my memory on how to program a game in C++ using the window's API from some books I had the code refused to compile with the code::blocks ide I had downloaded.Β  Apparently the code was written before c++ 11.Β  No doubt there was a work around but it made me decide not to bother with it.Β 

Unfortunately, this is not the fault of the language per se, but more so to do with the evolution of the IT world.Β  If you work in IT, then you will appreciate that one has to forever update their skill set, be it programming, networking, cloud, ITIL, etc... MS continually change languages just about every decade, so this experience is nothing new.

Having said that however, both C and C++ have stood the test of time for one good reason, and that is their portability to compile the same code on every platform, with the caveat that you only stick to the language as strictly defined in the ISO standard - Obviously you will need to have a compiler that supports the latest standard features on each target platform, but it does work extremely well if you stick to the standard.

Granted, python offers faster prototyping, but if a programmer is proficient in C or C++, then the speed to prototype something is really negligible, IMO of course πŸ™‚

Cheers!

Β 

Honestly I like c++ probably because of my familiarity with it. Last night I fired up code blocks to test out some example code using tuples just out of curiosity.

I started years ago with Turbo-C on the old MSDOS machines.Β  When Windows came on the scene it became complicated.Β  The brick wall for me is the developmental environment. It was never explained properly. Unlike other languages where you import or include a library and it just worksΒ  with c++ you have to set up a "project" and set linker values and so on ... I just couldn't seem to get it right even when carefully following the steps required to set up a library.Β  Actually I did manage to do some C++ graphics using SDL2 and the lazyfoo tutorials.
https://lazyfoo.net/tutorials/SDL/01_hello_SDL/index.php

So I really do like c++ and with the right graphics library would probably be able to translate my simple FreeBASIC programs to c++.Β  Β At the moment I am using FreeBASIC to communicate with the Arduino which handles the low level stuff.Β  So the biggest obstacle I see with c++ comes back to how to make use of libraries and a lack of tutorialsΒ  like the Processing tutorials by this hyped up presenter on image processing.

Β 


   
Quote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@casey

Posted by: @casey

I started years ago with Turbo-C on the old MSDOS machines.Β  When Windows came on the scene it became complicated.Β  The brick wall for me is the developmental environment. It was never explained properly.

I worked with Turbo as well πŸ™‚
Indeed, IDE's (especially way back when), were and still can be very confusing... I still find Visual Studio confusing, as there are just too many bells and whistles and you virtually have to find a needle in a haystack!Β  Even VSCode is slowly bloating up to that level from what it first started out being... maybe time to go back to "Brackets" or "Atom" editors, which btw are very good, and some say better!

The library you use will generally have instructions, but basically you're just including their directory with headers and compiled library (object files) which your IDE will need to be set to find paths, etc... once that's done it shouldn't be too difficult to use at all.

I'll check out the lazyfoo link soon.

LOL, just had a quick look at the presenter... indeed he is quite hyped up, but pretty entertaining.Β  Processing looks like a pretty good tool though, and based on Java which is very similar in syntax to C++ might be worth looking into.

If you have any difficulty with C++, feel free to post your questions and I or someone else will try to help.

Cheers!


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
Topic starter  

There are versions of Processing to run on the RPi and the Android OS.

And communicate with an Arduino.

https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all

Spent some many months dabbling full time with Java programming but for reasons I will not expand on I ditched it as not for me.

Β 


   
ReplyQuote
Duce robot
(@duce-robot)
Member
Joined: 5 years ago
Posts: 674
 

@casey

I like the arduino ideΒ  I don't know much about code I still have to get in to python I wonder how much python code will actually be in this project? It seems like most of it will be arduino style c I started my own motor control sketch very simple backward forward right turn left turn stop delay Jeremy Blum did a simple sketch using for loop I'm sure I can cannibalize that and use it .I guess the motor sketch shouldn't be that complicated .I guess the ai part of it just tells it where and when to go forward or backward left right stop and delay or interrupted stop .and that is the hard part the big part of the program I'm just curious what language that will be in.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
Topic starter  

@Duce robot wrote:Β  I like the arduino ide I don't know much about code I still have to get in to python I wonder how much python code will actually be in this project?

Which project are you referring to?Β  DB1?Β  My understanding DB1 will be using ROS running on a Jetson Nano and probably using Python as a high level language?

Duce robot wrote: I guess the motor sketch shouldn't be that complicated.

Depends on what kind of control you want. What are the details of your motors? Do they have encoders? There are those here that can write and explain an Arduino motor sketch for you.Β  You might just start with a remote control using a joystick?Β  If you want to walk around with the robot you don't even need radio control all you need are wires from the joystick to the robot.Β  Later you can replace yourself with some AI controlling the equivalent of a joystick (2 pwm analog values from the Arduino).

https://dronebotworkshop.com/nrf24l01-wireless-joystick/

Β 

Β 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@duce-robot

I like the arduino ide

The Arduino IDE is just a glorified text editor.

Today, I had to make some changes on a sketch (about 270 lines of code) and what I miss in the Arduino IDE is the ability to highlight the piece of code where I need to make multiple "find and replace" and restrict the changes to the selected code.

So I just ran it into Textwrangler, instead!


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @casey

My understanding DB1 will be using ROS running on a Jetson Nano

I'm curious where you got this information?Β Β  I don't recall hearing Bill say this.Β  But then again I sometimes miss the details.Β Β  I would like to see Bill offer up a bird's-eye-view of the DB1 project with detailed block diagrams so we can have a good idea of exactly where he's going with it.Β  I don't recall seeing anything that detailed.

Posted by: @pugwash

The Arduino IDE is just a glorified text editor.

What I really miss on the Arduino IDE is the intellisense.Β  I like an editor that remembers all my variable and function names so I can just click on them and not have to remember them and type them in from scratch all the time.Β  I tend to use long variable names like rightMotorEncoder, rather than rME or something like that.Β  I don't like using short meaningless abbreviations.Β Β  I tend to forget what they mean.Β  It also makes things more difficult when using the Find and Replace when I want to rename something.Β  Something like rightMotorEncoder will be easy to find and replace.Β  But sometimes a short sequence of letters can actually be replaced in the middle of other words!Β Β  I've had that happen before and it's no fun.Β  So I prefer an IDE editor that can remember and offer up long variable names so I don't need to keep typing them in from scratch.

If the Arduino IDE had intellisence, even for just remembering names I've created for variables and functions, that would be really helpful.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
Topic starter  
Posted by: @robo-pi
Posted by: @casey

My understanding DB1 will be using ROS running on a Jetson Nano

I'm curious where you got this information?Β Β  I don't recall hearing Bill say this.Β  But then again I sometimes miss the details.Β Β  I would like to see Bill offer up a bird's-eye-view of the DB1 project with detailed block diagrams so we can have a good idea of exactly where he's going with it.Β  I don't recall seeing anything that detailed.

Sorry my memory is playing tricks on me. I must be confused because I see continual talk of the Jetson Nano and it was mentioned in the Robotics > DB1 Robot Project > Intelligence Layer section and there was a section on ROS?Β  However doing a search I see he hasn't decided on the main board but was currently looking at the the HiKey970.Β  I guessed Python because that is widely used. So I apologise as I essentially I have no idea then what the intelligence layer is going to look like.

So no one knows what parts the intelligence layer will have or what language its code will be written in?

https://forum.dronebotworkshop.com/ros/db1_r1-design-goals/#post-2715

Β 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @casey

So no one knows what parts the intelligence layer will have or what language its code will be written in?

I can only speak for myself.Β Β  If that information exists, I'm not aware of where to find it. ?Β 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @casey

> https://forum.dronebotworkshop.com/ros/db1_r1-design-goals/#post-2715 <

I think in that thread Twobits was proposing a ROS version of DB1 that he was going to call DB1-R1

I don't think Bill was suggesting that he was necessarily going to be using ROS on DB1.Β Β Β  Whether he will end up doing that or not I have no clue.Β Β  In some ways I'm kind of hoping he won't go the ROS route.Β Β  But then again, if he does choose to go with ROS he'll most likely make videos on precisely how to install it and use it.Β Β  That might be ok considering how thorough his instructional videos typically are.

It will be interesting to see where Bill decides to ultimately go.Β Β  Bill is currently soundproofing the DroneBot Workshop.Β  The idea is that when he's finished with the soundproofing he'll be able to make a lot more videos.Β  So hopefully at some point we'll be flooded with videos. ?Β 

Β 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote