COMMENTARIUM


  • Home

  • Archives

  • About

Untitled

Posted on 2024-11-01

PolulateTrajectoryProtobuf: write data into ADCTrajectory

Untitled

Posted on 2024-11-01

any_cast doc: https://en.cppreference.com/w/cpp/utility/any/any_cast

This blog explains the std::any_cast behavior. The std::any_cast is a template function that casts std::any to a reference to the type T stored in the std::any. The std::any_cast function is used to retrieve the value stored in the std::any object. The std::any_cast function is a non-throwing function. If the std::any object does not contain a value of type T, the function returns a null pointer.

Some examples are shown below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <string>
#include <any>

using namespace std;

int main() {
// explain the difference between auto& and auto
auto a1 = any(12); //necessary
a1 = string("test");
auto& s = any_cast<string&>(a1);
s[0] = "s";
cout << any_cast<string const&>(a1) << endl; // output sest
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <string>
#include <any>

using namespace std;

int main() {
auto a1 = any(12); //necessary
a1 = string("test");
auto s = any_cast<string>(a1);
s[0] = "s";
cout << any_cast<string const&>(a1) << endl; // output test
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include <any>
#include <cassert>
#include <unordered_map>
#include <memory>
using namespace std;

void test1() {
auto a1 = any(12);
a1 = string("test");
auto& ra = any_cast<string&>(a1);
ra[0] = 's';
assert(any_cast<string const&>(a1) == "sest");
return ;

}

void test10() {
auto a1 = any(12);
a1 = string("test");
auto ra = any_cast<string>(a1); // cannot use auto& if any_cast<string>, will compliation error
ra[0] = 's';
assert(any_cast<string const&>(a1) == "test");
return ;

}

void test2() {
unordered_map<string, any> m;
m["s"] = string("test");
auto& ra = any_cast<string&>(m["s"]);
ra[0] = 's';
assert(any_cast<string const&>(m["s"]) == "sest");
//cout << s << endl;
return ;
}

int main() {
test1();
test10();
test2();
return 0;
}

Lead Lag Control

Posted on 2022-10-09 | In computer_science

Introduction

This is still a draft.
This blog explains the lead lag control. The lead lag control is a control system that combines the lead and lag control. The lead lag control is used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system.

The main reference is Lead-Lag Control.

Before we start, we assume that the reader has basic knowledge of control system. If you are not familiar with the control system, please read Control System first. Also, model predictive control is a crucial part of the control system. If you are not familiar with the model predictive control, please read Model Predictive Control first.

Now, let’s start.

Lead Lag Control

The lead lag control is a control system that combines the lead and lag control. The lead lag control is used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system. The lead lag control is also used to compensate for the time delay in the control system.

Model Reference Adaptive Control

Posted on 2022-10-09 | In computer_science

Introduction

This is still a draft.
https://www.mathworks.com/help/slcontrol/ug/model-reference-adaptive-control.html?searchHighlight=real&s_tid=doc_srchtitle

Coordinate Transformation

Posted on 2022-09-30 | In computer_science

Introduction

This is still a draft.

This blog post is about coordinate transformation. I will use the Coordinate Transformation as a reference.

There are multiple types of coordinate transformation. The most common ones are the rotation, translation, and scaling. The rotation is used to rotate the coordinate system. The translation is used to translate the coordinate system. The scaling is used to scale the coordinate system.

The first one is world coordinate system. The world coordinate system is the coordinate system that is used to describe the world. The second one is the camera coordinate system. The camera coordinate system is the coordinate system that is used to describe the camera. The third one is the image coordinate system. The image coordinate system is the coordinate system that is used to describe the image.

The road coordinate system is the coordinate system that is used to describe the road. The road coordinate system is the coordinate system that is used to describe the road. The road coordinate system is the coordinate system that is used to describe the road. The road coordinate system is the coordinate system that is used to describe the road.

Frenet system commonly used in autonomous driving systems. The planning module uses the Frenet system to describe the road. The planning module uses the Frenet system to describe the road. The planning module uses the Frenet system to describe the road. The planning module uses the Frenet system to describe the road.

Transform world to camera coordinate system is done by the following equation: $$\begin{bmatrix} x_{camera} \ y_{camera} \ z_{camera} \end{bmatrix} = \begin{bmatrix} R_{camera_world} & T_{camera_world} \end{bmatrix} \begin{bmatrix} x_{world} \ y_{world} \ z_{world} \ 1 \end{bmatrix}$$

Transform world to frenet coordinate system is done by the following equation: $$\begin{bmatrix} s \ d \ \dot{s} \ \dot{d} \end{bmatrix} = \begin{bmatrix} R_{frenet_world} & T_{frenet_world} \end{bmatrix} \begin{bmatrix} x_{world} \ y_{world} \ z_{world} \ 1 \end{bmatrix}$$

Transform camera to frenet coordinate system is done by the following equation: $$\begin{bmatrix} s \ d \ \dot{s} \ \dot{d} \end{bmatrix} = \begin{bmatrix} R_{frenet_camera} & T_{frenet_camera} \end{bmatrix} \begin{bmatrix} x_{camera} \ y_{camera} \ z_{camera} \ 1 \end{bmatrix}$$

Transform frenet to world coordinate system is done by the following equation: $$\begin{bmatrix} x_{world} \ y_{world} \ z_{world} \end{bmatrix} = \begin{bmatrix} R_{world_frenet} & T_{world_frenet} \end{bmatrix} \begin{bmatrix} s \ d \ \dot{s} \ \dot{d} \end{bmatrix}$$

A reference line is a line that is used to describe the road. It is commonly described by baze points.

What is bazel curve? Spline wiki page is (https://en.wikipedia.org/wiki/Spline_(mathematics)). Spline is a curve that is used to interpolate the data points. The spline is a curve that is used to interpolate the data points. The spline is a curve that is used to interpolate the data points. The spline is a curve that is used to interpolate the data points.

Following code snippet generates a vehicle dynamics based on PhysX API:

Bazel Usage

Posted on 2022-08-23 | In programming

Introduction

This is still a draft. This blog post is about how to use Bazel to build a C++ project. I will use the Bazel tutorial as a reference.

GTest Usage

Posted on 2022-08-23 | In programming

Introduction

GTest with bazel. still a draft.

XML Schema

Posted on 2022-08-19 | In misc_tech_note

Introduction

still draft.

auto in CPP

Posted on 2022-08-17 | In programming

Introduction

auto&, auto
and consider to pass it as parameter of a function.

构造函数初始化列表中初始化基类成员报错

Write A Random Generator By Yourself

Posted on 2022-08-15 | In programming

Introduction

Singleton in CPP

Posted on 2022-08-15 | In programming

Introduction

1
2
std::once_flag
std::call_once

Publish Your WordPress Post in Automation with GitHub Actions

Posted on 2022-08-15 | In misc_tech_note

Introduction

Python script:

  1. markdown with mathjax
  2. convert markdown to html
  3. Post to WordPress via restful API

Trigger the above script through GitHub action.

  1. setup application password
  2. Optional: only trigger action for specific commit messages

Difference Between Gradient Descent and Stochastic Gradient Descent

Posted on 2018-02-26 | In machine_learning

Introduction

This post mainly discusses the difference between gradient descent (a.k.a. vanilla gradient descent or batch gradient descent) and stochastic gradient descent (a.k.a. online gradient descent). We firstly show and compare the 2 alogorithms’ implementations, which is quite simple. After that, we will analyse these 2 algorithms from the convergence rate perspective. At the end, the summaries are given.

Read more »

Support Vector Machine

Posted on 2018-01-30 | In machine_learning

Maximum(Hard) Margin Classifier

Let us start from the simplest situation: 2-class classification problem using linear models with the form:
$$ \mathcal{y}(\mathbf{x}) = \mathbf{w}^\top \mathbf{x} + b \label{eq:1}\tag{1}$$
The training set data comprises $N$ input vectors $\mathbf{x_1}$, …, $\mathbf{x_N}$, with corresponding labels $\mathcal{t}_1$, …, $\mathcal{t}_N$, where $\mathcal{t_n} \in \{-1, 1\}$.

Read more »

Kernel Methods

Posted on 2018-01-26 | In machine_learning

Introduction

temporary created in order to be referenced by other posts.

Read more »
12<i class="fa fa-angle-right"></i>

21 posts
4 categories
RSS
© 2024 Zhiwei Liu
Powered by Hexo
|
Theme — NexT.Muse v5.1.4