turtlebot matlab,Get Started with a Real TurtleBot

Set Up New TurtleBot Hardware

The following steps use the TurtleBot 3 Waffle Pi platform (https://www.turtlebot.com/). The kit comes with a Raspberry Pi that has a pre-installed copy of ROS with the appropriate TurtleBot software. This procedure assumes that you are using a new TurtleBot of similar configuration. If you are already using a TurtleBot and communicating with it through an external computer, do not perform this procedure.

2438fd20ebfb8a08ec0126695242bfab.png

Unpack the TurtleBot and make sure the power source is connected.

Turn on the Raspberry Pi.

Make sure that you have a network set up to connect the host computer (the one with MATLAB) to the Raspberry Pi on this TurtleBot. Use a wireless router or an Ethernet cable.

Open a terminal on the Raspberry Pi and run ifconfig. The IP address associated with the network that you connected to is displayed.

3e6181870e347798b39733784e85a93b.png

Set the appropriate environment variables on the TurtleBot by executing the following commands. Execute these command only once.

echo export ROS_IP=IP_OF_TURTLEBOT >> ~/.bashrc

echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/.bashrc

sudo sh -c 'echo export ROS_IP=IP_OF_TURTLEBOT >> /etc/ros/setup.sh'

Make sure that you can ping the host machine from the Raspberry Pi:

ping IP_OF_HOST_COMPUTER

A successful ping is shown on the left. An unsuccessful ping is shown on the right.

9bb272efb6a20aa8ae14d20cacbb219d.png

Note: These environment variables must always have the correct IP address assigned to the TurtleBot. If the IP address of the TurtleBot Raspberry Pi changes, you must also change the environment variables using the preceding commands.

Here is a diagram illustrating the proper assignment of environment variables:

8fc1b56f98f0bcc723fdaacc18cefb78.png

Type the following commands in separate terminals on the TurtleBot Raspberry Pi to launch LiDAR and camera sensors in TurtleBot 3:

roslaunch turtlebot3_bringup turtlebot3_core.launch

roslaunch turtlebot3_bringup turtlebot3_lidar.launch

roslaunch turtlebot3_bringup turtlebot3_rpicamera.launch

A possible output is shown below.

8ddd45e55271206aa0667f169c1c3c21.png

Set Up Existing TurtleBot Hardware

If you have a TurtleBot with a different setup from the setup previously described, before trying to communicate through MATLAB make sure that the following information is true:

You have set up your network so that you can ping the host machine.

You have access to the following topics. On the TurtleBot Raspberry Pi, type rostopic list to see the topics.

/odom

/cmd_vel

/reset

/scan

Host Computer Setup

On the network, find the IP address of your host computer. On a Windows® machine, at the command prompt, type ipconfig. On a Mac or Linux® machine, open a terminal and type ifconfig. Here is an example of ipconfig:

fb329dd2ce1e1bfac9baca08be23d000.png

Make sure that you can ping the notebook:

ping IP_OF_TURTLEBOT

A successful ping is shown first, followed by an unsuccessful ping.

81f7e1a8c803faa0356500fae790d40b.png

Next Steps

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值