ROB521_Lab1
pdf
keyboard_arrow_up
School
University of Toronto *
*We aren’t endorsed by this school
Course
521
Subject
Mechanical Engineering
Date
Jan 9, 2024
Type
Pages
23
Uploaded by BailiffAnt4099
LABORATORY I
Meet Your TurtleBot 3 Waffle Pi
(Sensor & Actuator Programming)
ROB521: Mobile Robotics and Perception
Winter 2023
1
Introduction
Welcome to ROB521—Mobile Robotics and Perception! This course will encompass a
total of four labs and a design project, all of which are to be completed within a week
of the scheduled practicum periods.
Each of the four labs will grow in complexity
and are intended to demonstrate important robotic concepts presented during the
lectures.
It is imperative that you properly understand the concepts and methods
studied in the lab as they will provide the basis of all future labs.
We will specify tasks you need to do in the Assignment section of the lab handout.
For all labs, assignments will have two components, simulation and experiments.
Simulation tasks can be finished entirely in simulator (without accessing a real robot).
These tasks are set up so that you could finish most, if not all, of the implementation
before your in-person lab session.
The experiment tasks are to be finished during
lab sessions, verifying your simulation results on a real robot.
It is quite difficult
to complete all of the work during the lab times, even assuming good programming
experience in the team.
Therefore, we strongly recommend that you complete the
simulation tasks before your lab time slot.
2
Objective
The objective of this laboratory exercise would be to familiarize you with the equip-
ment and software that will be used for all labs in ROB521. In particular, you are:
•
To set up ROS environment for running simulation
•
To learn about the robot’s hardware and its suite of sensors
•
To learn how to write ROS programs to command the robot in both simulation
and on a real robot, i.e.,
–
How to write a simple Python ROS node
–
How to acquire data from the sensors
–
How to drive the actuators
Possessing these capabilities will permit you to tackle the future labs.
2.1
Lab Deliverables
There are no deliverables for this lab. However, for future labs, look for a summary of
the deliverables and their mark distribution at the end of the document. If you have
to submit a lab report, include a short description of what your code is doing, and
what the robot does as a result of running the code. Provide context that will allow
the TA’s to understand what your robot is doing in order for them to properly gauge
your success. Importantly, state whether you were able to complete the deliverable.
2
If not, explain why you weren’t able to complete the task. Avoid writing more than
a paragraph for each deliverable.
Finally, include a copy of your code for the TA’s to look over.
The code itself
will not be marked, but it must be presented to demonstrate that each group has
independently written their solution. If the code does not look complete, TA’s will
have access to all of the computers, and will be able to run the code themselves to
confirm that the deliverables have been completed.
3
Equipment & Software
The TurtleBot 3 Waffle Pi is a ROS-based, fully programmable, mobile robot. It is the
most popular open-source robot with strong sensor lineups and modular actuators.
The TurtleBot platforms have been developed by and are available from Robotis Inc;
ROS is managed and maintained by Open Robotics. There are three official TurtleBot
3 models: the Burger, the Waffle, and the Waffle Pi. (Obviously, the designers worked
overtime going without lunch or dinner.) For this course, we will be using TurtleBot
3 Waffle Pi and we will also be using a simulated TurtleBot3 within Gazebo (a robot
simulation package).
3.1
TurtleBot 3 Waffle Pi
The TurtleBot 3 Waffle Pi model uses the Raspberry Pi as the single board computer.
It is equipped with an openCR board, a Raspberry Pi Camera and a 2 dimensional
(range and bearing) 360
o
Lidar unit in addition to an inertial motion unit (IMU), a
compass and a gyroscope (or gyro, for short).
The Waffle Pi software consists of firmware of OpenCR board and 4 ROS pack-
ages.
It uses OpenCR as a subcontroller to estimate position by calculating the
driving motor encoder value.
Acceleration and angular velocity are obtained from
the IMU and gyro that are mounted on the OpenCR board, from which position and
orientation (i.e., pose) can be estimated. The velocity of the driving motors can be
controlled by publishing the command in the upper-level software.
The 4 ROS packages are:
•
turtlebot3
•
turtlebot3
msgs
•
turtlebot3
simulations
•
turtlebot3
applications
For the in-person lab experiments, we will mainly rely on the
turtleBot3 package,
which contains remote control package and bring-up package.
3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
3.2
Hardware
3.2.1
Raspberry Pi 3B
A Raspberry Pi 3B (Figure 1) is used as the TurtleBot PC. It is mainly responsible
for collecting data from sensors such as the lidar, IMU, camera, and gyro. All the
sensor output would be published to the corresponding “topics” (see Introduction to
ROS). A more detailed description is presented in the next section. The Raspberry
Pi is also responsible for receiving the commands from a remote PC and command-
ing the corresponding actuators or sensors.
Figure 1: Raspberry Pi 3B+
3.2.2
Lidar Sensor
The Waffle Pi is equipped with a 2D 360
◦
lidar (light detection and ranging) sensor,
but perhaps better referred to as a 2D laser scanner (Figure 2). It is capable of sensing
the obstacles (including surfaces) around the robot in the plane of the sensor. The
scan rate is 300
±
10 rpm and the angular resolution is 1
◦
. The output of this sensor
is an array of length 360. (A visualization of lidar data is shown in Figure 3.)
Figure 2: Lidar sensor
4
Figure 3: the GUI of Lidar sensor
3.2.3
Dynamixel XM430
The Waffle Pi uses 2 Dynamixel actuators (Figure 4) to drive the wheels. The motors
can be operated by one of 6 operating modes, including
•
Velocity control
•
Torque control
•
Position control
Figure 4: Dynamixel motors
5
3.2.4
OpenCR 1.0
The OpenCR control board (Figure 5) acts as a sub-controller for Waffle Pi, which
can command the robot’s Dynamixel motors and various sensors. It has an IMU and
a gyro that can be used in various applications.
Figure 5: OpenCR 1.0 embedded board
3.3
Simulated TurtleBot 3 Waffle Pi in Gazebo
When developing autonomy software for robots, we often start with testing in a
simulator as opposed to a real robot. In this course, we will use Gazebo to simulate
our TurtleBot 3 Waffle Pi. Gazebo simulates robot dynamics (i.e. how robot move
given a certain control input) based on a prior robot model.
It also simulates the
onboard sensors mentioned in Section 3.2 based on sensor models. Essentially, the
Gazebo provides a relatively good approximation of what a real robot would move
and perceive.
In terms of software structure, Gazebo completely replaces the real
robot. We should be able to run the same code with both the simulator and the real
robot.
4
Development Environment
In this section, we will introduce the development environments for running simulation
and working with a real robot.
For in-person lab experiments, you will use one of the desktop PCs in MY570 as
a Remote PC, which interfaces with the Raspberry Pi, the TurtleBot PC (Raspberry
Pi). Remote PC usually performs resource consuming tasks such as data processing
and high-level planning for localization and navigation.
In contrast, the onboard
6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
TurtleBot PC controls the robot components and collects sensor readings that require
communication. Both PCs have similar development environments, since they both
run on the base operating system Linux(Ubuntu 20.04) and ROS (Noetic Ninjemys);
however, they use different ROS packages for their jobs.
For simulations, you only need one PC for all the aforementioned tasks. In par-
ticular, Gazebo will be responsible for the TurtleBot PC’s jobs, controlling robot
components and collecting sensor readings. To enable smooth transition from simu-
lation to experiments, we will use ROS Noetic Ninjemys in Ubuntu 20.04.
In the following sections, we will help you set up development environments for
both simulation and experiments. Note that you only need to set up the simulation
environments before lab.
4.1
Setting up Simulation Environment
As mentioned before, we will run simulations on Ubuntu 20.04 with ROS Noetic
Ninjemys. In this course, we provide two options for accessing Ubunutu 20.04, UofT
computers via virtual access or installing Ubuntu on your own laptop. We will share
more information soon on Quercus. Please proceed once you have access to a Ubuntu
20.04 PC.
If you choose to use UofT computers, you only need to install the TurtleBot3
Gazebo Simulation Package under your catkin workspace by cloning it from github
(Step 3 in Section 4.1.2).
4.1.1
Installing ROS Noetic
Setup your computer to accept software from packages.ros.org.
$ sudo sh -c
'echo "deb http://packages.ros.org/ros/ubuntu \
$(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
$ sudo apt install curl
# if you haven't already installed curl\\
$ curl -s
\
https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc |
sudo apt-key add -
Make sure your Debian package index is up-to-date:
$ sudo apt update
Install Noetic Desktop Full (we need the Gazebo packages that come with this version)
7
$ sudo apt install ros-noetic-desktop-full
You must source this script in every bash terminal you use ROS in.
$
source
/opt/ros/noetic/setup.bash
You could also add this line to the
∼
/.bashrc file.
$
echo
'source /opt/ros/noetic/setup.bash'
>> ~/.bashrc
4.1.2
Install TurtleBot3 ROS Packages
Install Dependent ROS Packages for TurtleBot
$ sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy
\
ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc
\
ros-noetic-rgbd-launch ros-noetic-rosserial-arduino
\
ros-noetic-rosserial-python ros-noetic-rosserial-client
\
ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server
\
ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro
\
ros-noetic-compressed-image-transport ros-noetic-rqt*
\
ros-noetic-rviz ros-noetic-gmapping
\
ros-noetic-navigation ros-noetic-interactive-markers
Install TurtleBot3 Packages
$ sudo apt install ros-noetic-dynamixel-sdk
$ sudo apt install ros-noetic-turtlebot3-msgs
$ sudo apt install ros-noetic-turtlebot3
Install TurtleBot3 Gazebo Simulation Package under your catkin workspace
$
cd
~/catkin_ws/src/
$ git clone -b noetic-devel
\
https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$
cd
~/catkin_ws
&&
catkin_make
Don’t forget to source the setup bash from your catkin workspace
$
source
devel/setup.bash
You also need to setup the environment variable to identify the TurtleBot 3 model
we are using
8
$
echo
'export TURTLEBOT3_MODEL=waffle_pi'
>> ~/.bashrc
4.2
Setting up Experiment Environment
ROS environment and packages have been set up for you on lab stations and Rasp-
berry Pi. To start your in-person lab experiments, you only need configure the net-
work environment on both Remote PC and TurtleBot PC so that they can commu-
nicate with each other.
As a first step, we need to log into the TurtleBot PC. We will be doing it remotely
using ssh.
Open a terminal window on Remote PC. We recommend that you use
terminator
, which is installed on the computers. Within
terminator
, right-click and
choose “split horizontally” or “split vertically” to open additional terminals within the
window. A static IP address has been set up for each TurtleBot PC and will be given
to you at the beginning of the lab session. Make sure your TurtleBot PC is powered
on, and in one of the open terminals, run the following command to remote-access its
terminal via ssh:
$ ssh ubuntu@
\{
The static IP address of Pi
\}
$ ssh ubuntu@192.168.0.101
# for example
Now enter the password for your TurtleBot PC, which is ’turtlebot’. You will now
see your usual command line replaced with
ubuntu@raspberrypi:
∼
$
. It means that
you are now logged in and working on a terminal from your Raspberry Pi. As long
as this terminal window stays opened, the ssh connection will continue to exist.
You also need to know the IP address of the Remote PC. Open a terminal window
on the Remote PC and use ‘ifconfig’ command to get the IP address of the remote
PC (e.g. 192.168.7.100):
$ ifconfig
Now, we are ready to set the network environment variables on both the Remote
PC and TurtleBot PC. On both PCs, open the
/.bashrc
script on the terminal
window.
$ nano ~/.bashrc
Scroll to the bottom of the file to set up the ROS network variables. Note that on the
Remote PC, you will find the
ROS_MASTER_URI
have been configured for you with a
unique IP address and
ROS_PORT
.
9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
# Remote PC ~/.bashrc
export
ROS_HOSTNAME
={
remote_PC IP
}
export
ROS_MASTER_URI
={
remote_PC IP
}
:
{
remote_PC ROS_PORT
}
Please
DO NOT
change the
ROS_HOSTNAME
and
ROS_PORT
.
They are set up so
that multiple remote access groups can run simulations at the same time.
Configure the Turtlebot PC
~/.bashrc
file to share the same
ROS_MASTER_URI
as
the Remote PC and declare its
ROS_HOSTNAME
# TurtleBot PC ~/.bashrc
export
ROS_HOSTNAME
={
TurtleBot IP
}
export
ROS_MASTER_URI
={
remote_PC IP
}
:
{
remote_PC ROS_PORT
}
Figure 6: network configuration for Remote PC and TurtleBot PC
10
The above commands are summarized in Figure 6. After modifying the ROS net-
work variables , source the
/.bashrc file for the changes to take effect:
$
source
∼
/.bashrc
Note that the computer and robot may already be correctly configured prior to
your lab session. Nevertheless, it’s good to check and make sure that the computer’s
IP hasn’t changed.
5
Getting Started
In this section, you will first validate the development setup in the previous section by
teleoperating the TurtleBot 3. Then, you will check the TurtleBot 3 ROS topics that
of our interests. You will be finishing this section with a simple ROS node example
to get you started on the assignment of this lab.
5.1
Testing Simulation Setup: Remote Control of Robot
Open a new terminal window and use the following command to run the roscore
program at port
ROS_PORT
which is defined in the
~/.bashrc
file
$ roscore --port
$ROS_PORT
Please make sure to include the port number
; otherwise, other groups use the
same station with you at the same time can not run simulations.
Open a new terminal window and start a Gazebo simulation with
$ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
which runs a launch file the
turtlebot3
gazebo ROS package.
In another terminal window, run the launch file
turtlebot3
teleop
key.launch
by
issuing the following command:
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
Note that you could tab to auto-complete ROS packages names and file names. Make
sure you correctly source the setup bash files before running this test.
After you launched the teleoperation file, You should see the following message
appears in the terminal (Figure 7).
11
Figure 7:
turtlebot3
teleop package message.
This node will retrieve the key inputs of ‘w’, ‘a’, ‘d’, ‘x’ and control the linear and
angular velocity of the robot in
m/sec
and
rad/sec
respectively.
Once you have confirmed that you can control your simulated TurtleBot using
keyboard, press Ctrl-C to terminate the teleop node.
Leave roscore running and
the
turtlebot3
empty
world.launch
launch file running by keeping their
terminal windows open
.
They are the essential programs for us to control and
communicate with the simulated robot in Gazebo.
5.2
Testing Experiment Setup: Remote Control of Robot
Recall that for experiments, we have two PCs, the Remote PC (lab stations) running
high-level planning and data processing and the TurtleBot PC on TurtleBot 3 Waffle
Pi.
On the remote PC, open a new terminal window and use the following command to
run the roscore program:
$ roscore --port
$ROS_PORT
Again, please make sure to include the port number
.
On TurtleBot PC, run the launch file
turtlebot3
robot.launch from the
turtlebot3
bringup
package in a new terminal window.
$ roslaunch turtlebot3_bringup turtlebot3_robot.launch --screen
This will start the communication between TurtleBot PC and the sensors and actu-
ators. In a new terminal window on the Remote PC, run the launch file
turtlebot3_teleop_key.launch
by issuing the following command:
12
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
The same print out will show up on the Remote PC (Figure. 7). Once you have veri-
fied that you can remote control your TurtleBot using keyboard, press Ctrl-C to termi-
nate the teleop node.
Leave roscore running and the
turtlebot3
robot.launch
launch file running by keeping their terminal windows open
.
Note the differences between running simulations and experiments.
The core
control node (the teleop node in this case) is the same. We use different packages for
the robot.
5.3
TurtleBot 3 Topics
This section is intended to be done during the lab session on a real robot. However,
you could also check the topics in simulation.
You will find a few topics that are
published and subscribed by nodes on the TurtleBot PC are now done by the Gazebo
simulator.
After we launched the
turtlebot3
robot.launch file from the
turtlebot3
bringup
package, messages will be published from each node, such as sensors and actuators,
to their corresponding
topics
.
Make sure that the roscore and
turtlebot3
bringup
package are running, ver-
ify the various topics that are being published or subscribed using the command
$
rostopic list . After typing this command in terminal, you should see the following
topics being listed:
/cmd
vel
/cmd
vel
rc100
/diagnostics
/imu
/joint
states
/odom
/rosout
/rosout
agg
/rpms
/scan
/sensor
state
/tf
13
5.3.1
Subscribed Topics
Table 1 is a list of subscribed topics of the robot. The TurtleBot PC receives and
processes the messages from the topics that are published by the user.
Topic Name
Message Type
Description
cmd
vel
geometry
msgs/Twist
Control the translational and rotational
speed of the robot.
unit in
m/s
,
rad/s
(actual robot control)
motor
power
std
msgs/Bool
Dynamixel Torque On/Off
reset
std
msgs/Empty
Reset Odometry and IMU Data
Table 1: Subscribed topics of TurtleBot
5.3.2
Published Topics
Table 2 is a list of the topics that are published by the TurtleBot PC. You do not
need to know all the published topics, but it would be important to know some of
them such as ‘odom’, ‘imu’, and ‘scan’. User can subscribe to those topics to retrieve
the information published by the robot.
Topic Name
Message Type
Description
sensor
state
turtlebot
node
/Turtle-
botSensorState
Topic that contains the value
joint
states
sensor
msgs/JointState
Checks the position (m), velocity (m/s)
and effort (N
·
m) when the wheels are con-
sidered as joints.
battery
state
sensor
msgs/BatteryState
Contains battery voltage and status
scan
sensor
msgs/LaserScan
Topic that confirms the scan values of the
LiDAR mounted on the TurtleBot3
imu
sensor
msgs/Imu
Topic that includes the attitude of the
robot based on the acceleration and gyro
sensor.
odom
nav
msgs/Odometry
Contains the TurtleBot3’s odometry infor-
mation based on the encoder and IMU.
Table 2: Published topics of TurtleBot
To get more details on nodes and topics, run ‘
$
rqt
graph in terminal to check
the publishing and subscribing activities of each node on TutrleBot PC. A picture as
in Figure 8 should pop-up in your window:
14
Figure 8: TurtleBot nodes and topics
5.4
A Simple Publisher Node
Example
Let’s first examine a simple example shown below.
This example initialize a ROS
node called ‘talker’ and then publish messages to the topic ‘chatter’.
15
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
#!/usr/bin/env python3
import rospy
from std
msgs.msg import String
def talker():
rospy.init
node(’talker’, anonymous=True)
pub = rospy.Publisher(’chatter’, String, queue
size=10)
rate = rospy.Rate(10) #10Hz
while not rospy.is
shutdown():
hello
str = ”hello world”
msg = String()
msg.data = hello
str
rospy.loginfo(msg.data)
pub.publish(msg)
rate.sleep()
if
name
== ´
main
´
:
try:
talker()
except rospy.ROSInterruptException:
pass
Adding Path to Python Interpreter:
To make sure that your script is executed
as a Python 3 script, you need the line
#!/usr/bin/env python3
to be declared at the top for every python ROS node.
Importing dependent message types and libraries
You need to import rospy
to write a ROS node. Hence
import rospy
from std
msgs.msg import String
The
std
msgs.msg
import is for us to use the
std
msgs/String
message type for
publishing.
Initializing the ROS node:
In the main talker function, we find
which declares a ROS node under the name ’talker’.
In ROS, nodes are uniquely
named.
The
anonymous=True
flag allows rospy to choose a unique name for the
”talker” node such that multiple ”talker” can run at the same time.
16
rospy.init
node(’talker’, anonymous=True)
Declaring a publisher:
Next, we declare a topic publisher
pub = rospy.Publisher(’chatter’, String, queue
size=10)
which means our ’talker’ node will publish to the ’chatter’ topic using the message
type String, which is we have imported at the top of the script from
std
msgs.msg .
Laying out the main loop:
A typical rospy main loop looks like follows
rate = rospy.Rate(10) #10Hz
while not rospy.is
shutdown():
# Do Some Work
rate.sleep()
The first line initializes a Rate object set at 10Hz. It is called inside loop so that the
while loop is running at 10Hz. It is also a good practice to check for
rospy.is
shutdown()
in the main loop so that the node could be properly shut down when you quit the
program.
Initializing and publishing messages:
Inside the main loop, we have at the be-
ginning
hello
str = ”hello world”
msg = String()
msg.data = hello
str
where we initialize an empty message (second line) and populate it with the informa-
tion we want to publish (third line). In this case, the message type is String. In the
std
msgs/String.msg file, you will find its definition which has only one field, ”data”
of string type.
After the message is created, we can finally publish it with
pub.publish(msg)
Note that there’s another line in the example
rospy.loginfo(msg.data) .
It will do
three things: print to the terminal window, write to the Node’s log file and write to
/rosout.
17
#!/usr/bin/env python3
import rospy
from std
msgs.msg import String
def callback(data):
rospy.loginfo(rospy.get
caller
id() + ”I heard %s”, data.data)
def listener():
rospy.init
node(’listener’, anonymous=True)
rospy.Subscriber(”chatter”, String, callback)
rospy.spin() # simply keeps python from exiting until this node is stopped
if
name
== ´
main
´
:
listener()
5.5
A Simple Subscriber Node
Example
The following example initializes a ROS node ‘listener’ and then subscribe
from the topic ‘chatter’.
The code for subscriber node is similar to the publisher node. However, subscriber
uses a new callback mechanism for subscribing to topics.
Declaring a subscriber:
In the main function, after initializing the ros node, we
have
rospy.Subscriber(”chatter”, String, callback)
which means the node has subscribed to the ‘chatter’ topic of the type
std
msgs.msgs.String .
When a new message is received, the given callback function,
callback() in our case,
is triggered with the message as the default first argument.
Defining the callback function:
The callback function is where you process the incoming messages
def callback(data):
rospy.loginfo(rospy.get
caller
id() + ”I heard %s”, data.data)
18
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
6
Assignment
6.1
Simulation
6.1.1
Task 1: publish to ‘cmd
vel’
Your task is to write a simple publisher node to control the wheels. The goal is to
command the wheel to go forward 1 m, rotate 360
◦
, and then stop.
First, navigate to the directory
~/catkin
\_
ws/src/rob521
\_
labs/lab1/nodes
and open the file
l1
motor.py . The code skeleton is provided to you, which is similar
to the example above, but you need to complete the functions and then test the code
on the robot.
The topic you need to publish to is
cmd
vel , and the message type is
geometry
msgs.msg.twist .
The message definition is as follows:
Vector3 linear
float64 x
float64 y
float64 z
Vector3 angular
float64 x
float64 y
float64 z
First thing you need to do is to import rospy and relevant message types.
import rospy
from geometry
msgs.msg import Twist
Then, initialize the publisher:
cmd
pub = rospy.Publisher(’cmd
vel’, Twist, queue
size=1)
Initialize the message and define the linear and angular velocity as the following.
twist=Twist()
twist.linear.x=0.1
twist.angular.z=0.1
cmd
pub.publish(twist)
Now you can publish the message to the topic ‘cmd
vel’. The motors will subscribe
to the topic ‘cmd
vel’ and move according to the commands you send.
Write a simple program to command the robot to go forward for 1 meter, then
rotate clockwise for 360 degrees, and then stop. You can use rospy.loginfo() to print
out any useful debugging messages in realtime.
19
Let’s run the file and examine it.
Make sure that a
roscore
and the Gazebo
turtlebot3
empty
world package is up and running on your PC by typing the follow-
ing command in terminal:
$ roscore --port
$ROS_PORT
$ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
You can use rosrun
$ rosrun rob521_lab1 l1_motor.py
to run the python
script you just wrote. Note that
rob521
lab1 is the package name, and
l1
motor.py
is the file you just modified. If you wish to terminate the program while the motor is
still running, press ctrl+c to exit the node, and then run
$ rostopic pub -1 /cmd_vel geometry_msgs/Twist --
'[0, 0, 0]' '[0, 0,
0]'
which will stop the motor.
6.1.2
Task 2: subscribe from ‘odom’
Now, let’s write a simple node that subscribes to the odometry topic called ‘odom’.
The goal is to retrieve the current pose of the robot. The pose of the robot is defined
as [
x, y, θ
].
The message type of ‘odom’ is
nav
msgs.msg.Odometry . It is defined as below
in the .msg file.
Header header
string child
frame
id
geometry
msgs/PoseWithCovariance pose
Pose pose
Point position
float64 x
float64 y
float64 z
Quaternion orientation
float64 x
float64 y
float64 z
float64 w
float64[36] covariance
geometry
msgs/TwistWithCovariance twist
You can verify the structure by typing an echo command
$
rostopic echo /odom
in the terminal to print out the odometry information. The output should look like
that in Figure 9.
20
Figure 9: Example odom output.
The command
from nav
msgs.msg import Odometry imports the message type
for odometry output. Then the following commands initialize the node and the sub-
scriber:
rospy.init
node(’odometry’)
odom
subscriber=rospy.Subscriber(’odom’,Odometry,callback,queue
size=1)
We can define a callback function and inside the function, retrieve the position
21
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
and orientation from the message.
def callback(odom
data):
point=odom
data.pose.pose.position
quart=odom
data.pose.pose.orientation
theta=get
yaw
from
quarternion(quart)
cur
pose = (point.x, point.y, theta)
rospy.loginfo(cur
pose)
Note that the orientation of the robot is expressed in quaternion, so you need to
transfer that to angle using the following formulas:
def get
yaw
from
quarternion(q):
siny
cosp = 2* (q.w*q.z + q.x*q.y)
cosy
cosp = 1 - 2*(q.y*q.y + q.z*q.z)
yaw = math.atan(siny
cosp/cosy
cosp)
return yaw
rospy.loginfo(cur
pose)
Once you have finished the file, run
$
rosrun rob521
lab1 l1
odometry.py on your
PC to verify the output. You can terminate the node by typing Ctrl+C.
6.1.3
Task 3:
Running subscriber node and publisher node simultane-
ously
Now you have written a simple subscriber node of odometry, and a simple publishing
node of motors, let’s try running them together.
Launch the subscriber node
l1
odometry.py first, and then launch the publisher
node
l1
motor.py . Examine the output of the odometry, does the output reflects the
current position of the robot? How accurate is it?
6.2
Lab Experiments
6.2.1
Task 4: Verify simulation results
Repeat Task 1 to 3 on a real TurtleBot 3. Instead of running gazebo, run the launch
file from the
bring_up
package to start communication,
$ roslaunch turtlebot3_bringup turtlebot3_robot.launch --screen
Remember to run your publisher and subcription node on the Remote PC.
Examine the output of the odometry, does the output reflects the current position
of the robot? How accurate is it compared to simulation?
22
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
7
Deliverable Summary
You do not need to submit anything for this lab.
8
Additional Resources
1. ROBOTIS e-Manual: http://emanual.robotis.com/docs/en/platform/turtlebot3/overview/
2. “SSH: Remote control your Raspberry Pi,” The MagPi Magazine https://www.raspberrypi.org/ma
remote-control-raspberry-pi/
3. Official ROS website - https://www.ros.org/
4. ROS Wiki - http://wiki.ros.org/ROS/Introduction
5. Useful tutorials to run through from ROS Wiki - http://wiki.ros.org/ROS/Tutorials
6. ROS Robot Programming Textbook, written by the TurtleBot3 developers -
http://www.pishrobot.com/wp-content/uploads/2018/02/ROS-robot-programming-
book-by-turtlebo3-developers-EN.pdf
23
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Related Questions
Problem 1: You are working in a consulting company that does a lot of hand calculations for designs in
Aerospace Industry for mechanical, thermal, and fluidic systems. You took the Virtual engineering
course, and you want to convince your boss and the team you work to move to modelling and simulation
in computers using a certain software (Ansys, Abaqus, etc). Discuss the benefits and pitfalls of computer
based models used within an industrial environment to solve problems in engineering.
arrow_forward
Table 1: Mechanical behavior of human cadaver tibial bones
during pure torsional loads applied with the proximal tibia
fixed and the torque applied to the distal tibia until there is
bone fracture.
Medial condyle
Tibial tuberosity-
Medial malleolus
-Lateral condyle
Head of fibula
Ti-6Al-4V grade 5
Stainless Steel 316L
Region of bone
resection
-Lateral malleolus
L = 365 mm
Annealed
Annealed
Torque at ultimate failure (bone fracture)
Displacement (twist angle) at ultimate failure
Torsional Stiffness
Table 2: Mechanical properties of candidate materials for the rod.
Material
Process
Yield Strength
(MPa)
880
220-270
Do = 23 mm
Elastic
Modulus (GPa)
115
190
d₁ = 14 mm
Figure 1: Representative tibia bone showing the resection region (blue arrows) and median length (L). A circular cross section of distal tibia
taken at the level of resection) showing the median inner (di) and outer (Do) diameters of the cortical bone. A tibia bone after resection with the
proposed metal solid rod (black line)…
arrow_forward
Please do not copy other's work and do not use ChatGPT or Gpt4,i will be very very very appreciate!!!
Thanks a lot!!!!!
arrow_forward
S.2
Statics of Rigid Bodies
Note: If you have already answered the problems in this post, kindly ignore it. If not, then answer it. Thank you, Tutor!
Content Covered:
- Method of Sections
Direction: Create two problems based on the topic "Method of Sections" and then solve them with a complete solution. In return, I will give you a good rating. Thank you so much!
Note: Please bear in mind to create two problems based on the topic "Method of Sections." Be careful with the calculations in the problem. Kindly double check the solution and answer if there is a deficiency. And also, box the final answer. Thank you so much!
arrow_forward
Statics of Rigid Bodies (S5)
Note: I will report you if you answer this post multiple times so please follow it.Thank you for understanding, Tutor!
Content Covered:
- Friction
Direction: Solve the problem below by giving the complete solution. In return, I will give you a good and high rating. Thank you so much!
Note: Be careful with the calculations in the problem. Kindly double check the solution and answer if there is a deficiency. And also, box the final answer. Thank you so much!
arrow_forward
You are assigned as the head of the engineering team to work on selecting the right-sized blower that will go on your new line of hybrid vehicles.The fan circulates the warm air on the inside of the windshield to stop condensation of water vapor and allow for maximum visibility during wintertime (see images). You have been provided with some info. and are asked to pick from the bottom table, the right model number(s) that will satisfy the requirement. Your car is equipped with a fan blower setting that allow you to choose between speeds 0, 1,2 and 3. Variation of the convection heat transfer coefficient is dependent upon multiple factors, including the size and the blower configuration.You can only use the following parameters:
arrow_forward
Statics Problem !!!
Help me Part A , Part B , Part C!!!! Answer it this Problem Correctly!! Please give correct Solution
arrow_forward
What is the purpose of machine learning?
O a.
To replace scientists by thinking machines
D. To enable the recognition of patterns in complex data
O c.
To make an artificially intelligent clone of a brain
d.
To figure out how to use a machine
Clear my choice
arrow_forward
Problem 3: A small gearing system in your brand-new 3D printer fails as you were printing,
leading to an overload in the motor and a fire in your home. The fire spreads, burning half of
Everglades National Park in the worst environmental disaster in US history.
The printer company blames you! Stating that you must have been misusing the printer some-
how. Use your engineering knowledge to "show those jerks you mean business!"
You investigate and find a serial number on the gears and type it into Google, finding the
company that manufactures the gears. Their website provides some info that this series of gear is
made from AISI 4340 steel and the yield strength is 125 kpsi.
Assuming each gear tooth acts as a small cantilever, prove to the 3D printer company that they
are liable for the fire.
oct
#
Gear Information
Gear radius (r): 1.00 in
Tooth length (1): 0.15 in
Tooth height (h): 0.15 in
Tooth thickness (b): 0.1 in
Angular velocity (w): 0.1 rad/s
Motor Information
Power (H): 0.009 hp
1…
arrow_forward
You have been asked by your supervisors at A&L Engineering to design a roller coaster for a new theme park. Because this design is in the initial stages, you have been asked to create a track for the ride. Your coaster should have at least two peaks and two valleys, and launch from an initial height of 75 meters. Each peak and valley should represent a vertical change of at least 20 meters. In your design, you should plan for a mass between 400 and 600 kilograms.
Once you have designed the track, you have been asked to calculate the kinetic energy, potential energy, momentum, and work done by the cart at various points throughout the track. Unless otherwise stated, you can ignore the effects of friction. Following your calculations, you have been asked to describe the energy transfers detailed by these equations.
Directions
To complete this roller coaster design report, complete the following:
Create a diagram of a roller coaster track containing at least two peaks and two…
arrow_forward
Study Area
Document Sharing
User Settings
Access Pearson
mylabmastering.pearson.com
P Pearson MyLab and Mastering
The crash cushion for a highway barrier consists of a
nest of barrels filled with an impact-absorbing material.
The barrier stopping force is measured versus the vehicle
penetration into the barrier. (Figure 1)
Part A
P Course Home
b My Questions | bartleby
Review
Determine the distance a car having a weight of 4000 lb will penetrate the barrier if it is originally traveling at 55 ft/s when it
strikes the first barrel.
Express your answer to three significant figures and include the appropriate units.
Figure
1 of 1
36
μΑ
S =
Value
Units
Submit
Request Answer
Provide Feedback
?
Next >
arrow_forward
I want to briefly summarize what he is talking about and what you conclude.
pls very urgent
arrow_forward
solve this please on ANSYS and give me screenshots how you did it, please
arrow_forward
Part 2
Set up a spreadsheet solution to this problem. This will require that you derive one
formula to express the relationship between the friction coefficient, the spring constant,
and the spring compression; and a second formula to find the cost of using different slide
and spring types. Set up your spreadsheet as shown below. You can fill in the
"Acceptable?" column manually, rather than using a formula. Turn in a copy of your
spreadsheet/Matlab work
(solve for $)
Friction Spring Constant Spring Compression
M
k
0.1
0.1
0.1
0.2
0.2
0.2
50
100
150
50
100
150
4
Part 3
Your boss has decided to look at a second option. The spring mechanism will be
replaced by a drop box. After leaving the slide, the blocks will travel 5 horizontal feet
through the air and pass through a hole into the drop box. Using the slide you selected
above, determine how far below the slide (h) to place the hole in the drop box.
Yo = 5.2017/5
BLADE
2
RAMPE SLIDE
8⁰
SLIDE
Acceptable?
(Yes or No)
$'
Cost
51
In
DROP…
arrow_forward
Solve correctly
arrow_forward
pls help me my head hurts
arrow_forward
Part C
arrow_forward
I want to answer all the questions by handwriting.
arrow_forward
You are an engineer in a company that manufactures and designs several mechanical devices, and your manager asked you to help your customers. In this time, you have two customers, one of them wants to ask about internal combustion engines while the other requires a heat exchanger with particular specifications. Follow the parts in the following tasks to do your job and support your customers.Task 1:Your first customer asked for an internal combustion engine to use it in a designed car. Your role is to describe the operation sequence of different types of available engines, explain their mechanical efficiency, and deliver a detailed technical report which includes the following steps:STEP 1Describe with the aid of diagrams the operational sequence of four stroke spark ignition and four stroke compression ignition engines.STEP 2Explain and compare the mechanical efficiency of two and four-stroke engines.STEP 3Review the efficiency of ideal heat engines operating on the Otto and Diesel…
arrow_forward
Statics of Rigid Bodies (S6)
Note: I will report you if you answer this post multiple times so please follow it.Thank you for understanding, Tutor!
Content Covered:
- Friction
Direction: Solve the problem below by giving the complete solution. In return, I will give you a good and high rating. Thank you so much!
Note: Be careful with the calculations in the problem. Kindly double check the solution and answer if there is a deficiency. And also, box the final answer. Thank you so much!
arrow_forward
The University of Oklahoma School of Civil Engineering and Environmental Science
spring 2024 Semester
Problem 3 (30 pts.)
ENGR 2411 Applied Engineering Statics
Prerequisite Quiz
Page 4 of a
Your friend Dave loves hanging on the OU banner poles attached to the light poles on campus,
this is despite your strong disapproval of their behavior. As an engineering student you are super
concerned about the moment acting at the base of the light pole. What if Dave breaks the light
pole! Calculate the moment acting about the base of the light pole (point O) when Dave is angled
45° from the horizontal banner pole. Dave weighs 120 lbs. Assume the force exerted by Dave on
the banner pole is aligned with their arm that is holding onto the pole (ie. at 45°).
B 15ft
tf8
Disclaimer: Dave is fictional and does
not represent any actual person.
arrow_forward
You are spending the summer as an assistant learning how to navigate on a large ship carrying freight across Lake Erie. One day, you and your ship are to travel across the lake a distance of 200 km traveling due north from yourorigin port to your destination port. Just as you leave your origin port, the navigation electronics go down. The captain continues sailing, claiming he can depend on his years of experience on the water as a guide. The engineers work on the navigation system while the ship continues to sail,and winds and waves push it off course. Eventually, enough of the navigation system comes back up to tell you your location. The system tells you that your current position is 50.0 km north of the origin port and 25.0 km east of the port. The captain is a little embarrassed that his ship is sofar off course and barks an order to you to tell him immediately what heading he should set from your current position to the destination port. Give him an appropriate heading angle.
arrow_forward
FINALS ASSIGNMENT IN ME 3215
COMBUSTION ENGINEERING
PROBLEM 1:
A Diesel engine overcome a friction of 200 HP and delivers 1000 BHP. Air consumption is 90 kg per minute.
The Air/fuel ratio is 15 to 1. Find the following:
1. Indicated horsepower
2. The Mechanical efficiency
3. The Brake Specific Fuel Consumption
PROBLEM 2:
The brake thermal efficiency of a diesel engine is 30 percent. If the air to fuel ratio by weight is 20 and the
calorific value of the fuel used is 41800 kJ/kg, what brake mean effective pressure may be expected at
S.P. conditions (Standard Temperature and pressure means 15.6°C and 101.325 kPa, respectively)?
arrow_forward
Create a reading outline for the given text "STRESS and STRAIN".
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education

Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY

Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning

Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY
Related Questions
- Problem 1: You are working in a consulting company that does a lot of hand calculations for designs in Aerospace Industry for mechanical, thermal, and fluidic systems. You took the Virtual engineering course, and you want to convince your boss and the team you work to move to modelling and simulation in computers using a certain software (Ansys, Abaqus, etc). Discuss the benefits and pitfalls of computer based models used within an industrial environment to solve problems in engineering.arrow_forwardTable 1: Mechanical behavior of human cadaver tibial bones during pure torsional loads applied with the proximal tibia fixed and the torque applied to the distal tibia until there is bone fracture. Medial condyle Tibial tuberosity- Medial malleolus -Lateral condyle Head of fibula Ti-6Al-4V grade 5 Stainless Steel 316L Region of bone resection -Lateral malleolus L = 365 mm Annealed Annealed Torque at ultimate failure (bone fracture) Displacement (twist angle) at ultimate failure Torsional Stiffness Table 2: Mechanical properties of candidate materials for the rod. Material Process Yield Strength (MPa) 880 220-270 Do = 23 mm Elastic Modulus (GPa) 115 190 d₁ = 14 mm Figure 1: Representative tibia bone showing the resection region (blue arrows) and median length (L). A circular cross section of distal tibia taken at the level of resection) showing the median inner (di) and outer (Do) diameters of the cortical bone. A tibia bone after resection with the proposed metal solid rod (black line)…arrow_forwardPlease do not copy other's work and do not use ChatGPT or Gpt4,i will be very very very appreciate!!! Thanks a lot!!!!!arrow_forward
- S.2 Statics of Rigid Bodies Note: If you have already answered the problems in this post, kindly ignore it. If not, then answer it. Thank you, Tutor! Content Covered: - Method of Sections Direction: Create two problems based on the topic "Method of Sections" and then solve them with a complete solution. In return, I will give you a good rating. Thank you so much! Note: Please bear in mind to create two problems based on the topic "Method of Sections." Be careful with the calculations in the problem. Kindly double check the solution and answer if there is a deficiency. And also, box the final answer. Thank you so much!arrow_forwardStatics of Rigid Bodies (S5) Note: I will report you if you answer this post multiple times so please follow it.Thank you for understanding, Tutor! Content Covered: - Friction Direction: Solve the problem below by giving the complete solution. In return, I will give you a good and high rating. Thank you so much! Note: Be careful with the calculations in the problem. Kindly double check the solution and answer if there is a deficiency. And also, box the final answer. Thank you so much!arrow_forwardYou are assigned as the head of the engineering team to work on selecting the right-sized blower that will go on your new line of hybrid vehicles.The fan circulates the warm air on the inside of the windshield to stop condensation of water vapor and allow for maximum visibility during wintertime (see images). You have been provided with some info. and are asked to pick from the bottom table, the right model number(s) that will satisfy the requirement. Your car is equipped with a fan blower setting that allow you to choose between speeds 0, 1,2 and 3. Variation of the convection heat transfer coefficient is dependent upon multiple factors, including the size and the blower configuration.You can only use the following parameters:arrow_forward
- Statics Problem !!! Help me Part A , Part B , Part C!!!! Answer it this Problem Correctly!! Please give correct Solutionarrow_forwardWhat is the purpose of machine learning? O a. To replace scientists by thinking machines D. To enable the recognition of patterns in complex data O c. To make an artificially intelligent clone of a brain d. To figure out how to use a machine Clear my choicearrow_forwardProblem 3: A small gearing system in your brand-new 3D printer fails as you were printing, leading to an overload in the motor and a fire in your home. The fire spreads, burning half of Everglades National Park in the worst environmental disaster in US history. The printer company blames you! Stating that you must have been misusing the printer some- how. Use your engineering knowledge to "show those jerks you mean business!" You investigate and find a serial number on the gears and type it into Google, finding the company that manufactures the gears. Their website provides some info that this series of gear is made from AISI 4340 steel and the yield strength is 125 kpsi. Assuming each gear tooth acts as a small cantilever, prove to the 3D printer company that they are liable for the fire. oct # Gear Information Gear radius (r): 1.00 in Tooth length (1): 0.15 in Tooth height (h): 0.15 in Tooth thickness (b): 0.1 in Angular velocity (w): 0.1 rad/s Motor Information Power (H): 0.009 hp 1…arrow_forward
- You have been asked by your supervisors at A&L Engineering to design a roller coaster for a new theme park. Because this design is in the initial stages, you have been asked to create a track for the ride. Your coaster should have at least two peaks and two valleys, and launch from an initial height of 75 meters. Each peak and valley should represent a vertical change of at least 20 meters. In your design, you should plan for a mass between 400 and 600 kilograms. Once you have designed the track, you have been asked to calculate the kinetic energy, potential energy, momentum, and work done by the cart at various points throughout the track. Unless otherwise stated, you can ignore the effects of friction. Following your calculations, you have been asked to describe the energy transfers detailed by these equations. Directions To complete this roller coaster design report, complete the following: Create a diagram of a roller coaster track containing at least two peaks and two…arrow_forwardStudy Area Document Sharing User Settings Access Pearson mylabmastering.pearson.com P Pearson MyLab and Mastering The crash cushion for a highway barrier consists of a nest of barrels filled with an impact-absorbing material. The barrier stopping force is measured versus the vehicle penetration into the barrier. (Figure 1) Part A P Course Home b My Questions | bartleby Review Determine the distance a car having a weight of 4000 lb will penetrate the barrier if it is originally traveling at 55 ft/s when it strikes the first barrel. Express your answer to three significant figures and include the appropriate units. Figure 1 of 1 36 μΑ S = Value Units Submit Request Answer Provide Feedback ? Next >arrow_forwardI want to briefly summarize what he is talking about and what you conclude. pls very urgentarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY

Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education

Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY

Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning

Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY