繁体   English   中英

Raspberry Pi 3 B+ (Buster) 无法控制 Dynamixel AX-12A 与 Raspberry Pi 3 B+ (Buster) 与半双工通信

[英]Raspberry Pi 3 B+ (Buster) can't control Dynamixel AX-12A with Raspberry Pi 3 B+ (Buster) with half duplex communication

我有一个项目用 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM