1. 功能描述
双轮提升搬运小车是一种用于搬运和移动物体的机械设备,它通常采用双轮驱动和提升装置。一般具备以下特点:
① 双轮驱动:该小车配备两个驱动轮,通过电动机或其它动力源驱动,提供足够的动力和扭矩,使其能够在平坦的地面上自由行驶。
② 提升装置:小车上设有提升装置,可用于搬运物体的升降操作。通过控制提升装置的操作,可以使小车上的货物升高或降低,以适应不同高度的搬运需求。
本文示例将实现R055b样机双轮提升搬运小车在行进过程中实现夹取的功能。
2. 电子硬件
在这个示例中,我们采用了以下硬件,请大家参考:
主控板 | Basra主控板(兼容Arduino Uno)
| 扩展板 | Bigfish2.1扩展板
| 电池 | 7.4V锂电池 |
3. 功能实现
编程环境:Arduino 1.8.19
下面提供一个双轮提升搬运小车在行进过程中实现夹取功能的参考程序(sketch_sep14a.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-09-15 https://www.robotway.com/
- ------------------------------*/
- #include <Servo.h>
- Servo armServo; // 机械臂舵机
- Servo clawServo; // 夹子舵机
- int armAngle = 90; // 机械臂初始角度
- int clawAngle = 90; // 夹子初始角度
- int leftMotorPin1 = 9; // 左电机引脚1
- int leftMotorPin2 = 10; // 左电机引脚2
- int rightMotorPin1 = 5; // 右电机引脚1
- int rightMotorPin2 = 6; // 右电机引脚2
- void setup() {
- armServo.attach(4); // 机械臂舵机连接到引脚4
- clawServo.attach(7); // 夹子舵机连接到引脚7
-
- pinMode(leftMotorPin1, OUTPUT);
- pinMode(leftMotorPin2, OUTPUT);
- pinMode(rightMotorPin1, OUTPUT);
- pinMode(rightMotorPin2, OUTPUT);
- }
- void loop() {
- // 小车前进
- forward();
- delay(1000);
-
- // 机械臂下落
- moveArm(130);
- delay(1000);
-
- // 夹爪闭合
- closeClaw();
- delay(1000);
-
- // 机械臂抬起
- moveArm(90);
- delay(1000);
-
- // 小车后退
- backward();
- delay(1000);
-
- // 夹爪张开
- openClaw();
- delay(1000);
- }
- // 控制机械臂运动到指定角度
- void moveArm(int angle) {
- armServo.write(angle);
- armAngle = angle;
- }
- // 控制夹爪闭合
- void closeClaw() {
- clawServo.write(160); // 根据实际情况调整角度
- clawAngle = 160;
- }
- // 控制夹爪张开
- void openClaw() {
- clawServo.write(60); // 根据实际情况调整角度
- clawAngle = 60;
- }
- // 小车前进
- void forward() {
- digitalWrite(leftMotorPin1, HIGH);
- digitalWrite(leftMotorPin2, LOW);
- digitalWrite(rightMotorPin1, HIGH);
- digitalWrite(rightMotorPin2, LOW);
- }
- // 小车后退
- void backward() {
- digitalWrite(leftMotorPin1, LOW);
- digitalWrite(leftMotorPin2, HIGH);
- digitalWrite(rightMotorPin1, LOW);
- digitalWrite(rightMotorPin2, HIGH);
- }
复制代码
4. 扩展样机
本样机有一些简单的扩展案例,如下图所示将驱动轮模块上的直流电机更换为舵机,或者在小车尾部安装一个牛眼万向轮:
5. 资料下载
资料内容:
①程序源代码
②样机3D文件
资料下载地址:双轮提升搬运小车 https://www.robotway.com/h-col-270.html |