Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SimpleMapSerialization serial_communication
Revision 7:6c4b22a43eb3, committed 2016-04-06
- Comitter:
- inst
- Date:
- Wed Apr 06 09:11:58 2016 +0000
- Parent:
- 5:b1573848235e
- Child:
- 8:52ccf5b84a05
- Commit message:
Changed in this revision
| communication.cpp | Show annotated file Show diff for this revision Revisions of this file |
| communication.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/communication.cpp Mon Apr 04 09:24:51 2016 +0000
+++ b/communication.cpp Wed Apr 06 09:11:58 2016 +0000
@@ -7,7 +7,8 @@
communication* communication::instance_ = NULL;
const int communication::velocity_offset_ = 32767;
-const float communication::analog_stick_lower_limit_ = 0.2f;
+//const float communication::analog_stick_lower_limit_ = 0.2f;
+//const size_t communication::velocity_div_num_ = 8;
communication::communication() {}
@@ -33,18 +34,32 @@
v[i] -= velocity_offset_;
v[i] /= velocity_offset_;
}
-
if (v.length() > 1.0f) {
+ //v = v.unit();
return v.unit();
}
+ return v;
+ /*
+ float p = 2.0f * PI;// / 8.0f;// / velocity_div_num_;
+ float rad = atan2(v.y(), v.x());
+ rad += p * 0.5f;
+ rad /= p;
+ rad *= p;
+ */
+ //float l = sqrt(v.x() * v.x() + v.y() * v.y());
+
+ //float l = v.length();
+
+ //return vector2f(cos(rad), sin(rad));
+ //return vector2f(0.3f * cos(rad), 0.3f * sin(rad));
+ //return vector2f(l * cos(rad), l * sin(rad));
/*
if (v.length() < analog_stick_lower_limit_) {
return vector2f(); // しきい値以下なら移動操作無しとみなす
}
*/
-
- return v;
+ //return v;
/*
vector2f velocity = v.unit();
--- a/communication.hpp Mon Apr 04 09:24:51 2016 +0000
+++ b/communication.hpp Wed Apr 06 09:11:58 2016 +0000
@@ -33,7 +33,8 @@
communication(const communication& s);
static communication* instance_;
- static const float analog_stick_lower_limit_;
+ //static const float analog_stick_lower_limit_;
+ //static const size_t velocity_div_num_;
};
#endif