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 6:3b9c479c28d4, committed 2016-04-05
- Comitter:
- inst
- Date:
- Tue Apr 05 09:13:13 2016 +0000
- Parent:
- 5:b1573848235e
- 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 Tue Apr 05 09:13:13 2016 +0000
@@ -8,6 +8,7 @@
communication* communication::instance_ = NULL;
const int communication::velocity_offset_ = 32767;
const float communication::analog_stick_lower_limit_ = 0.2f;
+//const size_t communication::direction_div_num_ = 8;
communication::communication() {}
@@ -33,11 +34,20 @@
v[i] -= velocity_offset_;
v[i] /= velocity_offset_;
}
-
+ /*
+ float p = 2.0f * PI / direction_div_num_;
+ float rad = atan2f(v.y(), v.x());
+ rad += p * 0.5f;
+ rad /= p;
+ rad *= p;
+ */
if (v.length() > 1.0f) {
+ //v = v.unit();
return v.unit();
}
+ //return v.length() * vector2f(cos(rad), sin(rad));
+
/*
if (v.length() < analog_stick_lower_limit_) {
return vector2f(); // しきい値以下なら移動操作無しとみなす
@@ -45,11 +55,6 @@
*/
return v;
-
- /*
- vector2f velocity = v.unit();
- return velocity;
- */
}
float communication::get_angular_velocity_rad_per_sec() const {
return 0.0f;
--- a/communication.hpp Mon Apr 04 09:24:51 2016 +0000
+++ b/communication.hpp Tue Apr 05 09:13:13 2016 +0000
@@ -34,6 +34,7 @@
static communication* instance_;
static const float analog_stick_lower_limit_;
+ //static const size_t direction_div_num_;
};
#endif