藕的做法大全家常菜_华为mate50_六月婷婷 https://六月婷婷.pro Cinema Art Techniques Mon, 26 Feb 2024 05:46:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://六月婷婷.pro/2024/02/26/robomaster-development-board-flash-under-linux/ https://六月婷婷.pro/2024/02/26/robomaster-development-board-flash-under-linux/#respond Mon, 26 Feb 2024 05:01:03 +0000 https://六月婷婷.pro/?p=1199

When I used the Robomaster Development C Board as my embedding microcontroller system under Linux, I met some problems; I didn’t know how to flash the board, all things about flash on the web were progressed under windows operating system. So, I have investigated by myself and have learned something about stm32, stlink, and jlink knowledge. I’ll share how to deploy the Robomaster Dev Board development Environment under linux for you.

Prepare

  • ST-Link / J-Link (I used ST-link-mini-v2 by waveshare and J-link edu mini)
  • Robomaster Development Board (Type A / Type C)
  • SWD cable link (4pin)
  • A linux host (of course, you can use Raspberry Pi Arm64, but stink v2 mini can’t work on arm64)

Pins Connect Figure

The above figure exhibits how to connect the development board and the stlink/jlink flasher. The more information you can reference from the Robomaster Development Board Type C User Manual.

Using STlink v2 mini is very simple, but it only works under Windows and Linux AMD64, so I will only talk about how to use jlink with the dev board because Jlink also supports macOS and linux arm64.

Jlink Edu Mini Connect

Jlink edu mini use 9-pin JTAG

On the mini board, the No.1 pin is VTref, and you need to use a 9-pin ribbon cable to connect the jlink edu mini because the width between pins is 1.27mm. You also need a SWD (2*5 1.27mm) Cable Breakoutput to connect the robomaster dev board.

Let us connect pins between the Jlink mini and the dev board. Exhibit below figure.

Jlink 9 pin cable connect to dev board SWD interface

For example, I used Raspberry Pi as my linux host and the connections like below.

Flash the dev Board

  1. Download and Install STM32CubeMX for Linux
  2. Download and Install Opened
  3. Download and Install gcc-arm-none-eabi-10.3-2021.10-aarch64-linux.tar.bz2
  4. Download and Install Jlink Software for arm64
  5. git clone https://github.com/RoboMaster/Development-Board-C-Examples.git
  6. open example project ioc file in STM32CubeMX
  7. Convert the Toolchain/IDE to makefile in ProjectManager option, then 刁蛮公主 GENERATE CODE
  8. Run the Make command under the example project you want, then you can find the elf binary file under the build directory

Download program to robomaster dev board

In this sense, I will flash 1.light_led ELF file to the dev board using the openocd command.

Jlink openocd config file (jlink.cfg)

source [find interface/jlink.cfg]
transport select swd
source [find target/stm32f4x.cfg]

program build/light_led.elf verify reset exit

STLink openocd config file (stlink.cfg)

ource [find interface/stlink.cfg]
source [find target/stm32f4x.cfg]
program build/light_led.elf verify reset exit

Flash command line:

# Use STLink
openocd -f ./stlink.cfg

# Use Jlink
openocd -f ./jlink.cfg

Check if it works, change the main code in Src/main.c, only light the red led.

  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
        //set GPIO output high level
        HAL_GPIO_WritePin(LED_R_GPIO_Port, LED_R_Pin, GPIO_PIN_SET);
        HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, GPIO_PIN_RESET);
        HAL_GPIO_WritePin(LED_B_GPIO_Port, LED_B_Pin, GPIO_PIN_RESET);
  }
  /* USER CODE END 3 */
}

Now, the Red LED is lighting.

]]>
https://六月婷婷.pro/2024/02/26/robomaster-development-board-flash-under-linux/feed/ 0
https://六月婷婷.pro/2023/08/30/mecanum-wheel/ https://六月婷婷.pro/2023/08/30/mecanum-wheel/#respond Wed, 30 Aug 2023 15:12:30 +0000 https://六月婷婷.pro/?p=676 What is Mecanum wheel

