MASTER’S THESIS2007:061MASTER'S THESISMotion Control for Mobile Robots Konrad R. SkupLuleå University of TechnologyMaster Thesis, Continuation C
9 Servo shortcut of Servomechanism a special motor that typically includes a velocity and/or position feedback device. Sinusoidal cur
10 3. Brushless DC motors. 3.1. Overview. A brushless DC motors, very often denoted by shortcut BLDC (BrushLess Direct Current), are po
11 Fig. 3.2-1. Basic schematics of brushless motor. The basic schematic of a brushless motor is shown on the picture 3.2.1. First of all, brushless
12 The above presented differences in arrangement change the speed and torque inversely proportional to the factor of: . Of course the arrangement of
13 Explanation of this figure is quite short and easy. As we know from previous pictures, we consider situation when we have only three
14 Of course presented in above figure situation due to some non-linearity effects is very hard to realize. The effect of non-linearity can be observa
15 The small example how the Hall Sensor can be used to read the rotation of the rotor is presented on the figure 3.3-1. Fig. 3.3-1
16 At this point small explanation about IRC and its channels should be given. Firstly couple of words about IRC. IRC is just a rotary a
17 3.5. General work of brushless motor. As we know from the previous sections, to make the brushless motor rotating we need to put on the three wind
18 Looking at the above example of discretization on the figure 3.5-1 and thinking little bit, we will find out another very important problem: it is
CZECH TECHNICAL UNIVERSITY IN PRAGUE FACULTY OF ELECTRICAL ENGINEERING DEPARTMENT OF CONTROL ENGINEERING DIPLOMA THESIS Motion Control for Mobi
19 Fig. 3.5-2. Position of the motor and reading from HAL sensor. I think it is good idea to explain little bit how we can rotate the motor in desi
20 Fig. 3.6-1. Brushless motor which was used by me. First of all we calculated the length of phase tables. We assumed that the amplitud
21 4. H8S/2638 microcontroller. 4.1. Overview. H8S/2638 is microcomputer unit (MCU) employed by Renesas Technology. In general it is 32-bit architec
22 Fig. 4.1-2. The internal structure of H8S/2638. Fig. 4.1-3. Pins available in H8S/2638.
23 4.2. PWM description. Pulse Width Modulation (PWM) is a method of a current or voltage signal regulation. It bases on a change of the wi
24 Fig. 4.2-2. PWM channel 2 in H8S/2638. PWMOCR1 and PWMOCR2 are used to select which PWM outputs should be enabled and which should be disabled. S
25 After short description of all registers we can shortly explain how PWM works inside H8S/2638. So, at the beginning, user has to select which PWM h
26 In the case of second channel, the situation is little bit different. This is due to the differences in the architecture of the microcontroller. We
27 Independent interrupt vector address has big advantage, because in this case we don't have to worry about identification of the source. All in
28 Channels 0 and 3 are almost identical. This means both of them have the same interrupt sources, the same number of general and
2 Declaration of authorship: I declare, that I wrote this diploma thesis myself only with the help of the literature, on-line materials, projects an
29 In the following lines, I'm not going to go into details about several registers which are need to be set up properly, but I'll try
30 5. PXMC library. 5.1. Introduction. PXMC is portable library to control various types of motors. Its main task or aim is to allow
31 platform. Secondly, developer must have at least some basic experience with motors and microcontrollers. This is due to the fact, that
32 5.2. Preparation of the programming environment. In this subsection I'll shortly present how to prepare programming environment for PXMC unde
33 When the configuration will be finished, we write in standard way: make and then make install. As the result we will get binary file called:
34 Fig. 5.3.1-1. The structure of PXMC library. Fig. 5.3.1-2. Files with dependencies in PXMC library.
35 5.3.2. General work of PXMC. Before we go into descriptions of several files, which belong to PXMC library, we need to get some information how P
36 here definitions of all flags and definitions of the most functions which can be accessed from PXMC. Now, lets try to look little bit more into de
37 PXMS_CQF_b states whether the command queue is full or not. If it is full we can't give any new command. This flag is still not implemented an
38 If we want to check whether some flag is set or not, we need to check pxms_flg. This is a bit field where the flags are stored in
3 Abstract This diploma thesis is focused on brushless DC motors, how they work and how to control them using phase tables. It de
39 The advantage of the above equation is that it gives possibility to operate with help of fixed point arithmetic, which increases controller
40 pxms_md This field stores the maximal difference between actual and required position. If the difference will be greater than this value, then erro
41 pxms_ptvang This value is an angle between rotor and direction of magnetic field. The optimal value for steeper motors is 0o and for brushless moto
42 In the following lines I will describe shortly configuration flags for a motor described by pxms_state structure. All these flags are available i
43 First one, *ptr is used to store information about speed and power sent to the output. The*buff is used mainly to store a profile of speed generato
44 pxmc_state_t *pxmc_main_arr[] = {&mcsLeft}; pxmc_state_list_t pxmc_main_list = { pxml_arr:pxmc_main_arr, pxml_cnt:(sizeof(pxmc_main_arr)/sizeo
45 Fig. 5.3.5-1. General structure of PID controller. PID used by PXMC can be seen on figure 5.3.2-1. The efficiency and performance of PID control
46 pxmc_dbg_gnr This function is seen from outside of the PXMC library and in fact it prepares all necessary elements for storing the speed ge
47 pxmc_trp_gend Changes request position to new factor, what should finalize the use of trapezoid generator. This function is temporarily not
48 5.3.10. PXMC_HH_BASIC.C At begin of the description of this file, it should be clearly mentioned that this file has couple of mistakes and probab
4 Table of Contents: 1. Introduction ...
49 In this subsection I will present only constants for run time phase table generation which are defined in pxmc_internal.h. All functions which pred
50 them during compilation or linking. Exactly the same situation was with H8S/2638 which I used. Name of pole Short description pxmc_ptvang_deg2irc
51 Fig. 5.3.13-3. Phase tables generated with pxmc_init_ptable_sin3fup. Fig. 5.3.13-4. Phase tables generated with pxmc_init_ptable_trapez.
52 bldctest for hi_cpu2 board we can also call function: pxmc_set_default_functions(pxmc_state_t *mcs, pxmc_motor_kind_e motor). The first parameter i
53 6. Adding Board Support Package (BSP) for BLDC on H8S/2638. 6.1. Introduction. As was mentioned in section 5.1, the basic aim of PXMC library is/
54 Another improvement is that we decided to create one standard for all compilations. In other words, now always when we compile PXMC we get two libr
55 6.4. Work with hi_cpu2 board. During getting experience with PXMC library I got one of the tasks to make hi_cpu2 board working with br
56 const unsigned char eurobot_bdc_hal_pos_table[8]= { [0]=0xff, [5]=0, //1 0 1 = 5 [1]=1, //0 0 1 = 1 [3]=2, //0 1 1 = 3 [2]=3, //0 1 0 = 2 [6]=4, //
57 pxms_me:PWM_MAX<<8, //6144 pxms_ptirc:bldc_ptirc, // IRC count per phase table pxms_ptper:bldc_ptper, // Number of periods per table pxms_pt
58 interupt_dbg* A/a. This routine is called in debug mode to store some debug information about the motor. The pointer to debug function is stored in
5 7. Testing and documentation of the code. ...65 7.1. Introduction...
59 Last two files: Makefile and Makefile.omk have descriptions of the rules for compilation and are used by make command. In Makefile.omk we should li
60 The general idea is that, if we know the speeds of the wheels we can read it from PXMC then we can calculate the difference in speed between tw
61 table in an element shown by hall value the number 1 and so on, till we rotate the motor by 360o.
62 snd=strchr(snd,':')+1; int whichIDX=atoi(snd); if(whichIDX<0) { pwm1 = (((unsigned long)pwm1*(unsigned int)ene)
63 Now I will write couple of words about HalDetector. After uploading the driver with above function and compilation of the main program
64 int writeport(int fd, char *chars); int readport(int fd, char *result); int getbaud(int fd); int allocateMemory(); int deallocateMemory(); int open
65 7. Testing and documentation of the code. 7.1. Introduction. The testing and debugging of the code were not easy tasks. This was mostly due to th
66 int cmd_do_something(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) { printf("Hello world!\n"); return 0; } Then we create
67 7.3. Documentation. Documentation for bldctest.c and for bldc.c was generated automatically with help of script written in Perl, call
68 'funcname()' - function '$ENVVAR' - environmental variable '&struct_name' - name of a structure (up to two words
6 1. Introduction Motors are widely used in many aspects of our life. They serve in different trivial tasks like rotation of wheels in toys
69 8. Conclusions. The general conclusions from my work are not simple task, so I think the best would be if I present my own opinion about every par
70 without having a contact with the authors, could very easy learn and test different properties of PXMC. It would also allow for better understandin
71 9. Sources. (1) Renesans Technology - URL: http://docum
72 Appendix A Here is presented the whole documentation for the PXMC source code files, which were created during my work on this thesis. All of belo
73 Function unsigned char hal_read (struct pxmc_state * mcs) Arguments mcs Motion controller state information Description This function reads and
74 Function bool pxmc_set_default_functions (pxmc_state_t * mcs, pxmc_motor_kind_e motor) Arguments mcs Motion controller state information motor
75 Function void interupt_controller_and_output () Arguments Description The function is used to call pxms_do_con and pxms_do_out functions for all m
76 Function void index_mark_isr_2 ( void) Arguments void no arguments Description This interrupt routine works in exactly the same way as index_mar
77 Function void init_irc ( void) Arguments void no arguments Description This function sets up TPU for index mark detection for 1st and 2nd motor.
78 Function void init_irq ( void) Arguments void no arguments Description This function set up IRQ interrupt, by putting index_mark_isr to the inte
7 Finally, even the best software and libraries are useless without good documentation and examples how to use them. Because of that, late
79 Function int tpu_irc_ap2hw (struct pxmc_state * mcs) Arguments mcs Motion controller state information Description The function updates pxms_pto
80 A.3 The documentation for brushless.c: Function int cmd_do_quit (cmd_io_t * cmd_io, const struct cmd_des * des, char * * param) Arguments Descri
81 Function int cmd_do_setindex (cmd_io_t * cmd_io, const struct cmd_des * des, char * * param) Arguments Description It is implementation of setinde
82 Function int cmd_do_nopxmc (cmd_io_t * cmd_io, const struct cmd_des * des, char * * param) Arguments Description It is implementation of nopxmc c
83 Function int switchLedsOn () Arguments Description This function switches on all led on the board. Function void unhandled_exception ( void) Ar
84 Function int main () Arguments Description This function is a main function of the program. It initializes pxmc, and than in a constant loop it ex
85 Appendix B Here is presented the whole documentation for the HalDetector source code files. This documentation was created with Doxygen program an
86 QLabel * textLabel2 Label with "Baud rate" text. QTextEdit * textEdit1 TextEdit field where appear results of scanning. QLineE
87 void aboutMenuFileClicked () Function called after Help->About menu click. Private Member Functions int initport (int fd) Initializes giv
88 short * ph1 Pointer to 1st phase table. short * ph2 Pointer to 2nd phase table. short * ph3 Pointer to 3rd phase table. bool working
8 2. Terminology and abbreviations. Below are presented the most important terms and abbreviations which are later used in this document
89 void Form1::startButtonClicked () [protected, slot] Function called after "Start" button click. Start button clicked. According to sele
90 int Form1::writeport (int fd, char * chars) [private] Write given string to a device. Function writes a string to device pointed by fd descripto
91 int Form1::openDevice () [private] Open given device. Function opens device given in deviceLineEdit1 text line and assigns the fd pointer. Retu
Kommentare zu diesen Handbüchern