c++ for coding higher levels?  

  RSS

casey
(@casey)
Reputable Member
Joined: 10 months ago
Posts: 359
2020-01-16 11:20 pm  

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.

 

This topic was modified 2 months ago 3 times by casey

Quote
frogandtoad
(@frogandtoad)
Reputable Member
Joined: 9 months ago
Posts: 384
2020-01-18 6:02 am  

@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!

This post was modified 2 months ago by frogandtoad

ReplyQuote
casey
(@casey)
Reputable Member
Joined: 10 months ago
Posts: 359
2020-01-18 8:43 am  

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.

 

This post was modified 2 months ago by casey

ReplyQuote
Duce robot
(@duce-robot)
Reputable Member
Joined: 9 months ago
Posts: 412
2020-01-18 9:25 am  

@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
casey
(@casey)
Reputable Member
Joined: 10 months ago
Posts: 359
2020-01-18 10:13 am  

@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).

Wireless Joystick for Arduino Robot Car with nRF24L01+

 

 

This post was modified 2 months ago 2 times by casey

ReplyQuote
Pugwash
(@pugwash)
Prominent Member
Joined: 10 months ago
Posts: 969
2020-01-18 12:07 pm  

@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!

This post was modified 2 months ago by Pugwash

SteveC - Topple Rudd Poltman


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1590
2020-01-18 4:01 pm  
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
casey
(@casey)
Reputable Member
Joined: 10 months ago
Posts: 359
2020-01-18 7:42 pm  
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

 

This post was modified 2 months ago 2 times by casey

ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1590
2020-01-18 8:11 pm  
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 Moderator
Joined: 10 months ago
Posts: 1590
2020-01-18 8:23 pm  
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

Please Login or Register