0% found this document useful (0 votes)
12 views2 pages

01 Motion Library Analysis

The document details the programming implementation for motion control of a mecanum wheel robot car, covering motor initialization, speed control, and directional movement. It describes key functions such as 'Motor_Init()', which sets motor pins and prepares the robot, and 'Velocity_Controller()', which calculates motor speeds based on various parameters. The overall program allows the robot to move in multiple directions and perform complex maneuvers before stopping.

Uploaded by

Ywhite Eric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

01 Motion Library Analysis

The document details the programming implementation for motion control of a mecanum wheel robot car, covering motor initialization, speed control, and directional movement. It describes key functions such as 'Motor_Init()', which sets motor pins and prepares the robot, and 'Velocity_Controller()', which calculates motor speeds based on various parameters. The overall program allows the robot to move in multiple directions and perform complex maneuvers before stopping.

Uploaded by

Ywhite Eric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Motion Library Analysis

This section introduces the programming implementation of motion control for


a mecanum wheel robot car, including motor initialization, speed control,
turning, translation, and other functions. You can learn about the relevant
library files.

1. Program Outcome
miniAuto moves straight. Then, it moves horizontally to the left, back, and right
in turn. Before stopping, it turns in place and then drifts.

2. Brief Analysis of Library Function

2.1 Motor Initialization Function “Motor_Init()”


This function is used to initialize the motor pins, setting the I/O mode of the
motor to output mode by calling “pinMode” function in a for loop. The
“Velocity_Controller” function is called to set the robot to a stationary state.

2.2 Motor Setting Function “Motor_Init()”


This function adjusts the speed and direction of each wheel of the robot
according to the values passed in as parameters. In the for loop, the turning of
the robot is adjusted based on the calculated result. The map function is used
to map the calculated value from 0 YO 100 to the range of 50 to 255. The
“digitalWrite” and “analogWrite” functions are used to set the motor direction
and speed.
2.3 Motor Speed Control Function “Velocity_Controller()”
This function accepts four parameters: direction, speed, self-rotation speed,
and whether to enable drift. The function calculates the speed of each motor
and calls the “Motors_Set” function to set the PWM value and direction of the
motor. The function uses trigonometric functions to calculate the motor speed
based on direction. In addition, it also considers the effects of self-rotation
speed and drift. This is a complex motion control algorithm.

You might also like