4339 views|5 replies

654

Posts

26

Resources
The OP
 

25 "Million Miles" Raspberry Pi Car - Nam Wheel Control [Copy link]

 

We have previously realized the control of the car's four motors using a mobile phone, but it is still relatively complicated to make the car move.

Features of Nam Wheel

The Namu wheel car can move horizontally, rotate, or combine the two, that is, the car can be controlled by any combination of X-axis, Y-axis and rotation axis. The X-axis and Y-axis refer to the body coordinates. When not rotating, the body coordinates and the ground coordinates coincide.

Nam wheel motion control

The motion of the wheels of the Nam wheel trolley and the motion diagram of the trolley are shown in the figure below.

For example, if all four wheels roll forward, the car moves forward. The car's movement can be decomposed into three basic modes: straight, translation and rotation. All of them are achieved through the rotation of the four wheels. Therefore, we can get a mapping relationship between the car's movement mode and the wheel rotation. The relationship is as follows:

In the formula, Uw1, Uw2, Uw3, and Uw4 represent the wheel speeds of quadrants 1234 respectively, Uty represents the vertical speed of the car, Uty represents the horizontal speed, w represents the angular velocity of the car, and a and b represent the length and width between the wheels of the car.

APP control code writing

Write the control code in the APP. The APP only needs to output the control amount of the four wheels. Based on the previous mobile phone remote control motor rotation , add the linkage between the joystick and the drag bar. The joystick is used to control the vertical and horizontal movement, and the drag bar is used for steering. The main code examples are as follows.

void mecanumRun(float xSpeed, float ySpeed, float aSpeed)
{
float maxLinearSpeed=100;
float speed1 = ySpeed - xSpeed + aSpeed;
float speed2 = ySpeed + xSpeed - aSpeed;
float speed3 = ySpeed - xSpeed - aSpeed;
float speed4 = ySpeed + xSpeed + aSpeed;
float max = speed1;
if (max < speed2) max = speed2;
if (max < speed3) max = speed3;
if (max < speed4) max = speed4;
if (max > maxLinearSpeed)
{
speed1 = speed1 / max * maxLinearSpeed;
speed2 = speed2 / max * maxLinearSpeed;
speed3 = speed3 / max * maxLinearSpeed;
speed4 = speed4 / max * maxLinearSpeed;
}
mSeekBar_Wheel_1.setProgress((int)(speed1+100));
mSeekBar_Wheel_2.setProgress((int)(speed2+100));
mSeekBar_Wheel_3.setProgress((int)(speed3+100));
mSeekBar_Wheel_4.setProgress((int)(speed4+100));
}

The achieved effects are as follows.

In this way, by controlling the joystick, the speed of the four motors can be decoupled, thereby controlling the movement of the car.

question

This control seems to be able to start running directly, but in fact there are still some problems. For example, the reduction motor has a large control dead zone. Assuming the full control value is 100, it will not start to rotate below 40, but once it starts to rotate, it will decelerate to the control value of 40 and the motor will rotate.

There is another question, how to run the program as soon as the Raspberry Pi is turned on.

Source code

GitHub

Gitee

This post is from Innovation Lab

Latest reply

I came here to learn, and I gained new knowledge and insights. Thank you for the analysis and sharing.   Details Published on 2022-4-14 15:02
Personal signatureQQ:252669569
 
 

1w

Posts

204

Resources
From 2
 

Summary of "Wanli" Raspberry Pi car:

lb8820265's "Wanli" Raspberry Pi car open source sharing - DIY/Open Source Hardware Zone - Electronic Engineering World - Forum (eeworld.com.cn)

Table of contents:

"Wanli" Raspberry Pi car launched

1. “Wanli” Raspberry Pi car - Establishing a project warehouse

2. "Wanli" Raspberry Pi car - Python learning (using Thonny)

3. "Wanli" Raspberry Pi car - Python learning (timing task)

4. "Wanli" Raspberry Pi car - C++ learning (compile and run, use geany)

5. "Ten Thousand Miles" Raspberry Pi Car - WiringPi Learning (Delay and Thread Simulation Timer)

6. "Wanli" Raspberry Pi car - wiringPi learning (PWM and external interrupt simulation timer)

7. "Ten Thousand Miles" Raspberry Pi Car——RPi.GPIO Learning (PWM and External Interrupt Simulation Timer)

8. "Wanli" Raspberry Pi car - socket learning (local communication)

9. "Ten Thousand Miles" Raspberry Pi Car - Socket Learning (TCP Two-Machine Communication)

10. "Ten Thousand Miles" Raspberry Pi Car - Socket Learning (UDP Two-Machine Communication)

11. "Wanli" Raspberry Pi car - socket learning (sent from Android)

12 "Wanli" Raspberry Pi car - socket learning (Android sending and receiving)

13. "Wanli" Raspberry Pi Car - Accessories Preparation

14 "Wanli" Raspberry Pi car - motor drive learning

15 "Wanli" Raspberry Pi car - photoelectric encoder learning (forward and reverse judgment)

16. "Wanli" Raspberry Pi car - photoelectric encoder learning (obtaining speed)

17 "Ten Thousand Miles" Raspberry Pi Car——VSCode Learning (Compiling and Debugging)

18. "Ten Thousand Miles" Raspberry Pi Car——Makefile Learning

19 "Ten Thousand Miles" Raspberry Pi Car——VSCode Learning (Multiple C File Link Debugging)

20 "Million Miles" Raspberry Pi Car - Motor Control Learning (Control Speed)

21. "Wanli" Raspberry Pi car - motor control learning (4-wheel speed control)
22. "Wanli" Raspberry Pi car - mobile phone remote control motor rotation

23 "Wanli" Raspberry Pi car - connected to Raspberry Pi without screen

24 "Millions" Raspberry Pi Car - Bullseye Benchmark Test of Raspberry Pi 64-bit System

25 "Million Miles" Raspberry Pi Car - Nam Wheel Control

26 "Wanli" Raspberry Pi car - program startup

27 "Ten Thousand Miles" Raspberry Pi Car - Fix and Get the Raspberry Pi IP Address

28 "Wanli" Raspberry Pi car - car assembly

29 "Wanli" Raspberry Pi car - straight-driving deviation problem and new control mode

30. "Wanli" Raspberry Pi car - Phase 1 completed demonstration (introduction from scratch)

This post is from Innovation Lab
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
Personal signature

玩板看这里:

http://en.eeworld.com/bbs/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 
 

1w

Posts

25

Resources
3
 

The Nam wheel is very interesting and worth studying more

This post is from Innovation Lab
 
 
 

13

Posts

0

Resources
4
 

The Nam wheel is very interesting and worth studying more

This post is from Innovation Lab
 
 
 

5213

Posts

239

Resources
5
 

Summary (25 articles updated): lb8820265's "Wanli" Raspberry Pi car open source sharing

This post is from Innovation Lab
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

20

Posts

0

Resources
6
 

I came here to learn, and I gained new knowledge and insights. Thank you for the analysis and sharing.

This post is from Innovation Lab
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list