Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add module octoliner #72

Merged
merged 3 commits into from
Nov 20, 2018
Merged

add module octoliner #72

merged 3 commits into from
Nov 20, 2018

Conversation

PSVM-J
Copy link
Contributor

@PSVM-J PSVM-J commented Oct 10, 2018

if (binaryLine[i]) {
sum += binaryLine[i];
avg += binaryLine[i] * weight[i];
console.log(sum);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱 forgotten console.log

var avg = 0;
var weight = [4, 3, 2, 1, -1, -2, -3, -4];
if (Array.isArray(binaryLine)) {
console.log(binaryLine);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙀 forgotten console.log

Copy link
Contributor

@igrztv igrztv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Документация на вики наследует от экспандера неактуальные примеры кода.

Чтто такое «чувствительность датчиков линии»?

if (sum != 0) {
return avg / sum / 4.0;
}
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

отступ

@@ -0,0 +1,83 @@
var Octoliner = function(opts) {
opts = opts || {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошо бы задать дефолтный i2c или ошибку, если он не задан.

return result;
};

Octoliner.prototype.mapLine = function(binaryLine) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут не binaryLine надо, а просто line, т.к. этот алгоритм работает и на дробных числах.

var weight = [4, 3, 2, 1, -1, -2, -3, -4];
if (Array.isArray(binaryLine)) {
for (var i = 0; i < 8; i++) {
if (binaryLine[i]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и без проверки здесь

@igrztv
Copy link
Contributor

igrztv commented Nov 20, 2018

LGTM

@PSVM-J PSVM-J merged commit 4fdbc76 into master Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants