Dependencies: SimpleMapSerialization serial_communication
Diff: communication.cpp
- Revision:
- 7:6c4b22a43eb3
- Parent:
- 5:b1573848235e
--- 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();