The mecanum wheel is an omnidirectional wheel design for a land based vehicle and invented by Swedish Engineer – Bengt Erland Ilon.

There are a series of free moving rollers attached to the whole circumference of vehicle’s wheel, these rollers typically have a 45 degree to the axle line, and freely about axes in the plane of the wheel, but the overall side profile of the wheel is circular. How the Mecanum wheel drives the mobile robot?

First we will define the wheels sequences:

  1. FrontRightWheel as w1
  2. FrontLeftWheel as w2
  3. RearLeftWheel as w3
  4. RearRightWheel as w4

How the vehicle moves:

  • Running all four wheels in the same direction and same speed will result moving the vehicle in a forward or backward.
  • Running both wheels on one side in one direction and other side in the opposite direction, will result in a static rotation of the vehicle.
  • Running w1 backward, w2 forward, w3 backward, w4 forward, the result of vehicle will moving to right sideway.
  • Running w2 forward, w4 forward and stop other wheels, the result of vehicle will moving to top-right diagonally.
  • Running w2 and w3 forward, and stop other wheels, the result of vehicle will moving rotate around the point on x-axies.
  • Running w2 forward and w1 backward, and stop other wheels, the result of vehicle will moving rotate around the point on y-axies.

Question:

How the wheel speed map to the mobile robot velocity, if we know robot’s velocity is:

\left\{v_x,v_y,\omega _z\right\}
\\
v_x,
v_y 
\text{ - }
\text{robot linear} \text{ velocity} \\
\omega _z
\text{ - }
\text{robot angular} \text{ velocity}

what is the wheels angular velocity need?

solve this map problem, we need to use kinematic model.

Kinematic model

Inertial basis frame A

Define

  • XY – world: inertial frame, call it frame A
  • XY – robot: robot’s base frame, call it frame C
  • XY – wheel: robot’s wheel base frame as frame B, and wheels center point at {xi, yi) in Frame C
  • Robot’s position is (x,y) in Frame A, and it’s orientation angle is 𝜙
  • v-x, v-y are wheel’s linear velocity, v-slide is sliding speed, v-drive is direction drive speed.
  • free sliding direction angle with the Frame B -y axes is 𝛾.
  • frame B (wheel) angle with frame C(robot) is 𝛽.
  • 𝜔 – wheel’s angular velocity.
  • v-c is robot’s linear velocity in Frame C, v-a is robot’s linear velocity in Frame A.
  • 𝜔i – robot’s i-th wheel
  • x,y – the distances from the vehicle robot geometric centers to the axis of the wheels geometric centers.
v_{\text{drive}}=v_x+\tan (\gamma ) v_y \\
v_{\text{slide}}=\frac{v_y}{\cos (\gamma )}
\left(
\begin{array}{c}
 v_x \\
 v_y \\
\end{array}
\right)=\left(
\begin{array}{c}
 1 \\
 0 \\
\end{array}
\right) v_{\text{drive}}+v_{\text{slide}} \left(
\begin{array}{c}
 -\sin (\gamma ) \\
 \cos (\gamma ) \\
\end{array}
\right)
\omega =\frac{v_{\text{driver}}}{r}=\frac{v_x+\tan (\gamma ) v_y}{r}
Robot’s base frame, Cartesian coordinate system, Frame C
v_a=\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)=\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos (\phi ) & -\sin (\phi ) \\
 0 & \sin (\phi ) & \cos (\phi ) \\
\end{array}
\right).\left(
\begin{array}{c}
 \omega _{\text{cz}} \\
 v_{\text{cx}} \\
 v_{\text{cy}} \\
\end{array}
\right)
v_c=\left(
\begin{array}{c}
 \omega _{\text{cz}} \\
 v_{\text{cx}} \\
 v_{\text{cy}} \\
\end{array}
\right)=\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos (\phi ) & \sin (\phi ) \\
 0 & -\sin (\phi ) & \cos (\phi ) \\
