< >
Home » Alohamini入门教程 » AlohaMini入门教程-测试-通过调试命令控制移动

AlohaMini入门教程-测试-通过调试命令控制移动

说明:

  • 介绍如何通过调试命令控制移动

步骤:

  • 需要使用nomachine远程到树莓派来执行调试命令

  • 注意,在树莓派使用以下调试命令的时候,代码中使用了pynput,而pynput依赖x11 监听键盘事件,所以,使用终端前,需要检查使用的显示模式是否为x11

  • 查看当前使用的显示模式

echo $XDG_SESSION_TYPE
  • 切换显示模式Wayland为X11,把代码中的这一行注释取消变为WaylandEnable = false
sudo vim /etc/gdm3/custom.conf 
  • 重启显示管理器服务
sudo systemctl restart gdm3
  • 添加权限
sudo chmod 777 /dev/ttyACM*
  • 进入目录
cd ~/lerobot_alohamini
  • 激活环境
conda activate lerobot_alohamini
  • 查看舵机的状态
python examples/debug/motors.py get_motors_states --port /dev/ttyACM0
  • 查看舵机的状态,结果如下:
Connected on port /dev/ttyACM0
Online IDs: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11] on /dev/ttyACM0
--------------------------------------------------------------------------------------------------------------------------------------------
NAME            |  ID |    POS |    OFF |    ANG |   LOAD |    ACC | VOLT | CURR(MA) | TEMP | PORT
motor_1         |   1 |   2157 |   1949 |  189.6 |      0 |    254 |  116 |      0.0 |   31 | /dev/ttyACM0    
motor_2         |   2 |    903 |   -776 |   79.4 |      0 |    254 |  116 |      0.0 |   30 | /dev/ttyACM0    
motor_3         |   3 |   3051 |   1135 |  268.2 |      0 |    254 |  114 |      0.0 |   32 | /dev/ttyACM0    
motor_4         |   4 |   2629 |  -1917 |  231.1 |      0 |    254 |  115 |      0.0 |   29 | /dev/ttyACM0    
motor_5         |   5 |   2152 |  -1995 |  189.1 |      0 |    254 |  114 |      0.0 |   31 | /dev/ttyACM0    
motor_6         |   6 |   2082 |    877 |  183.0 |      0 |    254 |  115 |      0.0 |   29 | /dev/ttyACM0    
motor_8         |   8 |   3848 |      0 |  338.2 |      0 |    254 |  114 |      0.0 |   26 | /dev/ttyACM0    
motor_9         |   9 |   2528 |      0 |  222.2 |      0 |    254 |  115 |      0.0 |   28 | /dev/ttyACM0    
motor_10        |  10 |   3675 |      0 |  323.0 |      0 |    254 |  114 |      0.0 |   27 | /dev/ttyACM0    
motor_11        |  11 |   2693 |      0 |  236.7 |      0 |    254 |  114 |      0.0 |   28 | /dev/ttyACM0    
--------------------------------------------------------------------------------------------------------------------------------------------
Updated: 15:35:07   (Ctrl+C 退出)
  • 控制底盘移动的命令,分别按 w 、a 、s 、z 、x 、r、f键进行控制机器人。向前: w,向后: s,向左: a,向右: d,左转: z,右转: x,增加速度: r,减低速度: f
python examples/debug/wheels.py --port /dev/ttyACM0
  • 执行控制底盘移动命令的结果
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[2276, 2276, 2276]
raw:[2276, 2276, 2276]
raw:[2276, 2276, 2276]
raw:[2276, 2276, 2276]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[-1304, 2608, -1304]
raw:[-1304, 2608, -1304]
raw:[-1304, 2608, -1304]
raw:[-1304, 2608, -1304]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[0, 0, 0]
raw:[0, 0, 0]
  • 控制升降台的命令,分别按u、j键进行控制升降台Z轴。升降台向上: u,升降台向下: j
python examples/debug/axis.py --port /dev/ttyACM0
  • 执行控制升降台命令的结果
[DEBUG] Present_Current=0.0 mA
[DEBUG] Present_Current=0.0 mA
[DEBUG] Present_Current=0.0 mA
[DEBUG] Present_Current=0.0 mA
[DEBUG] Present_Current=0.0 mA
[DEBUG] Present_Current=19.5 mA
[DEBUG] Present_Current=182.0 mA
[DEBUG] Present_Current=260.0 mA
[DEBUG] Present_Current=312.0 mA
[DEBUG] Present_Current=182.0 mA
[DEBUG] Present_Current=58.5 mA
[DEBUG] Present_Current=19.5 mA
[DEBUG] Present_Current=19.5 mA
[DEBUG] Present_Current=26.0 mA
[DEBUG] Present_Current=26.0 mA
  • 禁用所有机械臂电机的扭矩
python examples/debug/motors.py reset_motors_torque  --port /dev/ttyACM0
  • 通过 ID 旋转特定电机
python examples/debug/motors.py move_motor_to_position --id 1 --position 2 --port /dev/ttyACM1
  • 设置新的电机 ID
python examples/debug/motors.py configure_motor_id --id 10 --set_id 8 --port /dev/ttyACM0
  • 重置当前位置为电机中点
python examples/debug/motors.py reset_motors_to_midpoint --port /dev/ttyACM1

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: none