python-3.x - Raspberry Pi 3 B+ (Buster) 无法控制 Dynamixel AX-12A 与 Raspberry Pi 3 B+ (Buster) 与半双工通信
问题描述
我有一个项目用 Dynamixel AX-12A 作为轮子制作移动机器人,所以我将 AX-12A 更改为使用 CM-530 的轮子模式并且效果很好。
我遵循来自http://www.oppedijk.com/robotics/control-dynamixel-with-raspberrypi的指南
我已经使用 Terminal Minicom 在 Raspi 上检查了我的串行通信 (UART),只需将 GPIO14 和 GPIO15 连接在一起,它运行良好
这是我在代码末尾的 /boot/config.txt:
dtoverlay=pi3-disable-bt
hdmi_force_hotplug=1
enable_uart=1
init_uart_clock=16000000
这是我的 /boot/cmdline.txt:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles
这是我的 Python3 代码:
import serial
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setwarnings(False)
port = serial.Serial("/dev/ttyAMA0", baudrate=1000000, timeout=3.0)
while True:
GPIO.output(18, GPIO.HIGH)
port.write(bytearray.fromhex("FF FF 00 04 03 20 FF D8"))
time.sleep(0.1)
GPIO.output(18, GPIO.LOW)
time.sleep(3)
问题是 dynamixel ax-12a 没有响应我的 hexa,它应该以 255 的值移动。并且程序没有错误反馈。
顺便说一句,我正在通过 PC 中的 wifi 与 VNC 合作这个项目,这是否会导致通信问题?
如果有人可以帮助我,我会感谢你。
*对不起,如果我的英语不好
解决方案
经过很长时间的讨论,现在我可以控制电机了,问题是我发送了错误的指令包FF FF 00 04 03 20 FF D8
,应该是FF FF 00 05 03 20 FF 00 D8
。
推荐阅读
- system-verilog - 序列和序列项目有什么区别?
- python - 有没有办法强制 SimpleImputer 返回熊猫数据框?
- yii2 - 如何在 Yii2 模块中包含图像
- java - GrizzlyTestContainer 的 ServletContext
- java - 带有 Cosmos DB 的 Spring Boot 应用程序 SocketException
- tarantool - 在 Tarantool 中处理日期的正确方法是什么?
- php - 通过 PHP 添加 HTML attr
- java - 通过 Selenium 启动外部 VPN 软件
- json - 有没有办法将“environment.ts”文件导入 json?
- angular - 如何以角度强制关闭 ngx-contextmenu?