当前位置: 首页 > news >正文

松灵机器人地盘 安装 ros 驱动 并且 发布ros 指令进行控制

安装驱动

$ cd ~/catkin_ws/src
$ git clone https://github.com/agilexrobotics/ugv_sdk.git  
$ git clone https://github.com/agilexrobotics/scout_ros.git
$ cd ..
$ catkin_make

安装

● 使能 gs_usb 内核模块
● 设置 500k 波特率和使能 can-to-usb 适配器

sudo modprobe gs_usb
sudo ip link set can0 up type can bitrate 500000
sudo apt install can-utils
roslaunch scout_bringup scout_robot_base.launch

启动成功后 是这样

RTNETLINK answers: Device or resource busy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
can-utils is already the newest version (2018.02.0-1).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
... logging to /home/lg/.ros/log/6a676b6a-f5ee-11ef-a0ac-24ec992f7fe4/roslaunch-lg-scout-3667.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://lg-scout:41271/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13
 * /scout_base_node/base_frame: base_link
 * /scout_base_node/is_scout_mini: False
 * /scout_base_node/is_scout_omni: False
 * /scout_base_node/odom_frame: odom
 * /scout_base_node/odom_topic_name: odom
 * /scout_base_node/port_name: can0
 * /scout_base_node/pub_tf: False
 * /scout_base_node/simulated_robot: False

NODES
  /
    scout_base_node (scout_base/scout_base_node)

auto-starting new master
process[master]: started with pid [3677]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 6a676b6a-f5ee-11ef-a0ac-24ec992f7fe4
process[rosout-1]: started with pid [3688]
started core service [/rosout]
process[scout_base_node-2]: started with pid [3691]
[ INFO] [1740758981.233051051]: Working as scout mini: 0
[ INFO] [1740758981.233888549]: Working as scout omni: 0
Start listening to port: can0
Detected protocol: AGX_V2
Start listening to port: can0
[ INFO] [1740758981.297304150]: Using CAN bus to talk with the robot

发指令前进

rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: -1, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'

这样小车就动起来了
在这里插入图片描述

还可以用python 发指令

#!/usr/bin/env python3
import rospy
from geometry_msgs.msg import Twist

rospy.init_node('velocity_commander')
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=10)

rate = rospy.Rate(10)  # 10Hz
while not rospy.is_shutdown():
    cmd = Twist()
    cmd.linear.x = 3  # 前进速度 0.2 m/s
    cmd.angular.z = 0 # 旋转角速度 0.5 rad/s
    pub.publish(cmd)
    rate.sleep()

还可以 用键盘控制

source ./devel/setup.sh 
roslaunch scout_bringup scout_teleop_keyboard.launch
.. logging to /home/lg/.ros/log/6a676b6a-f5ee-11ef-a0ac-24ec992f7fe4/roslaunch-lg-scout-3917.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://lg-scout:40907/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13
 * /teleop_keybord/repeat_rate: 50.0

NODES
  /
    teleop_keybord (teleop_twist_keyboard/teleop_twist_keyboard.py)

ROS_MASTER_URI=http://localhost:11311

process[teleop_keybord-1]: started with pid [3932]

Reading from the keyboard  and Publishing to Twist!
---------------------------
Moving around:
   u    i    o
   j    k    l
   m    ,    .

For Holonomic mode (strafing), hold down the shift key:
---------------------------
   U    I    O
   J    K    L
   M    <    >

t : up (+z)
b : down (-z)

anything else : stop

q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%

CTRL-C to quit

currently:	speed 0.5	turn 1.0 

按 U I O

J K L

M < > 可以运行

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.dtcms.com/a/44590.html

相关文章:

  • AI辅助学习vue第十五章
  • 【UCB CS 61B SP24】Lecture 17 - Data Structures 3: B-Trees学习笔记
  • Java中使用for和Iterator遍历List集合的区别
  • Linux-基本指令3
  • 象棋笔记-实战记录
  • 【算法】链表题型总结
  • Java里的ArrayList和LinkedList有什么区别?
  • Vue 3 状态管理实战:构建用户登录注册功能 - 掌握 Vuex 集中管理应用状态
  • Vue核心知识:动态路由实现完整方案
  • 第七章:项目实战 - 第二节 - Tailwind CSS 响应式官网开发
  • Python的那些事第三十六篇:基于 Vega 和 Vega-Lite 的数据可视化解决方案,Altair 声明式可视化库
  • 机器学习决策树
  • Oracle性能调优(一):时间模型统计
  • 使用C#控制台调用本地部署的DeepSeek
  • 大型旋转机械装备转子健康监控与故障诊断模块
  • C 语言共用体:深入理解与实践】
  • Redis面试题
  • 【Unity】搭建HTTP服务器并解决IP无法访问问题解决
  • 激活函数ReLU的原理与应用
  • linux-Dockerfile及docker-compose.yml相关字段用途
  • 记忆化搜索与动态规划:原理、实现与比较
  • 2025春新生培训数据结构(树,图)
  • 【后端】Docker一本通
  • MacBook Pro使用FFmpeg捕获摄像头与麦克风推流音视频
  • PHP:从入门到进阶,掌握动态网页开发的利器
  • C++ primer plus 第五节 循环
  • 分布式系统核心基石:CAP定理、BASE理论与一致性算法深度解析
  • 2024年12月中国电子学会青少年软件编程(Python)等级考试试卷(五级)答案 + 解析
  • LeetCode 链表章节 (持续更新中)
  • 接口测试及常用接口测试工具(postman/jmeter)