2024-10-29(6): Project: Git, C++, Status
Project Status
(DONE) Motor Control: BTN9960LV
PWM test prog configures PWM pin, but leaves it in non-functional state after exit.
Fork there? Added test prog there? CMakery?
Perform manually the steps that the program makes
Look at program
Fix program
See how program should make use of toolcase/base/sysfs-file.h
⟶ CMakery
(DONE) RC Servo Control
Check WiringPi: fork there? WiringPi test prog there?
Clarify WiringPi is not an option:
WiringPi test prog
If not: my Pi:
~/myapp.cExplain
/dev/mem(man -s 4 mem)
In the long term, we will have to use PCA9685A anyway: we need 3 PWM pins in total, and the Pi has (at most?) 2. Best to give up.
In case somebody want to try Pi nonetheless: https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md
There appear to be clock issues ahead, as https://github.com/raspberrypi/linux/issues/1533 indicates. Beware.
(CLOSED) Proximity Sensor: VL53L1X
Hmm. C++ needed. Wait a few hours, we’ll get to that.
⟶ what would a
class VL53L1Xlook like?
(ACTIVE) Gyroscope (BNO055)
Fork there? Test prog there? CMakery?
Commandline program where we can try around
⟶ what would a
class BNO055look like?
Configuration Management (Err, Git)
C++: OO Basics
From Data Encapsulation …
From Functions and Methods …
Live hack that into the ubiquitous class point (see
livecoding/point.cpp)
Homework Until 2024-11-05
Intro
Sensors
Two relatively autonomous tasks, (CLOSED) Proximity Sensor: VL53L1X and (ACTIVE) Gyroscope (BNO055). Good luck 🥷
Motor Controls
We have two PWM users, so we want to coordinate. Write a tool for it,
class SysFSPWMPin can then be used from
So please lets …
Sync your fork with upstream
Read through specific “workpackage” descriptions below
(Talk about it here: 2024-11-05(6): Project, Sysprog Recap)
“Sync Your Fork” (Github term)
Please update your fork with the upstream changes from https://github.com/jfasch/FH-STECE2022.
See Working with Git In Our FH-ECE21 Project about that workflow, especially Multiple Pull Requests: Pulling Upstream Changes (“Syncing” A Fork).
What is new there:
A failing unit test or two for (DONE) PMW Abstraction On Top Of /sys/class/pwm/
Fixes for
proximity-vl53l1x, see proximity-vl53l1x/proximity-vl53l1x/bin/CMakeLists.txtFixes, and more tests for class SysFSFile (toolcase/base/sysfs-file.h) where we can use common code from.
[jfasch@jflaptop ~/My-Builds/FH-STECE2022-x86_64]
$ ./tests/fh-stece22-suite
...
[ RUN ] sysfs_pwm_pin_suite.get_period
/home/jfasch/My-Projects/FH-STECE2022/tests/sysfs-pwm-pin-tests.cpp:41: Failure
Expected equality of these values:
pin.period()
Which is: -666
PERIOD_NS_INIT
Which is: 10000000
[ FAILED ] sysfs_pwm_pin_suite.get_period (0 ms)
[ RUN ] sysfs_pwm_pin_suite.add_your_own_tests_here
/home/jfasch/My-Projects/FH-STECE2022/tests/sysfs-pwm-pin-tests.cpp:53: Failure
Failed
...
Think About Servo Interface (Group (DONE) RC Servo Control)
(SysFSPWMPin is done already, so lets focus on the servo)
How would a servo class look like? See “Software Interface” in (DONE) RC Servo Control for an idea.
Write a test for it, much like tests/sysfs-pwm-pin-tests.cpp
The fixture for the servo tests looks the same as that of the pwm pin tests (
struct sysfs_pwm_pin_suite); simply copy it. We can pull out common code later.A first test could look something like,
SysFSPWMPin pwm7(dirname); DerEineRCServoUeberPWM rc(pwm7); rc.set(0.0); // middle position ASSERT_EQ(pin.duty_cycle(), 500000); // or whatever you would expect rc.set(-45.7); ASSERT_EQ(pin.duty_cycle(), 1500); // or whatever you would expect
It is not straightforward to implement a mapping from a range of floating point values to one single duty_cycle value. It is easier though if you know what you want and start from there, so lets write the test first.
Halfbridge Horror (Group (DONE) Motor Control: BTN9960LV)
Tinker With Hardware, Think About Future.
Figure out how to operate the halfbridges
Can we use a comparator to operate both in parallel, using one PWM?
Do we need two?
Ask for permission to publish a copy of the schematic and print under GPLv3 in our repo.
Think about how this can be done in software
VL53L1X (Group (CLOSED) Proximity Sensor: VL53L1X)
Make it work, simply
BNO055 (Group (ACTIVE) Gyroscope (BNO055))
Figure out what we need, by trying around with the commandline program that you brought
How could a
class BNO055look like?