经过5年尝试和努力,在吸取indigo、kinetic版本经验后,融合Arduino、ROS1、ROS2、Gazebo和SLAM的适用机器人爱好者的实践课程镜像尝鲜版(bug是免不了的!_!)终于完成了。
非常感谢给我宝贵建议的学生、老师以及热心的博客朋友们,祝福大家新春快乐。
留言提出建议和需求一经采纳,就有机会获赠如下小礼物(不要私信哦,太多了,无法回答了,并且其他朋友看不到):
限量版,只供赠送,内置本文镜像和相关资料。
距离上一次镜像发布()已经快4年了,在了解和使用前推荐阅读,如获点赞或打赏感激不尽:
沉迷机器人操作系统的一个理由和四种修仙秘籍
ROS2机器人操作系统零基础快速入门
唯一需要自备的硬件为Arduino及其相关配件:
制作遥控ROS机器人的手柄或IoT物联网传感器
机器人实践课程镜像分享及使用说明分为6大部分,分别为:
镜像使用说明
Arduino案例
ROS1案例
ROS2案例
Gazebo案例
SLAM案例
镜像依据本科课程制作,以项目式案例教学和实践为主,适用上述课程(点击可打开链接,了解详细内容):
现代控制理论(机器人控制系统理论和应用案例)专业工具软件(机器人软硬件设计)机器人系统设计与控制技术(项目案例)计算机控制技术(机器人生产线案例)人机智能交互技术(机器人交互案例)ROS机器人高效编程(理论基础与编程实践)ROS2机器人高效编程(理论基础与编程实践)智能机器人综合实训(独立项目案例和综合设计)SLAM技术(以实践应用为主进行案例汇总)
分别涵盖在不同时期发布的教学镜像中,经过学生使用、实践和反馈,逐步改进和完善,但由于水平有限和能力不足,依然存在不少问题,可自行研究解决。
第一部分:镜像使用说明
下载链接:/5yS1hT6 密码:rmxebn
制作iso镜像U盘启动使用rufus-3.8p,可以直接去官网下载,iso镜像文件较大3.54GB。
实践课已经详细讲解过使用方式,需要用管理员权限启动rufus,具体流程如下图所示。
支持legacy和UEFI双模式。
制作速度依据U盘读写速度而定,SLC盘小于2分钟,年代久远的古董盘超过20分钟也正常。
做好后的课程学习盘内部文件如下图所示:
在开机BIOS设置为U盘启动,或者直接快捷方式更改启动顺序设定U盘为先。
此处需注意,legacy和UEFI启动界面略有差异,镜像支持安装:
打开终端,输入$sudo ubiquity输入密码:ros
此镜像为个人上课使用,测试时间.6-.1,用户名为博客名,不喜欢可以随意修改。
测试过10+型号笔记本和台式机,兼容性良好,也有部分电脑需要专业级设置,属于个别案例。
测试截图如下:
1. U盘系统:
较新配置台式机
较旧配置台式机
2. U盘镜像:
较新配置笔记本
较旧配置笔记本
Desktop
Arduino
# ROS 1.0 melodic or ROS 2.0 Dashingecho Hello, ROS 1.0 or ROS 2.0? 1=Melodic 2=Dashing read ROSif (($ROS==1));thensource /opt/ros/melodic/setup.bash#export ROS_PACKAGE_PATH=/home/relaybot/RobTool/ROS1/Wiki/src:/home/relaybot/RobTool/Cozmo/ros/src:$ROS_PACKAGE_PATH#source /home/relaybot/RobTool/ROS1/Wiki/devel/setup.bash#export ROS_MASTER_URI=http://192.168.1.100:11311#export ROS_IP=192.168.1.100echo "Melodic"elif (($ROS==2));thensource /opt/ros/dashing/setup.bashecho "Dashing"elseecho "Non-ROS"fi# turtlebot3 model env TURTLEBOT3_MODEL model type [burger, waffle, waffle_pi]" name="model"export TURTLEBOT3_MODEL=waffle
ROS1+ROS2
Gazebo
SLAM 高翔 等著, 视觉SLAM十四讲:从理论到实践(第2版)
第二部分:Arduino案例
AD0-LED13// These constants won't change. They're used to give names to the pins used:int i=0,j=0,stime=32,sloop=0;const int atime=16;const int analogInPin = A0; // Analog input pin that the potentiometer is attached toint sensorValue = 0; // value read from the potint outputValue = 0; // value output to the PWM (analog out)void setup() {// initialize serial communications at 9600 bps:pinMode(LED_BUILTIN, OUTPUT); Serial.begin(9600);}void loop() {// read the analog in value:sensorValue = analogRead(analogInPin);// map it to the range of the analog out:outputValue = map(sensorValue, 0, 1023, 0, atime);// change the analog out value:stime=outputValue;// print the results to the Serial Monitor://Serial.print("sensor = ");//Serial.print(sensorValue);//Serial.print("\t output = ");//Serial.println(outputValue);ledfade(stime);// wait 2 milliseconds before the next loop for the analog-to-digital// converter to settle after the last reading:}void ledfade(int i){digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)delay(i);// wait for a seconddigitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOWdelay(atime-i);// wait for a second}
AD3&4&5-/cmd_vel(ROS)
#if (ARDUINO >= 100)#include <Arduino.h>#else#include <WProgram.h>#endif#include <ros.h>#include <rosserial_arduino/Adc.h>#include <geometry_msgs/Twist.h>ros::NodeHandle nh;rosserial_arduino::Adc adc_msg;geometry_msgs::Twist twist_msg;ros::Publisher p("adc", &adc_msg);ros::Publisher t("cmd_vel", &twist_msg); //turtlesim turtle1/cmd_vel//turtlebot3 cmd_vel//husky cmd_velvoid setup(){ pinMode(13, OUTPUT);nh.initNode();nh.advertise(p);nh.advertise(t);}//We average the analog reading to elminate some of the noiseint averageAnalog(int pin){int v=0;for(int i=0; i<4; i++) v+= analogRead(pin);return v/4;}long adc_timer;int x_mid=600,y_mid=600,x_now=600,y_now=600;int adc_init=100;void loop(){adc_msg.adc0 = averageAnalog(0);adc_msg.adc1 = averageAnalog(1);adc_msg.adc2 = averageAnalog(2);adc_msg.adc3 = averageAnalog(3);adc_msg.adc4 = averageAnalog(4);adc_msg.adc5 = averageAnalog(5);x_now=adc_msg.adc5-x_mid;y_now=adc_msg.adc4-y_mid;adc_init=adc_msg.adc3;if(adc_init<10){x_mid=adc_msg.adc5;y_mid=adc_msg.adc4;}if(x_now>0)twist_msg.linear.x=map(x_now,0,1023-x_mid,0,255);elsetwist_msg.linear.x=map(x_now,-x_mid,0,-255,0);if(y_now>0)twist_msg.angular.z=map(y_now,0,1023-y_mid,0,255);elsetwist_msg.angular.z=map(y_now,-y_mid,0,-255,0); twist_msg.linear.x=twist_msg.linear.x/(1024.0-adc_msg.adc0)/4.0;twist_msg.angular.z=-twist_msg.angular.z/(1024.0-adc_msg.adc0);p.publish(&adc_msg);t.publish(&twist_msg);nh.spinOnce();// delay(1);}
C++&Arduino+ROS
第三部分:ROS1案例
turtlesim+actionroscorerosrun turtlesim turtlesim_noderosrun turtle_actionlib shape_serverrosrun turtle_actionlib shape_clientrqt_graph
turtlebot3+rqt_image_view
roslaunch turtlebot3_gazebo turtlebot3_world.launchrqt_image_view
第四部分:ROS2案例
turtlesim+action+rqtros2 run turtlesim turtlesim_noderos2 run turtlesim turtle_teleop_keyrqt
dummy_robot_bringup+rviz2
ros2 launch dummy_robot_bringup dummy_robot_bringup.launch.pyrviz2
demo.rviz
Panels:- Class: rviz_common/DisplaysHelp Height: 78Name: DisplaysProperty Tree Widget:Expanded:- /Global Options1- /Status1Splitter Ratio: 0.5Tree Height: 435- Class: rviz_common/SelectionName: Selection- Class: rviz_common/Tool PropertiesExpanded:- /2D Nav Goal1- /Publish Point1Name: Tool PropertiesSplitter Ratio: 0.5886790156364441- Class: rviz_common/ViewsExpanded:- /Current View1Name: ViewsSplitter Ratio: 0.5Visualization Manager:Class: ""Displays:- Alpha: 0.5Cell Size: 1Class: rviz_default_plugins/GridColor: 160; 160; 164Enabled: trueLine Style:Line Width: 0.029999999329447746Value: LinesName: GridNormal Cell Count: 0Offset:X: 0Y: 0Z: 0Plane: XYPlane Cell Count: 10Reference Frame: <Fixed Frame>Value: true- Alpha: 0.699999988079071Class: rviz_default_plugins/MapColor Scheme: mapDraw Behind: falseEnabled: trueName: MapTopic: /mapUnreliable: falseUse Timestamp: falseValue: true- Alpha: 1Autocompute Intensity Bounds: trueAutocompute Value Bounds:Max Value: 10Min Value: -10Value: trueAxis: ZChannel Name: intensityClass: rviz_default_plugins/LaserScanColor: 255; 255; 255Color Transformer: IntensityDecay Time: 0Enabled: trueInvert Rainbow: falseMax Color: 255; 255; 255Max Intensity: 4096Min Color: 0; 0; 0Min Intensity: 0Name: LaserScanPosition Transformer: XYZQueue Size: 10Selectable: trueSize (Pixels): 3Size (m): 0.009999999776482582Style: Flat SquaresTopic: /scanUnreliable: falseUse Fixed Frame: trueUse rainbow: trueValue: true- Alpha: 1Axes Length: 1Axes Radius: 0.10000000149011612Class: rviz_default_plugins/PoseColor: 255; 25; 0Enabled: trueHead Length: 0.30000001192092896Head Radius: 0.10000000149011612Name: PoseShaft Length: 1Shaft Radius: 0.05000000074505806Shape: ArrowTopic: /move_base_simple/goalUnreliable: falseValue: true- Class: rviz_default_plugins/TFEnabled: trueFrame Timeout: 15Frames:All Enabled: trueMarker Scale: 1Name: TFShow Arrows: trueShow Axes: trueShow Names: falseTree:{}Update Interval: 0Value: true- Alpha: 1Class: rviz_default_plugins/RobotModelCollision Enabled: falseDescription File: ""Description Source: TopicDescription Topic: ""Enabled: trueLinks:All Links Enabled: trueExpand Joint Details: falseExpand Link Details: falseExpand Tree: falseLink Tree Style: ""Name: RobotModelTF Prefix: ""Unreliable: falseUpdate Interval: 0Value: trueVisual Enabled: trueEnabled: trueGlobal Options:Background Color: 48; 48; 48Fixed Frame: worldFrame Rate: 30Name: rootTools:- Class: rviz_default_plugins/MoveCamera- Class: rviz_default_plugins/Select- Class: rviz_default_plugins/FocusCamera- Class: rviz_default_plugins/MeasureLine color: 128; 128; 0- Class: rviz_default_plugins/SetInitialPoseTopic: /initialpose- Class: rviz_default_plugins/SetGoalTopic: /move_base_simple/goal- Class: rviz_default_plugins/PublishPointSingle click: trueTopic: /clicked_pointTransformation:Current:Class: rviz_default_plugins/TFValue: trueViews:Current:Class: rviz_default_plugins/OrbitDistance: 8.303964614868164Enable Stereo Rendering:Stereo Eye Separation: 0.05999999865889549Stereo Focal Distance: 1Swap Stereo Eyes: falseValue: falseFocal Point:X: 0.5349314212799072Y: -1.8630497455596924Z: 0.5543326139450073Focal Shape Fixed Size: trueFocal Shape Size: 0.05000000074505806Invert Z Axis: falseName: Current ViewNear Clip Distance: 0.009999999776482582Pitch: 0.7453981041908264Target Frame: <Fixed Frame>Value: Orbit (rviz)Yaw: 1.8422259092330933Saved: ~Window Geometry:Displays:collapsed: falseHeight: 664Hide Left Dock: falseHide Right Dock: trueQMainWindow State: 000000ff00000000fd0000000400000000000001560000023efc0200000008fb000000130065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c00200050007f00700065007400690065007302000001ed000001df00000185000000a3fb00000016006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c00200050007f007000650074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000023e000000c900fffffffb0000002000730065006c0065006300740069006f006e002000650066006600650070000138000000aa0000023a00000294fb0000001400570069006400650053007400650075006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000023efc0200000003fb0000001e0054006f006f006c00200050007f0070006500740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d0000023e000000a400fffffffb000000130065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000002a40000023e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000Selection:collapsed: falseTool Properties:collapsed: falseViews:collapsed: trueWidth: 1024X: 0Y: 27
第五部分:Gazebo案例
ROS1
ROS编程基础课程更新版资料和习题解答说明(ETH苏黎世联邦理工学院)适用indigo、kinetic和melodicROS2
Gazebo和ROS2的使用说明ros2 topic pub /demo/cmd_demo geometry_msgs/Twist '{linear: {x: 0.2}}' -1
第六部分:SLAM案例
理论基础1-6章
实践应用7-14章
高翔 等著, 视觉SLAM十四讲:从理论到实践(第2版)
ROS:~$tree -L 3
.├── Arduino│ ├── course│ │ ├── ADCdemo│ │ ├── AnalogInOutLEDdemo│ │ ├── AnalogInOutLEDtimedemo│ │ ├── AnalogInputdemo│ │ ├── Blinkdemo│ │ ├── blinkmicrosdemo│ │ ├── Buttondemo│ │ ├── Controldemo│ │ ├── Controlplusdemo│ │ ├── Controlplusdemo2│ │ ├── DHTtesterDemo│ │ ├── dueControldemo│ │ ├── HCSR04demo│ │ ├── Knobdemo│ │ ├── motordemo│ │ ├── robotdemo│ │ └── tonePitchFollowerdemo│ └── libraries│├── Adafruit_Circuit_Playground│├── Adafruit_Unified_Sensor│├── DHT_sensor_library│├── readme.txt│├── Rosserial_Arduino_Library│└── SD├── Desktop│ └── demo.rviz├── Documents│ ├── Arduino│ │ ├── imutovel.py│ │ ├── Integrating Arduino-Based Educational Mobile Robots in ROS.pdf│ │ ├── LabLecture3 Hardware interfacing Arduino.pdf│ │ ├── note191125.md│ │ ├── Programming Your First Robot - EE100 Fall .pdf│ │ └── 机器人控制器编程-总结篇.pdf│ └── Fritzing│├── bins│└── parts├── Downloads│ ├── android_camera_imu.apk│ ├── pinguybuilder_5.1-8_all.deb│ ├── pycozmo-master.zip│ └── slambook2-master.zip├── Music├── Pictures│ ├── Screenshot from -01-07 14-44-21.png│ ├── Screenshot from -01-07 14-51-44.png│ ├── Screenshot from -01-07 14-55-28.png│ ├── Screenshot from -01-07 14-56-49.png│ ├── Screenshot from -01-07 15-05-16.png│ ├── Screenshot from -01-07 15-18-33.png│ ├── Screenshot from -01-07 15-54-15.png│ ├── Screenshot from -01-07 15-57-50.png│ ├── Screenshot from -01-07 16-08-05.png│ ├── Screenshot from -01-07 16-26-15.png│ └── Wallpapers│└── ubunturobot.png├── Public├── Roft│ ├── arduino│ │ └── arduino-1.8.10│ ├── cozmo_ros2_ws│ │ ├── build│ │ ├── install│ │ ├── log│ │ └── src│ ├── Micro-XRCE-DDS-Agent│ │ ├── agent.refs│ │ ├── build│ │ ├── cmake│ │ ├── CMakeLists.txt│ │ ├── CTestJenkins.cmake│ │ ├── Dockerfile│ │ ├── docs│ │ ├── include│ │ ├── LICENSE│ │ ├── microxrce_agent.cpp│ │ ├── README.md│ │ ├── src│ │ ├── test│ │ ├── thirdparty│ │ ├── utils│ │ └── valgrind.supp│ ├── opencv-4.1.2│ │ ├── 3rdparty│ │ ├── apps│ │ ├── build│ │ ├── cmake│ │ ├── CMakeLists.txt│ │ ├── CONTRIBUTING.md│ │ ├── data│ │ ├── doc│ │ ├── include│ │ ├── LICENSE│ │ ├── modules│ │ ├── platforms│ │ ├── README.md│ │ └── samples│ └── tello_ros2_ws│├── build│├── install│├── log│└── src├── SLAM│ └── slambook2│├── ch10│├── ch11│├── ch12│├── ch13│├── ch2│├── ch3│├── ch4│├── ch5│├── ch6│├── ch7│├── ch8│├── ch9│├── errata.cls│├── errata.pdf│├── errata.tex│├── figures│├── LICENSE│└── README.md├── Templates└── Videos
-01-07
~Fin~