Description
We live in an age where the most complex or repetitive tasks are automated. Smart robots have the potential to revolutionize how we perform all kinds of tasks with high accuracy and efficiency. With this second edition of Learn Robotics Programming, youll see how a combination of the Raspberry Pi and Python can be a great starting point for robot programming.The book starts by introducing you to the basic structure of a robot and shows you how to design, build, and program it. As you make your way through the book, youll add different outputs and sensors, learn robot building skills, and write code to add autonomous behavior using sensors and a camera. Youll also be able to upgrade your robot with Wi-Fi connectivity to control it using a smartphone. Finally, youll understand how you can apply the skills that youve learned to visualize, lay out, build, and code your future robot building projects.By the end of this book, youll have built an interesting robot that can perform basic artificial intelligence operations and be well versed in programming robots and creating complex robotics projects using what youve learned. Spis treści:Learn Robotics ProgrammingSecond EditionWhy subscribe?ContributorsAbout the authorAbout the reviewersPackt is searching for authors like youPrefaceWho this book is forWhat this book coversTo get the most out of this bookDownload the example code filesCode in ActionDownload the color imagesConventions usedGet in touchReviewsSection 1: The Basics Preparing for RoboticsChapter 1: Introduction to RoboticsWhat does robot mean?Exploring advanced and impressive robotsThe Mars roversDiscovering robots in the homeThe washing machineOther household robotsExploring robots in industryRobot armsWarehouse robotsCompetitive, educational, and hobby robotsSummaryAssessmentFurther readingChapter 2: Exploring Robot Building Blocks Code and ElectronicsTechnical requirementsLooking at whats inside a robotExploring types of robot componentsTypes of motorsOther types of actuatorsStatus indicators displays, lights, and soundsTypes of sensorsExploring controllers and I/OI/O pinsControllersChoosing a Raspberry PiPlanning components and code structurePlanning the physical robotSummaryExerciseFurther readingChapter 3: Exploring the Raspberry PiTechnical requirementsExploring the Raspberry Pis capabilitiesSpeed and powerConnectivity and networkingPicking the Raspberry Pi 3A+Choosing the connectionsPower pinsData busesGeneral IORaspberry Pi HATsWhat is Raspberry Pi OS?Preparing an SD card with Raspberry Pi OSSummaryAssessmentFurther readingChapter 4: Preparing a Headless Raspberry Pi for a RobotTechnical requirementsWhat is a headless system, and why is it useful in a robot?Setting up Wi-Fi on the Raspberry Pi and enabling SSHFinding your Pi on the networkSetting up Bonjour for Microsoft WindowsTesting the setupTroubleshootingUsing PuTTY or SSH to connect to your Raspberry PiConfiguring Raspberry Pi OSRenaming your PiSecuring your Pi (a little bit)Rebooting and reconnectingUpdating the software on your Raspberry PiShutting down your Raspberry PiSummaryAssessmentFurther readingChapter 5: Backing Up the Code with Git and SD Card CopiesTechnical requirementsUnderstanding how code can be broken or lostSD card data loss and corruptionChanges to the code or configurationStrategy 1 Keeping the code on a PC and uploading itStrategy 2 Using Git to go back in timeStrategy 3 Making SD card backupsWindowsMacLinuxSummaryAssessmentFurther readingSection 2: Building an Autonomous Robot Connecting Sensors and Motors to a Raspberry PiChapter 6: Building Robot Basics Wheels, Power, and WiringTechnical requirementsChoosing a robot chassis kitSizeWheel countWheels and motorsSimplicityCostConclusionChoosing a motor controller boardIntegration levelPin usageSizeSolderingPower inputConnectorsConclusionPowering the robotTest fitting the robotAssembling the baseAttaching the encoder wheelsFitting the motor bracketsFitting plastic motor bracketsFitting metal motor bracketsAdding the castor wheelPutting the wheels onBringing the wires upFitting the Raspberry PiAdding the batteriesSetting up the USB power bankMounting the AA battery holderThe completed robot baseConnecting the motors to the Raspberry PiWiring the Motor HAT inIndependent powerSummaryExercisesFurther readingChapter 7: Drive and Turn Moving Motors with PythonTechnical requirementsWriting code to test your motorsPreparing librariesTest finding the Motor HATTest demonstrating that the motors moveTroubleshootingUnderstanding how the code worksSteering a robotTypes of steeringSteerable wheelsFixed wheelsOther steering systemsSteering the robot we are buildingMaking a Robot object code for our experiments to talk to the robotWhy make this object?What do we put in the robot object?Writing a script to follow a predetermined pathSummaryExercisesFurther readingChapter 8: Programming Distance Sensors with PythonTechnical requirementsChoosing between optical and ultrasonic sensorsOptical sensorsUltrasonic sensorsLogic levels and shiftingWhy use two sensors?Attaching and reading an ultrasonic sensorSecuring the sensors to the robotAdding a power switchWiring the distance sensorsInstalling Python libraries to communicate with the sensorReading an ultrasonic distance sensorTroubleshootingAvoiding walls writing a script to avoid obstaclesAdding the sensors to the robot classMaking the obstacle avoid behaviorsFirst attempt at obstacle avoidanceMore sophisticated object avoidanceSummaryExercisesFurther readingChapter 9: Programming RGB Strips in PythonTechnical requirementsWhat is an RGB strip?Comparing light strip technologiesRGB valuesAttaching the light strip to the Raspberry PiAttaching the LED strip to the robotMaking a robot display the code objectMaking an LED interfaceAdding LEDs to the Robot objectTesting one LEDTroubleshootingMaking a rainbow display with the LEDsColour systemsHueSaturationValueConverting HSV to RGBMaking a rainbow on the LEDsUsing the light strip for debugging the avoid behaviorAdding basic LEDs to the avoid behaviorAdding rainbowsSummaryExercisesFurther readingChapter 10: Using Python to Control Servo MotorsTechnical requirementsWhat are servo motors?Looking inside a servoSending input positions to a servo motorPositioning a servo motor with the Raspberry PiWriting code for turning a servoTroubleshootingControlling DC motors and servo motorsCalibrating your servosAdding a pan and tilt mechanismBuilding the kitAttaching the pan and tilt mechanism to the robotCreating pan and tilt codeMaking the servo objectAdding the servo to the robot classCircling the pan and tilt headRunning itTroubleshootingBuilding a scanning sonarAttaching the sensorInstalling the libraryBehavior codeTroubleshootingSummaryExercisesFurther readingChapter 11: Programming Encoders with PythonTechnical requirementsMeasuring the distance traveled with encodersWhere machines use encodersTypes of encodersEncoding absolute or relative positionEncoding direction and speedThe encoders we are usingAttaching encoders to the robotPreparing the encodersLifting the Raspberry PiFitting the encoders onto the chassisWiring the encoders to the Raspberry PiDetecting the distance traveled in PythonIntroducing loggingSimple countingTroubleshootingAdding encoders to the Robot objectExtracting the classAdding the device to the Robot objectTurning ticks into millimetersDriving in a straight lineCorrecting veer with a PIDCreating a Python PID controller objectWriting code to go in a straight lineTroubleshooting this behaviorDriving a specific distanceRefactoring unit conversions into the EncoderCounter classSetting the constantsCreating the drive distance behaviorMaking a specific turnWriting the drive_arc functionSummaryExercisesFurther readingChapter 12: IMU Programming with PythonTechnical requirementsLearning more about IMUsSuggested IMU modelsSoldering attaching headers to the IMUMaking a solder jointAttaching the IMU to the robotPhysical placementWiring the IMU to the Raspberry PiReading the temperatureInstalling the softwareTroubleshootingReading the temperature registerCreating the interfaceWhat is VPython?Graphing the temperatureRunning the temperature plotterTroubleshootingSimplifying the VPython command lineReading the gyroscope in PythonUnderstanding the gyroscopeRepresenting coordinate and rotation systemsAdding the gyroscope to the interfacePlotting the gyroscopeReading an accelerometer in PythonUnderstanding the accelerometerAdding the accelerometer to the interfaceDisplaying the accelerometer as a vectorWorking with the magnetometerUnderstanding the magnetometerAdding the magnetometer interfaceDisplaying magnetometer readingsSummaryExercisesFurther readingSection 3: Hearing and Seeing Giving a Robot Intelligent SensorsChapter 13: Robot Vision Using a Pi Camera and OpenCVTechnical requirementsSetting up the Raspberry Pi cameraAttaching the camera to the pan-and-tilt mechanismWiring in the cameraSetting up computer vision softwareSetting up the Pi Camera softwareGetting a picture from the Raspberry PiInstalling OpenCV and support librariesBuilding a Raspberry Pi camera stream appDesigning the OpenCV camera serverWriting the CameraStream objectWriting the image server main appBuilding a templateRunning the serverTroubleshootingRunning background tasks when streamingWriting a web app coreMaking a behavior controllableMaking the control templateRunning the controllable image serverFollowing colored objects with PythonTurning a picture into informationEnhancing the PID controllerWriting the behavior componentsWriting the control templateWriting the behavior codeRunning the behaviorTroubleshootingTracking faces with PythonFinding objects in an imageConverting to integral imagesScanning for basic featuresPlanning our behaviorWriting face-tracking codeRunning the face-tracking behaviorTroubleshootingSummaryExercisesFurther readingChapter 14: Line-Following with a Camera in PythonTechnical requirementsIntroduction to line followingWhat is line following?Usage in industryTypes of line followingMaking a line-follower test trackGetting the test track materials in placeMaking a lineLine-following computer vision pipelineCamera line-tracking algorithmsThe pipelineTrying computer vision with test imagesWhy use test images?Capturing test imagesWriting Python to find the edges of the lineLocating the line from the edgesTrying test pictures without a clear lineLine following with the PID algorithmCreating the behavior flow diagramAdding time to our PID controllerWriting the initial behaviorTuning the PIDTroubleshootingFinding a line againSummaryExercisesFurther readingChapter 15: Voice Communication with a Robot Using MycroftTechnical requirementsIntroducing Mycroft understanding voice agent terminologySpeech to textWake wordsUtterancesIntentDialogVocabularySkillsLimitations of listening for speech on a robotAdding sound input and output to the Raspberry PiPhysical installationInstalling a voice agent on a Raspberry PiInstalling the ReSpeaker softwareTroubleshootingGetting Mycroft to talk to the sound cardStarting to use MycroftThe Mycroft clientTalking to MycroftTroubleshootingProgramming a Flask APIOverview of Mycroft controlling the robotStarting a behavior remotelyManaging robot modesProgramming the Flask control API serverTroubleshootingProgramming a voice agent with Mycroft on the Raspberry PiBuilding the intentThe settings fileThe requirements fileCreating the vocabulary filesDialog filesCurrent skill folderTroubleshootingAdding another intentVocabulary and dialogAdding the codeRunning with the new intentSummaryExercisesFurther readingChapter 16: Diving Deeper with the IMUTechnical requirementsProgramming a virtual robotModeling the robot in VPythonTroubleshootingDetecting rotation with the gyroscopeCalibrating the gyroscopeRotating the virtual robot with the gyroscopeTroubleshootingDetecting pitch and roll with the accelerometerGetting pitch and roll from the accelerometer vectorTroubleshootingSmoothing the accelerometerDelta timeFusing accelerometer and gyroscope dataTroubleshootingDetecting a heading with the magnetometerCalibrating the magnetometerTroubleshootingTesting the calibration valuesWhat to do if the circles arent togetherGetting a rough heading from the magnetometerCombining sensors for orientationFixing the 180-degree problemDriving a robot from IMU dataSummaryExercisesFurther readingChapter 17: Controlling the Robot with a Phone and PythonTechnical requirementsWhen speech control wont work why we need to driveMenu modes choosing your robots behaviorManaging robot modesTroubleshootingThe web serviceThe templateRunning itTroubleshootingChoosing a controller how we are going to drive the robot, and whyDesign and overviewPreparing the Raspberry Pi for remote drivingget the basic driving system goingEnhancing the image app coreWriting the manual drive behaviorThe template (web page)The style sheetCreating the code for the slidersRunning thisTroubleshootingMaking the robot fully phone-operableMaking menu modes compatible with Flask behaviorsLoading video servicesStyling the menuMaking the menu template into buttonsMaking the menu start when the Pi startsAdding lights to the menu serverUsing systemd to automatically start the robotTroubleshootingSummaryExercisesFurther readingSection 4: Taking Robotics FurtherChapter 18: Taking Your Robot Programming Skills FurtherOnline robot building communities forums and social mediaYouTube channels to get to knowTechnical questions where to get helpMeeting robot builders competitions, makerspaces, and meetupsMakerspacesMaker Faires, Raspberry Jams, and DojosCompetitionsSuggestions for further skills 3D printing, soldering, PCB, and CNCDesign skills2D design for illustration and diagrams3D CADSkills for shaping and buildingMachine skills and toolsHand skills and toolsElectronics skillsElectronics principlesTaking soldering furtherCustom circuitsFinding more information on computer visionBooksOnline coursesSocial mediaExtending to machine learningRobot Operating SystemSummaryFurther readingChapter 19: Planning Your Next Robot Project Putting It All TogetherTechnical requirementsVisualizing your next robotMaking a block diagramChoosing the partsThe test-fit diagramBuying partsAssembling your robotPlanning the code for the robotSystem layersData-flow diagramsFormal diagramsProgramming the robotLetting the world knowSummaryOther Books You May EnjoyLeave a review – let other readers know what you think O autorze: Danny Staple jest inżynierem programowania. Zawodowo programuje w Pythonie, zajmuje się też metodyką DevOps i automatyzacją. Zdobył duże doświadczenie w pracy z systemami wbudowanymi. Hobbystycznie buduje roboty i różne gadżety, jest też mentorem CoderDojo Ham, a jakiś czas temu prowadził kluby LEGO Robotics.
Kategoria: E-Beletrystyka
Producent:
odkrywcy, zaraz, military, kidawa błoński, janusz radek, wiosna praca plastyczna, obudowa do komputera, waldemar milewicz, edex, hean
yyyyy