Who knew you can use C++ to eat pickles?

Pretty cool, figured out that C++ can read the .list_of_serial_numbers.pkl file into a string and use:

if (serials.find(serial) != string::npos) {
    ticks = 16;
}
else {
    ticks = 6;
}

to set the encoder ticks value if no gpg3_config.json file exists.

(Ignore my non-standard C++ bracing - hate those things, and the semi-colons too, and compiling for that mater, and having to include standard libraries, and should I mention I taught C++ in 1987 and hated it then too. Templates? bah humbug! )

2 Likes

Interesting. I guess the pkl file is just ascii text in this case??
/K

2 Likes

The serial texts are wrapped with non-printable info, but when I read it in as a string stream the text is searchable:

??~]?(? 00A513C35152415447202020FF192B1C?? 0183223A5152433037202020FF192335?? ... 01AC27D85152415447202020FF192427.

Since the file only has the serial texts, it is not likely to have a matching fake serial from non-text variables being serialized into the file with the text.

This is a test case where no gpg3_config.json file is found, and the serial is in the list of 16 tick GoPiGo3s:

./json_str 
gpg3_config: ""

processing key: wheel-diameter
wheel_diameter: 66.500

processing key: wheel-base-width
wheel_base_width: 115.000

processing key: ticks
CE43EA875152415447202020FF192608 found: true
ticks: 16

processing key: motor_gear_ratio
motor_gear_ratio: 120

If the serial is not found, it sets ticks to 6, and if found to 16.

Slow but steady progress. Have to integrate this stuff into the GoPiGo3.cpp class tomorrow.

I can’t wait till I can forget C++ again. Python is just so comfortable to code in.

3 Likes

Then why are you doing it?

2 Likes
  1. gives me a goal that will produce something of value to someone else (not likely to be anyone, but it is part of my dream for the GoPiGo3)

  2. Provides a set of specific programming tasks to refresh my C++ knowledge and to compare with Python

  3. I hit the processing limit of a single Pi4 with my Python ROS2 GoPiGo3 doing mapping, leaving no “headroom” for navigation or a decision tree controller, (the functionalities needed to complete an autonomous ROS mobile robot).

Supposedly C++ can do the same ROS2 GoPiGo3 functions in 1/7th to 1/10th processing load, so I want to reimplement my ROS2 GoPiGo3 and sensor drivers in C++.

The GoPiGo3 C++ API is very basic compared with the Python GoPiGo3 (and EasyGoPiGo3) API and because Dave is a “16 tick” GoPiGo3 the Python load_robot_constants() function is the first place to start (and possibly the most complex coding challenge I expect in this).

  1. Because I am CyclicalObsessive?
3 Likes

And Carl is laughing with his triple speech recognition (key word spotting, command grammars, and large vocabulary tri-gram language model modes) with autonomous decisions, power management, advanced logging, odometry, and self health “awareness” averaging only 15% of a RPi3B, not even a 3B+ or the power packing Li-ion supercharger!

(But he never finished the task of learning to map his room that ROS dangles in front of Dave. It is entirely possible Carl could learn to map and navigate with less effort on my part than for Dave to learn mapping, navigation, and decision trees, but Carl’s advances don’t have the possibility of reuse by others that Dave’s ROS2 successes may have.). Again I am dreaming of the great herd of GoPiGo3 fans materializing.

And how much I miss @RobertLucian creating code for the GoPiGo3.

2 Likes

He’s off building his own AI-based startup now.

3 Likes

Jim, you always ask some version of this, and inevitably get some version of the same answer:

and [because it’s a]

and

:slight_smile: /K

2 Likes

I ask that when he says “I’m pounding my head against a wall” or “a unicorn” and expresses the idea “I must be a masochist”.

If he doesn’t enjoy it, why do it?

I haven’t messed with my robots for a while because I’m so bummed out over the lack of support I have been getting and the criticisms about “playing [with] toys” as if it’s a completely useless thing to do.

Interestingly enough, “playing” with the flight simulator doesn’t get criticized.  Go figure.

But that’s me.

BTW, I renewed my SSL certificate for “gopigo.com” (gopigo3.com) and will be renewing the domain soon.

Anyone who needs a “secure” domain for their GoPiGo robot is welcome to use it.

2 Likes

wait, what?? you own gopigo.com ??
Since when?

3 Likes

Oops!

gopigo3.com

I registered that for my web browser controlled robot and got a Commodo ssl cert for it.

I needed a real cert to use a joystick within a browser script.

Sorry for the heart-attack!

2 Likes

Progress! C++ versions of check_serial_number_for_16_ticks() and load_robot_constants() working today (and instance variables for the “constants”):

 ./drive 

**** GoPiGo3 Robot Constants:
 - WHEEL_DIAMETER: 66.100 mm
 - WHEEL_BASE_WIDTH: 105.590 mm
 - ENCODER_TICKS_PER_ROTATION: 16
 - MOTOR_GEAR_RATIO: 120

****
        fwd w 
 left  a  spin s   d  right
            bkwd x 
****

Cmd: (q to exit): q

Tested for no gpg3_config.json file, and for serial found/not-found in the .list_of_serial_numbers.pkl file - so ready to move on to set and save robot_constants() APIs tomorrow.

2 Likes

More of a description of why ROS makes sense for industrial robots. But still…

/K

2 Likes

I’m happy you found a way to make C++ work, but I remember moving away from pkl to a json file. Did I forget to push it to Github? Did I dream about it?

2 Likes

Ok, it’s definitely not on Github, so maybe I’m dreaming…

2 Likes

Perhaps you were remembering this file along the way to remove some from the pkl list?:

2 Likes

You know that repo better than I do by now LOL!
I’m all for it!

Yes, it might be that indeed.

3 Likes