一、本体说明
1. 底盘概述
该底盘是一款模块化的桌面级应用型底盘,基于应用级软件架构设计、应用级硬件系统设计、典型应用型底盘机械系统设计。
底盘本体为一个采用半独立刚性悬挂的四驱全向底盘。
2. 软件环境介绍
操作系统:Ubuntu18.04系统。基于Debian GNU/Linux,支持x86、amd64(即x64)、ARM和ppc架构。
仿真系统:基于开源机器人操作系统ROS melodic和开源软件平台Arduino开发。上位机采用ROS melodic,基于Rviz完成全向移动底盘slam导航运动规划,采用gazebo完成全向移动底盘物理运动仿真;下位机采用Arduino实现对全向移动底盘运动的控制。
注意:准备一个外接显示器。
3. 硬件配置及主要参数
硬件配置及主要参数表
4. 认识底盘的电器接口
① 常用接口说明:
② 扩展电气接口说明:
5. 底盘简化的系统框图
二、驱动及控制
1. 控制底盘单个轮子
实现思路
控制底盘的四个轮子分别转动。
下面我们先来了解一下底盘的总线舵机ID号。
操作步骤
① 下载文末资料中的参考程序Base_Experiment\Chassis_Drive\Control_single_bus_steering_gear\Control_single_bus_steering_gear.ino:
/*------------------------------------------------------------------------------------
版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.
Distributed under MIT license.See file LICENSE for detail or copy at
https://opensource.org/licenses/MIT
by 机器谱 2023-08-16 https://www.robotway.com/
------------------------------*/
/*
*Control single bus steering grar
*
*
///
* head
* ID:001 ID:000
* ___________
* | |
* | |
* | |
* | |
* | |
* | |
* |___________|
* ID:003 ID:002
* Rear end
*
* 2020.8.7 by boris
//
*/
#define mySerial Serial2 //Serial port used by bus steering gear
#define Serial_Baud_Rate 115200 //Serial Port baud rate
#define BusServoSerialBaud 115200 //Bus steering gear baud rate
#define wheel_speed_forward 0.08 //wheel forward speed
#define wheel_speed_back -0.08 //wheel back speed
#define wheel_speed_stop 0.0 //wheel stop speed
enum{FORWARD_LEFT=1,FORWARD_RIGHT,BACK_LEFT,BACK_RIGHT,STOP};//wheel named
void setup(){
delay(1100);Serial.begin(Serial_Baud_Rate);
mySerial.begin(BusServoSerialBaud);delay(1000);
}
void loop(){
control_bus_steering_gear_test();// control single bus steering gear
}
void control_bus_steering_gear_test()
{
Car_Move(FORWARD_LEFT,wheel_speed_forward);delay(1000);Stop_car(); //left front wheel forward
Car_Move(FORWARD_LEFT,wheel_speed_back);delay(1000);Stop_car(); //left front wheel backword
Car_Move(FORWARD_RIGHT,wheel_speed_forward);delay(1000);Stop_car(); //right front wheel forward
Car_Move(FORWARD_RIGHT,wheel_speed_back);delay(1000);Stop_car(); //right front wheel backword
Car_Move(BACK_LEFT,wheel_speed_forward);delay(1000);Stop_car(); //left rear wheel forward
Car_Move(BACK_LEFT,wheel_speed_back);delay(1000);Stop_car(); //left rear wheel backword
Car_Move(BACK_RIGHT,wheel_speed_forward);delay(1000);Stop_car(); //right rear wheel backword
Car_Move(BACK_RIGHT,wheel_speed_back);delay(1000);Stop_car(); //right rear wheel backword
}
② 将底盘轮子朝上,观察每个轮子的转动效果。
2. 底盘的基本运动
实现思路
实现底盘前进、后退、左平移、右平移、左转、右转的功能。
操作步骤
① 下载文末资料中的参考程序Base_Experiment\Chassis_Drive\Control_Car_Movement\Control_Car_Movement.ino:
/*------------------------------------------------------------------------------------
版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.
Distributed under MIT license.See file LICENSE for detail or copy at
https://opensource.org/licenses/MIT
by 机器谱 2023-08-16 https://www.robotway.com/
------------------------------*/
/*
* car action test (include:forward, back, turnleft,turnright, left translation, right translation)
*
*
* IP address of bus steering gear
* head
* ID:001 ID:000
* ___________
* | |
* | |
* | |
* | |
* | |
* | |
* |___________|
* ID:003 ID:002
* Rear end
*
* 2020.8.7 by boris
*/
#define ActionDelayTimes 1000
#define mySerial Serial2
#define BusServoSerialBaud 115200
#define wheel_speed_forward 0.08 //car forward speed
#define wheel_speed_back -0.08 //car back speed
#define wheel_speed_stop 0.0 //car stop speed
#define wheel_speed_left 0.08 //car turnleft speed
#define wheel_speed_right -0.08 //car turnright speed
#define wheel_speed_left_translation 0.08 //speed of car left translation
#define wheel_speed_right_translation -0.08 //speed of car right translation
enum{FORWARD=1,BACK,LEFT,RIGHT,LEFT_TRANSLATION,RIGHT_TRANSLATION,STOP}; //the movement state of the car
float wheel_Speed[4]={0,0,0,0};
char cmd_return[200];
void setup()
{
delay(1000);
Serial.begin(57600);delay(1000);//open serial
mySerial.begin(BusServoSerialBaud);delay(1000);//open serial2
car_move_test();
}
void loop()
{
//car_move_test();//car action test
//car_stop();
}
void car_move_test()//car action test
{
Car_Move(FORWARD);delay(ActionDelayTimes); // forward
car_stop();
Car_Move(BACK);delay(ActionDelayTimes); // back
car_stop();
Car_Move(LEFT_TRANSLATION);delay(ActionDelayTimes); //left translation
car_stop();
Car_Move(RIGHT_TRANSLATION);delay(ActionDelayTimes);//right translation
car_stop();
Car_Move(LEFT);delay(ActionDelayTimes); //turnleft
car_stop();
Car_Move(RIGHT);delay(ActionDelayTimes); //turn right
car_stop();
}
② 观察底盘的运动情况。
三、传感器使用
1. 底盘循迹-灰度传感器
实现思路
实现全向底盘可以按指定路线进行行走的功能(实验场景如下图所示)。
操作步骤
① 连接电路。如下图所示是全向底盘上的4个灰度接线,但本实验中我们只需要用到头部的两个灰度传感器即可。
② 下载文末资料中的参考程序Base_Experiment\Tracking_Car\Tracking_Car.ino:
/*------------------------------------------------------------------------------------
版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.
Distributed under MIT license.See file LICENSE for detail or copy at
https://opensource.org/licenses/MIT
by 机器谱 2023-08-16 https://www.robotway.com/
------------------------------*/
/*
*Tracking Car
*
* head
* pin:42 pin:44
* ___________
* | |
* | |
* | |
* | |
* |___________|
* pin:36 pin:34
* Rear end
* 2020.8.7 by boris
*/
#define mySerial Serial2 //statement serial2
#define Sensor_Numbers 4 //numbers of sensor
#define Serial_Baud_Rate 115200 //serial port baud rate
#define BusServoSerialBaud 115200//bus steering gear baud rate
#define wheel_speed_forward 0.06 //car forward speed
#define wheel_speed_back -0.06 //car back speed
#define wheel_speed_stop 0.0 //car stop speed
#define wheel_speed_left 0.1 //car turnleft speed
#define wheel_speed_right -0.1 //car turnright speed
enum{FORWARD=1,BACK,LEFT,RIGHT,STOP};//the movement state of the car
const int Gray_Sensor_Pin[Sensor_Numbers] = {44,42,36,34};//define gray sensor pin
const int GraySensorNumbers = sizeof(Gray_Sensor_Pin)/sizeof(Gray_Sensor_Pin[0]);
char cmd_return[200];
void setup(){
delay(1100);Serial.begin(Serial_Baud_Rate);
Gray_Sensor_Init();
mySerial.begin(BusServoSerialBaud);delay(1000);
}
void loop(){
tracking_car();//car tracking
//Car_Move(STOP);
}
void Gray_Sensor_Init()//sensor init
{
for(int i=0;i<Sensor_Numbers;i++)
{
pinMode(Gray_Sensor_Pin[i],INPUT);delay(2);
} delay(200);
}
void tracking_car() //car tracking
{
int sensor_data[Sensor_Numbers] = {0,0,0,0};
int sum = 0;
for(int i=0;i<Sensor_Numbers-2;i++)
{
sensor_data[i] = digitalRead(Gray_Sensor_Pin[i]);
sum |= sensor_data[i] << i;
}
switch(sum)
{
case 0: Car_Move(FORWARD); break;
case 1: Car_Move(LEFT); break;
case 2: Car_Move(RIGHT); break;
case 3: Car_Move(FORWARD); break;
default: break;
}
}
③ 观察全向底盘循迹的效果。
2. 底盘避障-超声测距
实现思路
实现全向底盘可以在模拟的场景下进行避障然后行进的功能(实验场景如下图所示)。
操作步骤
① 连接电路,如下图所示是全向底盘的8个超声测距接线图。
② 下载文末资料中的参考程序Base_Experiment\Avoiding_Obstacles_Car\Avoiding_Obstacles_Car.ino:
/*------------------------------------------------------------------------------------
版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.
Distributed under MIT license.See file LICENSE for detail or copy at
https://opensource.org/licenses/MIT
by 机器谱 2023-08-16 https://www.robotway.com/
------------------------------*/
/*
* Avoid obstacles car
*
*
* 车身位置及传感器接线:
*
* // Y
* // |
* // |
* // | t:53 t:8
* // | (ID:003) e:A15 e:9 (ID:001)
* // | t:37 A - - - - - - - - - - - - - - - - - -Y: t:39
* // | e:38 | | e:40
* // | | | 车头
* // | t:31 | | t:45
* // | e:32 Z - - - - - - - - - - - - - - - - - -X: e:46
* // | (ID:002) t:47 t:A13 (ID:000)
* // | e:48 e:A14
* // 0-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- X
*
*
* 2020.8.7 by boris
*/
#define mySerial Serial2 //Serial port used by bus steering gear
#define Serial_Baud_Rate 115200 //Serial Port baud rate
#define BusServoSerialBaud 115200 //Bus steering gear baud rate
#define wheel_speed_forward 0.04 //car forward speed
#define wheel_speed_forward_up 0.06 //forward speed up
#define wheel_speed_back -0.04 //car back speed
#define wheel_speed_stop 0.0 //car stop speed
#define wheel_speed_left 0.1 //car turnleft speed
#define wheel_speed_right -0.1 //car turnright speed
#define wheel_speed_left_translation 0.04 //speed of car left translation
#define wheel_speed_right_translation -0.04 //speed of car right translation
enum{FORWARD=1,BACK,LEFT,RIGHT,LEFT_TRANSLATION,RIGHT_TRANSLATION,STOP,FORWARD_UP}; //the movement state of the car
char cmd_return[200];
float wheel_Speed[4]={0,0,0,0};
void setup(){
delay(1100);Serial.begin(Serial_Baud_Rate);
init_Ultrasonic();delay(200);
mySerial.begin(BusServoSerialBaud);delay(1000);
}
void loop(){
//Car_Move(STOP);delay(1000);
car_move();
//get_ultrasonic_sensor_data();
}
③ 观察全向底盘避障的效果。
程序源代码详见 桌面级全向底盘