This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!!!程序需要开发板安装RT Linux系统!!! #新建mt_ws文件夹,将src文件放在mt_ws下 #加载环境 sudo ethercatctl start source /opt/ros/humble/setup.bash #构建(在工作空间下) colcon build --symlink-install 给可执行文件setcap cmake --build build/ethercat_control --target setcap_ethercat_node # 加载工作空间环境 source ~/mt_ws/install/setup.bash #运行主程序 ros2 run ethercat_control ethercat_node #新开终端运行测试指令 ros2 topic pub --rate 10 /ethercat/set std_msgs/msg/String "data: '0 pos 0; 1 pos 0; 2 pos 0;3 pos 0'" 第一个参数为电机Ethercat上的id 第二个参数为模式 分为pos vel tor,对应位置、速度、扭矩模式 第三个参数为位置/速度/扭矩设定值 举例: 0 pos 0 为将0号电机运行至0位 1 pos 65535 为将1号电机运行至180度位置