• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1914 (tree)
日時2010-09-17 17:37:20
作者satofumi

ログメッセージ

300 [mm/sec] 以上の速度では、安定して車輪速を制御できるようになった

変更サマリ

差分

--- branches/tsukuba_2010/libs/run_drive/Makefile (revision 1913)
+++ branches/tsukuba_2010/libs/run_drive/Makefile (revision 1914)
@@ -20,6 +20,7 @@
2020 clean :
2121 $(RM) $(TARGET) *.o
2222 cd samples/ && $(MAKE) clean
23+ cd test/ && $(MAKE) clean
2324 $(RM) -rf generated_html
2425
2526 depend :
--- branches/tsukuba_2010/libs/run_drive/wheel_velocity.c (revision 1913)
+++ branches/tsukuba_2010/libs/run_drive/wheel_velocity.c (revision 1914)
@@ -34,7 +34,7 @@
3434 static int mm2count_velocity(int mm)
3535 {
3636 int count_per_msec =
37- mm * ENCODER_RESOLUTION / (int)(2 * M_PI * WHEEL_RADIUS_MM) / 1000;
37+ (((mm * ENCODER_RESOLUTION) >> 10) / (int)(2 * M_PI * WHEEL_RADIUS_MM));
3838
3939 return count_per_msec;
4040 }
@@ -43,7 +43,7 @@
4343 static int count2mm_velocity(int count)
4444 {
4545 int mm_per_sec =
46- count * (int)(2 * M_PI * WHEEL_RADIUS_MM) / ENCODER_RESOLUTION * 1000;
46+ count * (int)(2 * M_PI * (WHEEL_RADIUS_MM << 10)) / ENCODER_RESOLUTION;
4747
4848 return mm_per_sec;
4949 }
--- branches/tsukuba_2010/libs/run_drive/test/wheel_velocity_test.cpp (nonexistent)
+++ branches/tsukuba_2010/libs/run_drive/test/wheel_velocity_test.cpp (revision 1914)
@@ -0,0 +1,77 @@
1+/*!
2+ \example wheel_velocity.c のテスト
3+
4+ \author Satofumi KAMIMURA
5+
6+ $Id$
7+*/
8+
9+#include "wheel_velocity.c"
10+#include "robot_parameter.h"
11+#include <stdio.h>
12+#include <math.h>
13+
14+
15+void motor_velocity_initialize(motor_t *motor, int device_id)
16+{
17+ (void)motor;
18+ (void)device_id;
19+ // !!!
20+}
21+
22+
23+void motor_velocity_control(motor_t *motor,
24+ int target_count_velocity,
25+ int actual_count_velocity)
26+{
27+ (void)motor;
28+ (void)target_count_velocity;
29+ (void)actual_count_velocity;
30+ // !!!
31+}
32+
33+
34+void motor_pwm_set_servo_free(int device_id)
35+{
36+ (void)device_id;
37+ // !!!
38+}
39+
40+
41+void encoder_initialize(encoder_t *encoder, int device_id)
42+{
43+ (void)encoder;
44+ (void)device_id;
45+ // !!!
46+}
47+
48+
49+short encoder_difference(encoder_t *encoder)
50+{
51+ (void)encoder;
52+ // !!!
53+ return 0;
54+}
55+
56+
57+static void calculate_velocity(int mm_velocity)
58+{
59+ int count = mm2count_velocity(mm_velocity);
60+ int mm = mm_velocity - count2mm_velocity(count);
61+
62+ printf("%d, %d, %d\n", mm_velocity, count, mm);
63+}
64+
65+
66+int main(void)
67+{
68+ enum {
69+ MM_VELOCITY_BASE = 150,
70+ };
71+
72+ for (int i = 0; i < 10; ++i) {
73+ calculate_velocity(MM_VELOCITY_BASE * i);
74+ }
75+
76+ return 0;
77+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/tsukuba_2010/libs/run_drive/test/Makefile (nonexistent)
+++ branches/tsukuba_2010/libs/run_drive/test/Makefile (revision 1914)
@@ -0,0 +1,21 @@
1+# run_drive/test
2+
3+CC = $(CXX)
4+CXXFLAGS = -g -O0 -Wall -Werror $(INCLUDES)
5+INCLUDES = -I..
6+
7+TARGET = wheel_velocity_test
8+
9+all : $(TARGET)
10+
11+clean :
12+ $(RM) $(TARGET) *.o
13+
14+depend :
15+ makedepend -Y -- $(INCLUDES) -- $(wildcard *.h *.cpp)
16+
17+# DO NOT DELETE
18+
19+wheel_velocity_test.o: ../wheel_velocity.c ../wheel_velocity.h ../wheel_t.h
20+wheel_velocity_test.o: ../encoder_t.h ../motor_t.h ../robot_parameter.h
21+wheel_velocity_test.o: ../encoder_reader.h ../motor_velocity.h ../motor_pwm.h
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- branches/tsukuba_2010/libs/run_drive/samples/wheel_velocity_run.c (revision 1913)
+++ branches/tsukuba_2010/libs/run_drive/samples/wheel_velocity_run.c (revision 1914)
@@ -35,7 +35,7 @@
3535 int main(void)
3636 {
3737 enum {
38- VELOCITY_MM_PER_SEC = 200,
38+ VELOCITY_MM_PER_SEC = 100,
3939 };
4040 int i;
4141
旧リポジトリブラウザで表示