Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Artificial Vision and Language Processing for Robotics

You're reading from   Artificial Vision and Language Processing for Robotics Create end-to-end systems that can power robots with artificial vision and deep learning techniques

Arrow left icon
Product type Paperback
Published in Apr 2019
Publisher Packt
ISBN-13 9781838552268
Length 356 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
 Morena Alberola Morena Alberola
Author Profile Icon Morena Alberola
Morena Alberola
 Molina Gallego Molina Gallego
Author Profile Icon Molina Gallego
Molina Gallego
 Garay Maestre Garay Maestre
Author Profile Icon Garay Maestre
Garay Maestre
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

About the Book 1. Fundamentals of Robotics FREE CHAPTER 2. Introduction to Computer Vision 3. Fundamentals of Natural Language Processing 4. Neural Networks with NLP 5. Convolutional Neural Networks for Computer Vision 6. Robot Operating System (ROS) 7. Build a Text-Based Dialogue System (Chatbot) 8. Object Recognition to Guide a Robot Using CNNs 9. Computer Vision for Robotics 1. Appendix

Chapter 1: Fundamentals of Robotics

Activity 1: Robot Positioning Using Odometry with Python

Solution

from math import pi

def wheel_distance(diameter, encoder, encoder_time, wheel, movement_time):

time = movement_time / encoder_time

wheel_encoder = wheel * time

wheel_distance = (wheel_encoder * diameter * pi) / encoder

return wheel_distance

from math import cos,sin

def final_position(initial_pos,wheel_axis,angle):

final_x=initial_pos[0]+(wheel_axis*cos(angle))

final_y=initial_pos[1]+(wheel_axis*sin(angle))

final_angle=initial_pos[2]+angle

return(final_x,final_y,final_angle)

def position(diameter,base,encoder,encoder_time,left,right,initial_pos,movement_time):

#First step: Wheels completed distance

left_wheel=wheel_distance(diameter,encoder,encoder_time,left,movement_time)

right_wheel=wheel_distance(diameter,encoder,encoder_time,right,movement_time)

#Second step: Wheel's central axis completed distance

wheel_axis=(left_wheel+right_wheel)/2

#Third step: Robot's rotation angle

angle=(right_wheel-left_wheel)/base

#Final step: Final position calculus

final_pos=final_position(initial_pos,wheel_axis,angle)

returnfinal_pos

position(10,80,76,5,600,900,(0,0,0),5)

Note:

For further observations, you can change the wheels' diameter to 15 cm and check the difference in the output. Similarly, you can change other input values and check the difference in the output.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images