\end{array}
\right).\left(
\begin{array}{c}
 \frac{d\phi }{dt} \\
 \frac{dx}{dt} \\
 \frac{dy}{dt} \\
\end{array}
\right)=\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos (\phi ) & \sin (\phi ) \\
 0 & -\sin (\phi ) & \cos (\phi ) \\
\end{array}
\right).\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)

Inverse Kinematic

we can decompose linear velocity on Frame A (world) to Frame C(robot), then to Frame B(wheel), so we get:

Transform Matrix

Transfer v-a to v-c
T_1=\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos (\phi ) & \sin (\phi ) \\
 0 & -\sin (\phi ) & \cos (\phi ) \\
\end{array}
\right).\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)
Transfer v-c to v-x, v-y in wheel frame B

Because our vehicle mobile robot can both translational and rotational movements, so the angular velocity also need to projection of linear velocity of wheel.

T_1=\left\{\dot{\phi },\dot{x} \cos (\phi )+\dot{y} \sin (\phi ),\dot{y} \cos (\phi )-\dot{x} \sin (\phi )\right\}
\omega _{\text{robot}}=\dot{\phi } \\
v_{\text{xRobot}}=\dot{x} \cos (\phi )+\dot{y} \sin (\phi ) \\
v_{\text{yRobot}}=\dot{y} \cos (\phi )-\dot{x} \sin (\phi )
v_{\text{xwheel}}=v_{\text{xRobot}}-\sin (\beta ) \omega _{\text{robot}} \sqrt{x_i^2+y_i^2}=v_{\text{xRobot}}-\frac{y_i \omega _{\text{robot}} \sqrt{x_i^2+y_i^2}}{\sqrt{x_i^2+y_i^2}}=v_{\text{xRobot}}-\dot{\phi } y_i \\
v_{\text{ywheel}}=\cos (\beta ) \omega _{\text{robot}} \sqrt{x_i^2+y_i^2}+v_{\text{yrobot}}=x_i \omega _{\text{robot}} \sqrt{x_i^2+y_i^2}+v_{\text{yrobot}}=\dot{\phi } x_i+v_{\text{yrobot}}

So, get the translational matrix from robot frame to wheel frame

T_2=\left(
\begin{array}{ccc}
 -y_i & 1 & 0 \\
 x_i & 0 & 1 \\
\end{array}
\right).T_1

then, get the rotational matrix from robot frame to wheel frame

T_3=\left(
\begin{array}{cc}
 \cos \left(\beta _i\right) & \sin \left(\beta _i\right) \\
 -\sin \left(\beta _i\right) & \cos \left(\beta _i\right) \\
\end{array}
\right).T_2
Transfer v-x, v-y to wheel’s angular speed
T_4=\left(
\begin{array}{cc}
 \frac{1}{r_i} & \frac{\tan \left(\gamma _i\right)}{r_i} \\
\end{array}
\right).T_3

finally, we get the wheel’s angular velocity

\omega _i=T_1.T_2.T_3.T_4.\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)
\omega _i=\left(
\begin{array}{cc}
 \frac{1}{r_i} & \frac{\tan \left(\gamma _i\right)}{r_i} \\
\end{array}
\right).\left(
\begin{array}{cc}
 \cos \left(\beta _i\right) & \sin \left(\beta _i\right) \\
 -\sin \left(\beta _i\right) & \cos \left(\beta _i\right) \\
\end{array}
\right).\left(
\begin{array}{ccc}
 -y_i & 1 & 0 \\
 x_i & 0 & 1 \\
\end{array}
\right).\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos (\phi ) & \sin (\phi ) \\
 0 & -\sin (\phi ) & \cos (\phi ) \\
