# tsp_upper **Repository Path**: tsprobot/tsp_upper ## Basic Information - **Project Name**: tsp_upper - **Description**: tsp上层主控 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2024-03-30 - **Last Updated**: 2024-11-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # tsp_upper ### 1.系统配置 - 系统:ubuntu 20.04 - 机器名:nx1 - 用户名:robot - 密码:1 - 电压:12V - 连接显示器,键盘鼠标 - 通过网线连接tsp路由器,不能使用无线 - 设置固定ip为192.168.2.100 - 设置将用户改为自动登陆 配置.bashrc ```bash if [ "$(cat ~/.bashrc | grep /opt/ros/noetic/setup.bash)" == "" ]; then echo source /opt/ros/noetic/setup.bash >> ~/.bashrc fi if [ "$(cat ~/.bashrc | grep catkin_ws/devel/setup.bash)" == "" ]; then echo source ${HOME}/catkin_ws/devel/setup.bash >> ~/.bashrc fi if [ "$(cat ~/.bashrc | grep ROS_HOSTNAME)" == "" ]; then echo export ROS_HOSTNAME=192.168.2.100 >> ~/.bashrc fi if [ "$(cat ~/.bashrc | grep ROS_MASTER_URI)" == "" ]; then echo export ROS_MASTER_URI=http://192.168.2.101:11311 >> ~/.bashrc fi source ~/.bashrc #测试连通 ping 192.168.2.101 #测试ROS互联 rosrun rospy_tutorials listener.py rosnode list rostopic list ``` ### 2.笔记本远程连接 ```bash #笔记本通过无线连接tsp路由器,SSID为TSP5 #vscode安装remote ssh插件,配置中填写下面内容 Host tsp_upper.local HostName 192.168.2.100 User robot port 22 ForwardX11 yes ForwardX11Trusted yes ForwardAgent yes ``` ### 3.设备号固定和自动启动 ```bash #下载机器人功能包 git clone https://gitee.com/linuxfly/tsp_upper.git ~/tsp/tsp_upper git clone https://gitee.com/linuxfly/tsp_common.git ~/tsp/tsp_common #编辑并确认udev设置 code ~/tsp/tsp_upper/set_udev_rules.sh #执行并重启 sudo ~/tsp/tsp_upper/./set_udev_rules.sh ls /etc/udev/rules.d/ sudo reboot #观察设备号是否固定 ls -l /dev/xxx #u2d2适配器 ls -l /dev/xxx #RealSense D435i前向深度相机 ls -l /dev/xxx #fdilink_ahrs姿态传感器 ls -l /dev/xxx #罗技f710手柄无线适配器 cp ~/tsp/tsp_upper/tsp_upper_autostart.desktop ~/.config/autostart/ #重启或注销查看 ``` ### 4.编译运行 ```bash mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src catkin_init_workspace git clone -b ros1-legacy https://github.com/IntelRealSense/realsense-ros.git git clone https://gitee.com/linuxfly/fdilink_ahrs mv ~/tsp . cd ~/catkin_ws catkin_make ~/catkin_ws/src/tsp/tsp_upper/.run_all.sh ``` ### 5.镜像部署和远程连接(非必要) ```bash #下载机器人功能包 git clone https://gitee.com/linuxfly/tsp_dockerfile.git ~/tsp/tsp_dockerfile #编译镜像 ~/tsp/tsp_dockerfile/./build.sh ros-noetic ~/tsp/tsp_dockerfile/./build.sh upper-ros-noetic #修改宿主机hosts文件,添加tsp-upper主机名 if [ "$(cat /etc/hosts | grep tsp-upper)" == "" ]; then sudo /bin/bash -c "echo 127.0.1.1 tsp-upper >> /etc/hosts" fi #运行镜像 python3 ~/tsp/tsp_dockerfile/run.py upper-ros-noetic #远程开发笔记本配置提示信息 python3 ~/tsp/tsp_dockerfile/run.py upper-ros-noetic -ou #vscode安装remote ssh插件,根据上面的提示信息配置连接 #vscode 连接容器后测试编译 cd ~/catkin_ws catkin_make ``` ### f710手柄测试 ![avatar](tsp_gamepad/f710_usage.png) ```bash roslaunch tsp_gamepad f710.launch #注意:mode绿灯熄灭时换向和调速才起作用 ``` ### 旋转电机节点测试 ```bash roslaunch tsp_rotator rotator.launch #重设电机需要下载安装DYNAMIXEL Wizard #https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_wizard2/ ``` ### fdilink_ahrs测试 ```bash roslaunch fdilink_ahrs ahrs_data.launch port:=/dev/fdilink_ahrs ns:=tsp_upper #该节点和全部话题都带有/tsp_upper前缀 ``` ### 磁盘空间使用测试 ```bash roslaunch tsp_files disk_info.launch ns:=tsp_upper path:=${HOME}/share ``` ### 测试realsense、电机、姿态传感器bag录制 ```bash roslaunch tsp_bag_recorder bag_recorder.launch save_dir:=${HOME}/share prefix:=chongyang topics_file:=${HOME}/catkin_ws/src/tsp_upper/tsp_upper_bringup/record_bags.yaml ns:=tsp_upper #使用rosnode list查看节点 rosnode info /xxx查看节点发布的话题 #编辑record_bags.yaml文件,配置bag包名和需要录制的topic列表 #永远不使用的话题或者无内容话题可以不录制 ``` ### gui界面测试 ```bash roslaunch tsp_monitor monitor.launch ``` ### bringup测试和全部开启测试 ```bash roslaunch tsp_upper_bringup bringup.launch ns:=tsp_upper save_dir:=${HOME}/share #编译并测试全部脚本 ~/catkin_ws/src/tsp_upper/./test_all.sh ``` ### ros常用工具 ```bash rqt_graph rqt_topic rosrun rqt_reconfigure rqt_reconfigure ... ```