A precise way to transmit analog signal to a long distances using frequency modulation.
Use timer/counter instaed of anatog-to-digital convertor (ADC).
Class hierarchy and relationships of some part of machine control software. It was designed using plantuml.
Utility functions to start your ssh agent when using fish shell. You
will only need to run ssh-add
and type your password once,
after the running ssh_agent should do the work for you.
fish_ssh_agent
wget https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P ~/.config/fish/functions/
Append next line to ~/.config/fish/config.fish
fish_ssh_agent
Add this line to ~/.ssh/config
AddKeysToAgent yes
With option enabled keys used by ssh will be automatically added to
ssh-agent. No need to call ssh-add
.
https://gitlab.com/kyb/fish_ssh_agent
https://github.com/ivakyb/fish_ssh_agent
byte_vector is a family of C++ types and functions to provide next functionality:
byte_vector
is a struct extended from
std::vector<uint8_t>
.
It provides ability to serialize and deserialize C++ basic types and
classes by using family of template operators
byte_vector<<
and
byte_range>>
.
Lets consider example program byte_vector-demo.cpp
#include "byte_vector.hh"
using namespace std;
using namespace std::literals;
struct X{
int a=1111111;
short b =2;
= "asd";
string c
friend ostream& operator<<(ostream&os, X const& x){
return os<<x.a<<" "<<x.b<<" "<<x.c;
}
friend byte_vector& operator<<(byte_vector&bv, X const& x){
return bv<<tuple(x.a,x.b,x.c);
//OR return bv<<x.a<<x.b<<x.c;
}
friend byte_range& operator>>(byte_range&br, X&x){
return br>>tie(x.a,x.b,x.c);
//OR return br>>x.a>>x.b>>x.c;
}
};
int main()
{
{
;
byte_vector bv<<1312314151617;
bv<<byte_range_ascii{bv}<<endl; /// 0x000: 00 00 01 31 8C 04 D2 C1 |...1....|
cout<<byte_range_ascii{bv<<short(32)}<<endl; /// 0x000: 00 00 01 31 8C 04 D2 C1 00 20 |...1..... |
cout<< "Hello"s << " world"sv << '!' ;
bv<<byte_range_ascii{bv}<<endl; /// 0x000: 00 00 01 31 8C 04 D2 C1 00 20 00 05 48 65 6C 6C |...1..... ..Hell|
cout} /// 0x010: 6F 00 06 20 77 6F 72 6C 64 21 |o.. world!|
<<"----------------"<<endl; /// ----------------
cerr{
/// Serialize custom struct
; //bv={};
byte_vector bv<<X{2344567,-1,"hello"};
bv<<byte_range_ascii(bv)<<endl; /// 0x000: 00 23 C6 77 FF FF 00 05 68 65 6C 6C 6F |.#.w....hello|
cout(bv);
byte_range br/// Deserialize custom struct
;
X x>>x;
br(br.size()? cout<<byte_range_ascii(br) : cout<<"<empty>")<<endl; /// <empty>
<<x<<endl; /// 2344567 -1 hello
cout}
}
This is an output from ./byte_vector-demo
0x000: 00 00 01 31 8C 04 D2 C1 |...1....|
^^^^^^^^^^^^^^^^^^^^^^^ 8 byte int
0x000: 00 00 01 31 8C 04 D2 C1 00 20 |...1..... |
^^^^^ 2 byte short
0x000: 00 00 01 31 8C 04 D2 C1 00 20 00 05 48 65 6C 6C |...1..... ..Hell|
0x010: 6F 00 06 20 77 6F 72 6C 64 21 |o.. world!|
^^^^^ string length 2byte value 5
^^^^^ string_view lenght 2byte value 6
----------------
0x000: 00 23 C6 77 FF FF 00 05 68 65 6C 6C 6F |.#.w....hello|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ custom struct of int,short,string
^^^^^^^^^^^ int
^^^^^ short value -1
^^^^^ string length 5
^^^^^^^^^^^^^^ string data of 5 bytes
<empty>
^^^^^^^ after deserialization
2344567 -1 hello
^^^^^^^^^^^^^^^^ deserialized struct in text format
Build and run it with:
cmake -Bbuild && cmake --build build && ./build/byte_vector-demo
I suggest to use git subrepo instead of git subtree and git submodule.
git subrepo clone git@gitlab.com:kyb/byte_vector.git byte_vector
Then add byte_vector project directory to includes.
Download amalgama header from the project's releases page
cd your/project/include_dir
curl -fsSL https://gitlab.com/kyb/byte_vector/raw/artifacts/master/$(curl https://gitlab.com/kyb/byte_vector/raw/artifacts/master/byte_vector.hh -fsSL) -o byte_vector.hh
target_link_libraries
with interface
libraryAssuming the repo has been already cloned as sugested in
(1)
Since byte_vector
this is header-only library there is no
need to link with it. But CMake has feature INTERFACE LIBRARIES.
byte_vector provides two interface libraries: byte_vector
and byte_vector_amalgama
. Linking against them addes
include directory to the target.
byte_vector
target_link_libraries(your_executable PRIVATE byte_vector)
#include "byte_vector.hpp"
#include "byte_range.hpp"
#include "byte_range_ascii.hpp"
#include "byte_range_hex.hpp"
byte_vector_amalgama
target_link_libraries(your_executable PRIVATE byte_vector_amalgama)
#include "byte_vector.hh"
࿗ is a well-tested calculator of linearly accelerated and decelerated motion.
࿘ это ладно проверенный калькулятор равноускоренного движения.
It calculates the positions at which motor speed should be changed. Usually it is enough to change speed from 100 to 10 times per second. Change speed after every step is inefficient.
༄ The calculator itself is a one-header class.
࿐ Supplied with Qt project to show chart.
Motion parameters are set in
main.cpp
:
mo.accel = 5000;
mo.decel = 8000;
mo.speedUpdatePeriod_ms = 25;
mo.initialPosition = -0;
mo.targetPosition = 2500;
mo.wantedSpeedAfterAccel = 3000;
For more details see the simpliest example
main-stdout.cpp
.
Here its output.
Hello, Motion!
%span mo:{
dV_accel_: 150
dV_decel_: 150
Vc_: 6000
Xa_: 6000
Xc_: 42200
Xb_: 3000
Ta_: 2
Tc_: 8.03333
Tb_: 1
}
vecVx
posSpd:{ pos: 15, spd: 300 }
posSpd:{ pos: 34, spd: 450 }
posSpd:{ pos: 60, spd: 600 }
posSpd:{ pos: 94, spd: 750 }
posSpd:{ pos: 135, spd: 900 }
....
posSpd:{ pos: 51170, spd: 600 }
posSpd:{ pos: 51193, spd: 300 }
posSpd:{ pos: 51200, spd: 0 }
vec.size(): 60
For calculator itself only
C++14
required and it is suitable for embedded devices like microcontrollers. It successfully works on ARM Cortex-M3, M4, M7.
To build and run project on desktop with chart you need Qt-5.9 or later. Earlier versions not tested.
Works well under Windows, Ubuntu Linux 16, and embedded uC Cortex-M7.
cd /path/to/my/workspace
git clone https://gitlab.com/kyb/accdecel.git
cd accdecel
mkdir build-qmake && cd build-qmake
qmake ..
make
./accdecel
Enjoy!
Hello. Nice to meet you on my page.
I am Ivan Kuvaldin, a software developer with good mathematics and electrical background. I like to design electronic systems and software for them – create machines and bring them to life. I also create things in virtual world - websites and programs, software infrastructures. My main idea is to teach machines help humanity on our way to unconditional beauty.
Hello. Nice to meet you on my page.
I am Ivan Kuvaldin, a software developer with good mathematics and electrical background. I like to design electronic systems and software for them – create machines and bring them to life. I also create things in virtual world - websites and programs, software infrastructures. My main idea is to teach machines help humanity on our way to unconditional beauty.
Drive the team to successful release of reliable, reusable, extensible and handy application.
Think C++. Write code in C++ using modern frameworks. Write reliable, reusable, readable and extensible programs.
Create continuous integration / continuous deployment systems for any kind of software. Build, test, deploy applications in multiple environments with multiple configurations in various combinations.