\end{array}
\right).\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)
\omega _i=h_i(\phi ).\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)
h_i(\phi )=\left(
\begin{array}{ccc}
 \frac{\sec \left(\gamma _i\right) \left(x_i \sin \left(\beta _i+\gamma _i\right)-y_i \cos \left(\beta _i+\gamma _i\right)\right)}{r_i} & \frac{\sec \left(\gamma _i\right) \cos \left(\beta _i+\gamma _i+\phi \right)}{r_i} & \frac{\sec \left(\gamma _i\right) \sin \left(\beta _i+\gamma _i+\phi \right)}{r_i} \\
\end{array}
\right)

specially, when the 𝛟 is 0:

h_i(0)=\left(
\begin{array}{ccc}
 \frac{\sec \left(\gamma _i\right) \left(x_i \sin \left(\beta _i+\gamma _i\right)-y_i \cos \left(\beta _i+\gamma _i\right)\right)}{r_i} & \frac{\sec \left(\gamma _i\right) \cos \left(\beta _i+\gamma _i\right)}{r_i} & \frac{\sec \left(\gamma _i\right) \sin \left(\beta _i+\gamma _i\right)}{r_i} \\
\end{array}
\right)

Assume our vehicle robot have four wheels, we get H Matrix:

H=\left(
\begin{array}{c}
 h_1(\phi ) \\
 h_2(\phi ) \\
 h_3(\phi ) \\
 h_4(\phi ) \\
\end{array}
\right)

now, we consider the angular of robot’s frame with robot wheel’s frame 𝛽 is 0, and set W1, W2, W3, W4 value, “->” means substitute the symbol value of the formula.

W_1=\left\{\gamma _1\to \frac{\pi }{4},\beta _1\to 0,x_1\to x,y_1\to -y,r_1\to r\right\}\\
W_2=\left\{\gamma _2\to -\frac{\pi }{4},\beta _2\to 0,x_2\to x,y_2\to y,r_2\to r\right\} \\
W_3=\left\{\gamma _3\to \frac{\pi }{4},\beta _3\to 0,x_3\to -x,y_3\to y,r_3\to r\right\} \\
W_4=\left\{\gamma _4\to -\frac{\pi }{4},\beta _4\to 0,x_4\to -x,y_4\to -y,r_4\to r\right\}

define x + y = l, we get the inverse kinematic:

\left(
\begin{array}{c}
 \omega _1 \\
 \omega _2 \\
 \omega _3 \\
 \omega _4 \\
\end{array}
\right)=\left(
\begin{array}{c}
 \frac{v_{\text{xRobot}}+v_{\text{yRobot}}+(x+y) \omega _{\text{zRobot}}}{r} \\
 \frac{v_{\text{xRobot}}-v_{\text{yRobot}}-(x+y) \omega _{\text{zRobot}}}{r} \\
 \frac{v_{\text{xRobot}}+v_{\text{yRobot}}-(x+y) \omega _{\text{zRobot}}}{r} \\
 \frac{v_{\text{xRobot}}-v_{\text{yRobot}}+(x+y) \omega _{\text{zRobot}}}{r} \\
\end{array}
\right)=\frac{1}{r}.\left(
\begin{array}{ccc}
 1 & 1 & l \\
 1 & -1 & -l \\
 1 & 1 & -l \\
 1 & -1 & l \\
\end{array}
\right).\left(
\begin{array}{c}
 \dot{x} \\
 \dot{y} \\
 \dot{\phi } \\
\end{array}
\right)

Forward Kinematic

we know the inverse kinematic, so it’s very easy to let us compute the forward kinematic through inverse matrix operation.

T=H(0)
\omega =T.\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)
T=\left(
\begin{array}{ccc}
 \frac{l}{r} & \frac{1}{r} & \frac{1}{r} \\
 -\frac{l}{r} & \frac{1}{r} & -\frac{1}{r} \\
 -\frac{l}{r} & \frac{1}{r} & \frac{1}{r} \\
 \frac{l}{r} & \frac{1}{r} & -\frac{1}{r} \\
\end{array}
\right)=\frac{1}{r}.\left(
\begin{array}{ccc}
 l & 1 & 1 \\
 -l & 1 & -1 \\
 -l & 1 & 1 \\
 l & 1 & -1 \\
\end{array}
\right)
T^{-1}.\omega =\left(
\begin{array}{c}
 \dot{x} \\
 \dot{y} \\
 \dot{\phi } \\
\end{array}
\right)
T^{-1}=\left(T^T.T\right)^{-1}.T^T
T^{-1}=\left(
\begin{array}{cccc}
 \frac{r}{4 l} & -\frac{r}{4 l} & -\frac{r}{4 l} & \frac{r}{4 l} \\
 \frac{r}{4} & \frac{r}{4} & \frac{r}{4} & \frac{r}{4} \\
 \frac{r}{4} & -\frac{r}{4} & \frac{r}{4} & -\frac{r}{4} \\
\end{array}
\right)
T^{-1}=\left(
\begin{array}{cccc}
 \frac{r}{4 l} & -\frac{r}{4 l} & -\frac{r}{4 l} & \frac{r}{4 l} \\
 \frac{r}{4} & \frac{r}{4} & \frac{r}{4} & \frac{r}{4} \\
 \frac{r}{4} & -\frac{r}{4} & \frac{r}{4} & -\frac{r}{4} \\
\end{array}
\right)=\frac{r}{4}.\left(
\begin{array}{cccc}
 \frac{1}{l} & -\frac{1}{l} & -\frac{1}{l} & \frac{1}{l} \\
 1 & 1 & 1 & 1 \\
 1 & -1 & 1 & -1 \\
\end{array}
\right)

finally, we get the forward kinematic:

\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)=\frac{r}{4}.\left(
\begin{array}{cccc}
 \frac{1}{l} & -\frac{1}{l} & -\frac{1}{l} & \frac{1}{l} \\
 1 & 1 & 1 & 1 \\
 1 & -1 & 1 & -1 \\
\end{array}
\right).\left(
\begin{array}{c}
 \omega _1 \\
 \omega _2 \\
 \omega _3 \\
 \omega _4 \\
\end{array}
\right)

Conclusion

Through this article, we get the forward kinematic (FK) and inverse kinematic (IK) of Mecanum wheels. Using the FK and IK, we can more controllable to drive our robot which using mecanum wheel.

Robot’s Mecanum wheels parameters:

wheel idwheels Name𝛾𝛽XYR
1FrontRight (FR)𝜋/40x-yr
2FrontLeft (FL)-𝜋/40xyr
3RearLeft (RL)𝜋/40-xyr
4RearRight (RR)-𝜋/40-x-yr

Forward Kinematic

\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)=\frac{r}{4}.\left(
\begin{array}{cccc}
 \frac{1}{l} & -\frac{1}{l} & -\frac{1}{l} & \frac{1}{l} \\
 1 & 1 & 1 & 1 \\
 1 & -1 & 1 & -1 \\
\end{array}
\right).\left(
\begin{array}{c}
 \omega _1 \\
 \omega _2 \\
 \omega _3 \\
 \omega _4 \\
\end{array}
\right)

Inverse Kinematic

\left(
\begin{array}{c}
 \omega _1 \\
 \omega _2 \\
 \omega _3 \\
 \omega _4 \\
\end{array}
\right)=\frac{1}{r}.\left(
\begin{array}{ccc}
 l & 1 & 1 \\
 -l & 1 & -1 \\
 -l & 1 & 1 \\
 l & 1 & -1 \\
\end{array}
\right).\left(
\begin{array}{c}
 \dot{\phi } \\
 \dot{x} \\
 \dot{y} \\
\end{array}
\right)

References

  1. Modern Robotics Mechanics, Planning, and Control – Chapter: Wheeled Mobile Robots
  2. Kinematic Model of a Four Mecanum Wheeled Mobile.
]]>
https://六月婷婷.pro/2023/08/30/mecanum-wheel/feed/ 0