100% found this document useful (5 votes)
38 views62 pages

Get Effective Robotics Programming With ROS Anil Mahtani PDF Ebook With Full Chapters Now

Mahtani

Uploaded by

poizatalmazi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
38 views62 pages

Get Effective Robotics Programming With ROS Anil Mahtani PDF Ebook With Full Chapters Now

Mahtani

Uploaded by

poizatalmazi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Effective Robotics Programming with ROS Anil


Mahtani

https://textbookfull.com/product/effective-
robotics-programming-with-ros-anil-mahtani/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Data Structures with C Programming 2nd Edition Anil Kumar


Yadav

https://textbookfull.com/product/data-structures-with-c-
programming-2nd-edition-anil-kumar-yadav/

textbookfull.com

A Systematic Approach to Learning Robot Programming with


ROS 1st Edition Wyatt Newman

https://textbookfull.com/product/a-systematic-approach-to-learning-
robot-programming-with-ros-1st-edition-wyatt-newman/

textbookfull.com

ROS Robotics Projects Make your robots see sense and


interact with cool and engaging projects with Robotic
Operating System 1st Edition Lentin Joseph
https://textbookfull.com/product/ros-robotics-projects-make-your-
robots-see-sense-and-interact-with-cool-and-engaging-projects-with-
robotic-operating-system-1st-edition-lentin-joseph/
textbookfull.com

Measures Integrals and Martingales Solution Manual 2nd


Edition René L. Schilling

https://textbookfull.com/product/measures-integrals-and-martingales-
solution-manual-2nd-edition-rene-l-schilling/

textbookfull.com
The China Study Revised and Expanded Edition The Most
Comprehensive Study of Nutrition T. Colin Campbell

https://textbookfull.com/product/the-china-study-revised-and-expanded-
edition-the-most-comprehensive-study-of-nutrition-t-colin-campbell/

textbookfull.com

Alone of All Her Sex: The Myth and Cult of the Virgin Mary
Marina Warner

https://textbookfull.com/product/alone-of-all-her-sex-the-myth-and-
cult-of-the-virgin-mary-marina-warner/

textbookfull.com

Proceedings of the National Aerospace Propulsion


Conference Chetan S. Mistry

https://textbookfull.com/product/proceedings-of-the-national-
aerospace-propulsion-conference-chetan-s-mistry/

textbookfull.com

Surviving Singlehood 1st Edition Hephzibah Frances

https://textbookfull.com/product/surviving-singlehood-1st-edition-
hephzibah-frances/

textbookfull.com

For the Love of Humanity The World Tribunal on Iraq


Pennsylvania Studies in Human Rights 1st Edition Cubukcu

https://textbookfull.com/product/for-the-love-of-humanity-the-world-
tribunal-on-iraq-pennsylvania-studies-in-human-rights-1st-edition-
cubukcu/
textbookfull.com
Performance Generating Systems in Dance: Dramaturgy,
Psychology, and Performativity 1st Edition Hansen

https://textbookfull.com/product/performance-generating-systems-in-
dance-dramaturgy-psychology-and-performativity-1st-edition-hansen/

textbookfull.com
Effective Robotics Programming with ROS
Third Edition
Table of Contents
Effective Robotics Programming with ROS Third Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with ROS
PC installation
Installing ROS Kinetic using repositories
Configuring your Ubuntu repositories
Setting up your source.list file
Setting up your keys
Installing ROS
Initializing rosdep
Setting up the environment
Getting rosinstall
How to install VirtualBox and Ubuntu
Downloading VirtualBox
Creating the virtual machine
Using ROS from a Docker image
Installing Docker
Getting and using ROS Docker images and containers
Installing ROS in BeagleBone Black
Prerequisites
Setting up the local machine and source.list file
Setting up your keys
Installing the ROS packages
Initializing rosdep for ROS
Setting up the environment in the BeagleBone Black
Getting rosinstall for BeagleBone Black
Basic ROS example on the BeagleBone Black
Summary
2. ROS Architecture and Concepts
Understanding the ROS Filesystem level
The workspace
Packages
Metapackages
Messages
Services
Understanding the ROS Computation Graph level
Nodes and nodelets
Topics
Services
Messages
Bags
The ROS master
Parameter Server
Understanding the ROS Community level
Tutorials to practise with ROS
Navigating through the ROS filesystem
Creating our own workspace
Creating an ROS package and metapackage
Building an ROS package
Playing with ROS nodes
Learning how to interact with topics
Learning how to use services
Using Parameter Server
Creating nodes
Building the node
Creating msg and srv files
Using the new srv and msg files
The launch file
Dynamic parameters
Summary
3. Visualization and Debugging Tools
Debugging ROS nodes
Using the GDB debugger with ROS nodes
Attaching a node to GDB while launching ROS
Profiling a node with valgrind while launching ROS
Enabling core dumps for ROS nodes
Logging messages
Outputting logging messages
Setting the debug message level
Configuring the debugging level of a particular node
Giving names to messages
Conditional and filtered messages
Showing messages once, throttling, and other combinations
Using rqt_console and rqt_logger_level to modify the logging level on the fly
Inspecting the system
Inspecting the node's graph online with rqt_graph
Setting dynamic parameters
Dealing with the unexpected
Visualizing nodes diagnostics
Plotting scalar data
Creating a time series plot with rqt_plot
Image visualization
Visualizing a single image
3D visualization
Visualizing data in a 3D world using rqt_rviz
The relationship between topics and frames
Visualizing frame transformations
Saving and playing back data
What is a bag file?
Recording data in a bag file with rosbag
Playing back a bag file
Inspecting all the topics and messages in a bag file
Using the rqt_gui and rqt plugins
Summary
4. 3D Modeling and Simulation
A 3D model of our robot in ROS
Creating our first URDF file
Explaining the file format
Watching the 3D model on rviz
Loading meshes to our models
Making our robot model movable
Physical and collision properties
Xacro – a better way to write our robot models
Using constants
Using math
Using macros
Moving the robot with code
3D modeling with SketchUp
Simulation in ROS
Using our URDF 3D model in Gazebo
Adding sensors to Gazebo
Loading and using a map in Gazebo
Moving the robot in Gazebo
Summary
5. The Navigation Stack – Robot Setups
The navigation stack in ROS
Creating transforms
Creating a broadcaster
Creating a listener
Watching the transformation tree
Publishing sensor information
Creating the laser node
Publishing odometry information
How Gazebo creates the odometry
Using Gazebo to create the odometry
Creating our own odometry
Creating a base controller
Creating our base controller
Creating a map with ROS
Saving the map using map_server
Loading the map using map_server
Summary
6. The Navigation Stack – Beyond Setups
Creating a package
Creating a robot configuration
Configuring the costmaps – global_costmap and local_costmap
Configuring the common parameters
Configuring the global costmap
Configuring the local costmap
Base local planner configuration
Creating a launch file for the navigation stack
Setting up rviz for the navigation stack
The 2D pose estimate
The 2D nav goal
The static map
The particle cloud
The robot's footprint
The local costmap
The global costmap
The global plan
The local plan
The planner plan
The current goal
Adaptive Monte Carlo Localization
Modifying parameters with rqt_reconfigure
Avoiding obstacles
Sending goals
Summary
7. Manipulation with MoveIt!
The MoveIt! architecture
Motion planning
The planning scene
World geometry monitor
Kinematics
Collision checking
Integrating an arm in MoveIt!
What's in the box?
Generating a MoveIt! package with the Setup Assistant
Integration into RViz
Integration into Gazebo or a real robotic arm
Simple motion planning
Planning a single goal
Planning a random target
Planning a predefined group state
Displaying the target motion
Motion planning with collisions
Adding objects to the planning scene
Removing objects from the planning scene
Motion planning with point clouds
The pick and place task
The planning scene
The target object to grasp
The support surface
Perception
Grasping
The pickup action
The place action
The demo mode
Simulation in Gazebo
Summary
8. Using Sensors and Actuators with ROS
Using a joystick or a gamepad
How does joy_node send joystick movements?
Using joystick data to move our robot model
Using Arduino to add sensors and actuators
Creating an example program to use Arduino
Robot platform controlled by ROS and Arduino
Connecting your robot motors to ROS using Arduino
Connecting encoders to your robot
Controlling the wheel velocity
Using a low-cost IMU – 9 degrees of freedom
Installing Razor IMU ROS library
How does Razor send data in ROS?
Creating an ROS node to use data from the 9DoF sensor in our robot
Using robot localization to fuse sensor data in your robot
Using the IMU – Xsens MTi
How does Xsens send data in ROS?
Using a GPS system
How GPS sends messages
Creating an example project to use GPS
Using a laser rangefinder – Hokuyo URG-04lx
Understanding how the laser sends data in ROS
Accessing the laser data and modifying it
Creating a launch file
Using the Kinect sensor to view objects in 3D
How does Kinect send data from the sensors, and how do we see it?
Creating an example to use Kinect
Using servomotors – Dynamixel
How does Dynamixel send and receive commands for the movements?
Creating an example to use the servomotor
Summary
9. Computer Vision
ROS camera drivers support
FireWire IEEE1394 cameras
USB cameras
Making your own USB camera driver with OpenCV
ROS images
Publishing images with ImageTransport
OpenCV in ROS
Installing OpenCV 3.0
Using OpenCV in ROS
Visualizing the camera input images with rqt_image_view
Camera calibration
How to calibrate a camera
Stereo calibration
The ROS image pipeline
Image pipeline for stereo cameras
ROS packages useful for Computer Vision tasks
Visual odometry
Using visual odometry with viso2
Camera pose calibration
Running the viso2 online demo
Performing visual odometry with viso2 with a stereo camera
Performing visual odometry with an RGBD camera
Installing fovis
Using fovis with the Kinect RGBD camera
Computing the homography of two images
Summary
10. Point Clouds
Understanding the Point Cloud Library
Different point cloud types
Algorithms in PCL
The PCL interface for ROS
My first PCL program
Creating point clouds
Loading and saving point clouds to the disk
Visualizing point clouds
Filtering and downsampling
Registration and matching
Partitioning point clouds
Segmentation
Summary
Index
Effective Robotics Programming with ROS
Third Edition
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Effective Robotics Programming with ROS
Third Edition
Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals. However,
Packt Publishing cannot guarantee the accuracy of this information.

First published: September 2013

Second edition: August 2015

Third edition: December 2016

Production reference: 1231216

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78646-365-4

www.packtpub.com
Credits
Authors

Anil Mahtani

Luis Sánchez

Enrique Fernández

Aaron Martinez

Reviewer

Lentin Joseph

Commissioning Editor

Kartikey Pandey

Acquisition Editor

Narsimha Pai

Content Development Editor

Abhishek Jadhav

Technical Editor

Gaurav Suri

Copy Editors

Safis Editing

Dipti Mankame

Project Coordinator

Judie Jose

Proofreader

Safis Editing
Indexer

Pratik Shirodkar

Graphics

Kirk D'Penha

Production Coordinator

Shantanu N. Zagade

Cover Work

Shantanu N. Zagade
About the Authors
Anil Mahtani is a computer scientist who has dedicated an important part of his career to
underwater robotics. He first started working in the field with his master thesis, where he
developed a software architecture for a low-cost ROV. During the development of his thesis,
he also became the team leader and lead developer of AVORA, a team of university students
that designed and developed an autonomous underwater vehicle for the Students Autonomous
Underwater Challenge – Europe (SAUC-E) in 2012. That same year, Anil Mahtani completed
his thesis and his MSc in Computer Science at the University of Las Palmas de Gran Canaria
and then became a Software Engineer at SeeByte Ltd, a world leader in smart software
solutions for underwater systems. In 2015, he joined Dell Secureworks as a Software
Engineer, where he applies his knowledge and skills toward developing intrusion detection
and prevention systems.

During his time at SeeByte Ltd, Anil Mahtani played a key role in the development of several
semi-autonomous and autonomous underwater systems for the military and oil and gas
industries. In those projects, he was heavily involved in the development of autonomy
systems, the design of distributed software architectures, and low-level software development
and also contributed in providing Computer Vision solutions for front-looking sonar
imagery. At SeeByte Ltd, he also achieved the position of project manager, managing a team
of engineers developing and maintaining the internal core C++ libraries.

His professional interests lie mainly in software engineering, algorithms, data structures,
distributed systems, networks, and operating systems. Anil's main role in robotics is to
provide efficient and robust software solutions, addressing not only the current problems at
hand but also foreseeing future problems or possible enhancements. Given his experience, he
is also an asset when dealing with Computer Vision, machine learning, or control problems.
Anil has also interests in DIY and electronics, and he has developed several Arduino libraries,
which he has contributed back to the community.

First of all, I would like to thank my family and friends for their support and for always being
there when I needed them. I would also like to thank my girlfriend Alex for her support and
patience, and for being a constant source of inspiration. Finally, I would like to thank my
colleagues Ihor Bilyy and Dan Good, who have taught me a lot, both personally and
professionally, during these new steps in my career as a software engineer.

Luis Sánchez has completed his dual master's degree in electronics and telecommunication
engineering at the University of Las Palmas de Gran Canaria.

He has collaborated with different research groups as the Institute for Technological
Development and Innovation (IDETIC), the Oceanic Platform of Canary Islands (PLOCAN),
and the Institute of Applied Microelectronics (IUMA) where he actually researches on
imaging super-resolution algorithms.
His professional interests lie in Computer Vision, signal processing, and electronic design
applied on robotics systems. For this reason, he joined the AVORA team, a group of young
engineers and students working on the development of Underwater Autonomous Vehicles
(AUV) from scratch. Inside this project, Luis has started developing acoustic and Computer
Vision systems, extracting information from different sensors such as hydrophones, sonar, or
camera.

With a strong background gained in marine technology, Luis cofounded Subsea


Mechatronics, a young start-up, where he works on developing remotely operated and
autonomous vehicles for underwater environments.

Here's what Dario Sosa Cabrera, a marine technologies engineer and entrepreneur (and the
cofounder and maker of LPA Fabrika: Gran Canaria Maker Space) has to say about Luis:

"He is very enthusiastic and an engineer in multiple disciplines. He is responsible for his
work. He can manage himself and can take up responsibilities as a team leader, as
demonstrated at the euRathlon competition. His background in electronics and
telecommunications allows him to cover a wide range of expertise from signal processing
and software, to electronic design and fabrication."

Luis has participated as a technical reviewer of the previous version of Learning ROS for
Robotics Programming and as a cowriter of the second edition.

First, I have to acknowledge Aaron, Anil, and Enrique for inviting me to participate in this
book. It has been a pleasure to return to work with them. Also, I want to thank the Subsea
Mechatronics team for the great experience working with heavy underwater robots, we grew
together during these years. I have to mention LPA Fabrika – Gran Canaria Maker Space for
the enthusiasm preparing and teaching educational robotics and technological projects;
sharing a workspace with kids can be really motivating.

Finally, I will have to thank my family and my girlfriend for the big support and
encouragement in every project where I'm involved. I want to dedicate my contribution in this
book to them.

Enrique Fernández has a PhD in computer engineering and an extensive background in


robotics. His PhD thesis addressed the problem of Path Planning for Autonomous Underwater
Gliders, but he also worked on other robotics projects, including SLAM, perception, vision,
and control. During his doctorate, he joined the Center of Underwater Robotics Research in
the University of Girona, where he developed Visual SLAM and INS modules in ROS for
Autonomous Underwater Vehicles (AUVs), and participated in the Student Autonomous
Underwater Challenge, Europe (SAUC-E) in 2012, and collaborated in the 2013 edition; in
2012, he was awarded a prize.

During his PhD, Enrique published several conference papers and publications to top robotics
conferences, such as the International Conference of Robotics and Automation (ICRA). He has
also authored some book chapters and ROS books.

Later, Enrique joined PAL Robotics as a SLAM engineer in June 2013. There he worked with
the REEM and REEM-C humanoid robots using ROS software and also contributed to the
open source community, mainly to ROS Control repository, being one of the maintainers
nowadays. In 2015, he joined Clearpath Robotics to work on the Autonomy team, developing
perception algorithms. He has worked on the software that runs on the industrial mobile
robots OTTO 1500 and OTTO 100, which has been deployed into the facilities of multiple
large industry companies, such as General Electric and John Deere.

I would like to thank the coauthors of the book for their dedication. I also want to say thanks
to the members of my research group in Las Palmas de Gran Canaria and the Center of
Underwater Robotics Research in Girona. I learned a lot about robotics then, and I started to
work with ROS. Thanks also to the ex-colleagues from PAL Robotics, who received me with
open hands, and have given me the opportunity to learn even more from ROS and (humanoid)
robots. Last by not least, to my current colleagues at Clearpath Robotics, where I have
mastered ROS and contributed to the software that runs 24/7 in the self-driving robots we
have sold for the Industry 4.0. Finally, thanks to my family and friends for their help and
support, especially Eva.

Aaron Martinez is a computer engineer, entrepreneur, and expert in digital fabrication. He


did his master's thesis in 2010 at the IUCTC (Instituto Universitario de Ciencias y Tecnologias
Ciberneticas) in the University of Las Palmas de Gran Canaria. He prepared his master's
thesis in the field of telepresence using immersive devices and robotic platforms. After
completing his academic career, he attended an internship program at The Institute for
Robotics in the Johannes Kepler University in Linz, Austria. During his internship program,
he worked as part of a development team of a mobile platform using ROS and the navigation
stack. After that, he was involved in some projects related to robotics; one of them is the
AVORA project in the University of Las Palmas de Gran Canaria. In this project, he worked
on the creation of an AUV to participate in the Student Autonomous Underwater Challenge-
Europe (SAUC-E) in Italy. In 2012, he was responsible for manufacturing this project; in
2013, he helped to adapt the navigation stack and other algorithms from ROS to the robotic
platform.

Recently, Aaron created his own company named SubSeaMechatronics, SL. This company
works with projects related with underwater robotics and telecontrol systems. They are also
designing and manufacturing subsea sensors. The company manufactures devices for other
companies and research and development institutes.

Aaron has experience in many fields, such as programming, robotics, mechatronics, and
digital fabrication as well as many devices, such as Arduino, BeagleBone, Servers, and
LIDAR, and nowadays he is designing in SubSeaMechatronics SL some robotics platforms
for underwater and aerial environments.

I would like to thank my girlfriend who has supported me while writing this book and gave
me motivation to continue growing professionally. I also want to thank Donato Monopoli,
Head of Biomedical Engineering Department at ITC (Canary-Islands Institute of Technology),
and all the staff there. Thanks for teaching me all I know about digital fabrication, machinery,
and engineering tissue. I spent the best years of my life in your workshop.

Thanks to my colleagues in the university, especially Alexis Quesada, who gave me the
opportunity to create my first robot in my master's thesis. I have learned a lot about robotics
working with them.

Finally, thanks to my family and friends for their help and support.
About the Reviewer
Lentin Joseph is an author, entrepreneur, electronics engineer, robotics enthusiast, machine
vision expert, embedded programmer, and the founder and CEO of Qbotics Labs
(http://www.qboticslabs.com) in India.

He completed his bachelor's degree in electronics and communication engineering at the


Federal Institute of Science and Technology (FISAT), Kerala. For his final year engineering
project, he made a social robot that can interact with people
(http://www.technolabsz.com/2012/07/social-robot-my-final-year.html). The project was a
huge success and was mentioned in many forms of visual and print media. The main features
of this robot were that it can communicate with people and reply intelligently and has some
image processing capabilities, such as face, motion, and color detection. The entire project
was implemented using the Python programming language. His interest in robotics, image
processing, and Python started with that project.

After his graduation, for 3 years he worked at a start-up company focusing on robotics and
image processing. In the meantime, he learned famous robotic software platforms, such as
Robot Operating System (ROS), V-REP, Actin (a robotic simulation tool), and image
processing libraries, such as OpenCV, OpenNI, and PCL. He also knows about robot 3D
designing and embedded programming on Arduino and Tiva Launchpad.

After 3 years of work experience, he started a new company named Qbotics Labs, which
mainly focuses on research to build up some great products in domains, such as robotics and
machine vision. He maintains a personal website (http://www.lentinjoseph.com) and a
technology blog named technolabsz (http://www.technolabsz.com). He publishes his works on
his tech blog. He was also a speaker at PyCon2013, India, on the topic Learning Robotics
using Python.

Lentin is the author of the books Learning Robotics using Python (refer to http://learn-
robotics.com to find out more) and Mastering ROS for Robotics Programming (refer to
http://mastering-ros.com to find out more) by Packt Publishing. The first book was about
building an autonomous mobile robot using ROS and OpenCV. This book was launched in
ICRA 2015 and was featured in the ROS blog, Robohub, OpenCV, the Python website, and
various other such forums. The second book is for mastering robot operating system; this
was also launched ICRA 2016, and it is one of the best seller book in ROS.

Lentin and his team was a winner of HRATC 2016 challenge conducted as a part of ICRA
2016, and he was Also a finalist in the ICRA 2015 challenge, HRATC
(http://www.icra2016.org/conference/challenges/).
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
<[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt
books and video courses, as well as industry-leading tools to help you plan your personal
development and advance your career.
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thank you for purchasing this Packt book. We take our commitment to improving our content
and products to meet your needs seriously—that's why your feedback is so valuable.
Whatever your feelings about your purchase, please consider leaving a review on this book's
Amazon page. Not only will this help us, more importantly it will also help others in the
community to make an informed decision about the resources that they invest in to learn.

You can also review for us on a regular basis by joining our reviewers' club. If you're
interested in joining, or would like to learn more about the benefits we offer, please
contact us: <[email protected]>.
Preface
Effective Robotics Programming with ROS, Third Edition gives you a comprehensive review
of ROS, the Robot Operating System framework, which is used nowadays by hundreds of
research groups and companies in the robotics industry. More importantly, ROS is also the
painless entry point to robotics for nonprofessionals and students. This book will guide you
through the installation process of ROS, and soon enough, you will be playing with the basic
tools and understanding the different elements of the framework.

The content of the book can be followed without any special devices, and each chapter comes
with a series of source code examples and tutorials that you can run on your own computer.
This is the only thing you need to follow the book.

However, we also show you how to work with hardware so that you can connect your
algorithms with the real world. Special care has been taken in choosing devices that are
affordable for amateur users, but at the same time, the most typical sensors or actuators in
robotics research are covered.

Finally, the potential of ROS is illustrated with the ability to work with whole robots in a real
or simulated environment. You will learn how to create your own robot and integrate it with a
simulation by using the Gazebo simulator. From here, you will have the chance to explore the
different aspects of creating a robot, such as perceiving the world using computer vision or
point cloud analysis, navigating through the environment using the powerful navigation stack,
and even being able to control robotic arms to interact with your surroundings using the
MoveIt! package. By the end of the book, it is our hope that you will have a thorough
understanding of the endless possibilities that ROS gives you when developing robotic
systems.
What this book covers
Chapter 1, Getting Started with ROS, shows the easiest way you must follow in order to have a
working installation of ROS. You will see how to install ROS on different platforms, and you
will use ROS Kinetic throughout the rest of the book. This chapter describes how to make an
installation from Debian packages, compile the sources, and make installations in virtual
machines, Docker, and ARM CPU.

Chapter 2, ROS Architecture and Concepts, is concerned with the concepts and tools provided
by the ROS framework. We will introduce you to nodes, topics, and services, and you will
also learn how to use them. Through a series of examples, we will illustrate how to debug a
node and visualize the messages published through a topic.

Chapter 3, Visualization and Debugging Tools, goes a step further in order to show you
powerful tools to debug your nodes and visualize the information that goes through the
node's graph along with the topics. ROS provides a logging API that allows you to diagnose
node problems easily. In fact, we will see some powerful graphical tools, such as rqt_console
and rqt_graph, as well as visualization interfaces, such as rqt_plot and rviz. Finally, this
chapter explains how to record and play back messages using rosbag and rqt_bag.

Chapter 4, 3D Modeling and Simulation, constitutes one of the first steps in order to
implement your own robot in ROS. It shows you how to model a robot from scratch and run
it in simulation using the Gazebo simulator. You will simulate sensors, such as cameras and
laser range sensors. This will later allow you to use the whole navigation stack provided by
ROS and other tools.

Chapter 5, The Navigation Stack – Robot Setups, is the first of two chapters concerned with the
ROS navigation stack. This chapter describes how to configure your robot so that it can be
used with the navigation stack. In the same way, the stack is explained, along with several
examples.

Chapter 6, The Navigation Stack – Beyond Setups, continues the discussion of the previous
chapter by showing how we can effectively make our robot navigate autonomously. It will use
the navigation stack intensively for that. This chapter shows the great potential of ROS using
the Gazebo simulator and RViz to create a virtual environment in which we can build a map,
localize our robot, and do path planning with obstacle avoidance.

Chapter 7, Manipulation with MoveIt!, is a set of tools for mobile manipulation in ROS. This
chapter contains the documentation that you need to install this package. The chapter also
contains example demonstrations with robotic arms that use MoveIt! for manipulation tasks,
such as grasping, picking and placing, or simple motion planning with inverse kinematics.

Chapter 8, Using Sensors and Actuators with ROS, literally connects ROS with the real world.
This chapter goes through a number of common sensors and actuators that are supported in
ROS, such as range lasers, servo motors, cameras, RGB-D sensors, and GPS. Moreover, we
explain how to use embedded systems with microcontrollers, similar to the widely known
Arduino boards.

Chapter 9, Computer Vision, shows the support for cameras and computer vision tasks in
ROS. This chapter starts with drivers available for FireWire and USB cameras so that you can
connect them to your computer and capture images. You will then be able to calibrate your
camera using the ROS calibration tools. Later, you will be able to use the image pipeline,
which is explained in detail. Then, you will see how to use several APIs for vision and
integrate OpenCV. Finally, the installation and usage of a visual odometry software is
described.

Chapter 10, Point Clouds, shows how to use Point Cloud Library in your ROS nodes. This
chapter starts with the basics utilities, such as read or write a PCL snippet and the conversions
needed to publish or subscribe to these messages. Then, you will create a pipeline with
different nodes to process 3D data, and you will downsample, filter, and search for features
using PCL.
Random documents with unrelated
content Scribd suggests to you:
“I can give you the names of several other influential men who know
me. The Marquis de Pinsara, Visconte de Linto,” and I rattled off a
number of the men to whom I had been introduced on the night of
the reception.
“You can communicate with them in the morning and call them as
witnesses,” he sneered. He had the sardonic habit strongly
developed. “But I haven’t done questioning you yet.”
“I shall not answer any more questions. You don’t believe what I tell
you. My object was to avoid the unpleasantness of being thrust into
one of your filthy gaols; and that has evidently failed.”
“You will tell me where the men are hidden who were here with
you,” he said very threateningly.
“I repeat, I know no more than you do. You were already in the
house when they left this room.”
“That won’t do for me,” he answered bluntly. He motioned to the
two men who pulled my hands behind my back and slipped a pair of
handcuffs on my wrists, while he himself sat down at the desk and
made a list of the things the men had taken from me. “Is this all?”
he asked the fellow who had searched me.
“All but a cigarette case.”
“Anything in it?”
“Nothing but cigarettes. I made sure of that.”
“All right.” I breathed more freely.
“Now, prisoner, show me the secret hiding-place in this room.”
“There is none. The men left the room.”
He came close up and glared so fiercely into my face that I thought
he was going to strike me. He was the sort of brute to enjoy hitting
a defenceless man. “If you lie to me, I’ll——” he ground his teeth
and left me to finish the sentence out of my own fears.
“I do not lie,” I said meeting his look steadily. “And you will do well
to bear in mind in all you do now that in the morning you will find
every word I have said as to my friendship with M. Volheno is true.”
I spoke very calmly thinking it would have the better effect. But it
appeared to enrage him and this time he actually raised his hand for
a blow. It was therefore clearly time to try a change of manner.
So I shoved my head forward until our noses were nearly touching
and with a fierce oath, I cried: “You dare to lay a hand on me, you
infernal bully, and it shall cost you dear. M. Volheno shall know of
this. Do your duty whatever that may be, but not one jot more, or
——” and I adopted his tactic of an unfinished sentence.
The result was a surprising success. His hand fell to his side, his
eyes wavered, and his threatening truculence of manner dropped
from him like a cloak. The reason was, of course, that he was a
miserable coward and had mistaken my coolness for fear.
“I am only doing my duty,” he muttered.
“You lie,” I thundered back, quick to take advantage of his mood.
“You dare to handcuff me like a felon, when I tell you I am a British
subject and give you ample means of testing what I say. You’ll have
to reckon with the British Legation for this. Do what you will, while
you have me in your power; but don’t think for an instant you won’t
have to pay for your bullying in the morning.”
“I have——”
“Don’t try to excuse yourself. If you want to bully any one, do it with
the unfortunate devils under your orders. As for me, do what you
dare—but remember, it will be my turn to-morrow.”
“If you’ll give your word not to offer resistance, you shall be freed.”
“You didn’t ask that before you handcuffed me. I call these men to
witness that. Take me in them to M. Volheno—if you dare. Or haul
me off to gaol in them. It’s all one to me—until to-morrow.”
He paused and then signed to the men who freed me, and he left
the room. I sat down and the men stood near the door whispering
and sniggering together. They appeared to be rather pleased at their
chief’s discomfiture.
He was away so long that I fell asleep and was in the middle of a
realistic dream that I was in prison among the scum of the city when
I was roused by some one thundering my name in my ear.
I started up and found the official had returned with a companion
who was shaking me and calling me by name.
“Mr. Donnington! Mr. Donnington!”
“Well, what is it?” I grumbled, blinking at him like an owl until I
recognized him as a man I had seen at Volheno’s bureau.
“M. Volheno desired me to come to you, sir.”
“Oh, ho,” I chuckled, turning to the official, “so you thought
discretion was the better part of bullying, eh?”
“My name is Dagara, Mr. Donnington. I am M. Volheno’s private
secretary. He instructed me to say that he desires to see you as soon
as you can call on him.”
“I have to go to gaol first,” I said with a snarl for my old enemy. “I
was already there in my dreams when you roused me. But if I am to
be shot or hanged or beheaded as this man decides, I’ll leave
directions for my corpse to be packed up neatly and sent to M.
Volheno.” I was winning so I could afford a small jibe.
“You are of course at liberty to go where you will,” said Dagara.
“Then I’ll go back to bed,” I declared as I rose, “and will see M.
Volheno in the morning. I have to tell him how this brute has treated
me.”
The official had wilted like an unwatered flower in the noon sunlight.
He returned me my belongings and began to mumble an apology. “I
much regret——”
“I’ve no doubt of it. I know your kind,” I cut in drily, and then left the
house with Dagara, feeling that I was well out of an ugly business.
I had come off with all the honours of war, too, for my letters had
not been read and the two little secret papers were safely stowed
away in my cigarette case.
The secretary walked with me to my rooms and I found him an
exceedingly close-lipped individual. The house where the drastic test
of my good faith had been applied was in the Rua Formosa, about
half a mile from the Rua de Palma; and during the walk I could get
little else than monosyllables from my companion. He did go so far
as to tell me that he had been at work all night with Volheno and
that that was the reason he had not gone home and had been able
to come so promptly to identify me.
But when I asked him about the police official he replied that he
knew nothing.
I soon ceased to question him, and as we reached my rooms, he
said suddenly: “You will understand of course that M. Volheno never
allows me to speak of any of his affairs. I will give him your
message, and wish you good-morning, Mr. Donnington;” and with
this abrupt apology in explanation of his silence, he raised his hat
and went off.
A useful and silently working wheel, no doubt, in the complicated
machinery of the Dictator’s system of government, was my mental
verdict as I entered my rooms, eager to examine my prizes at
leisure.
I put back some of the things Barosa’s men had left littered about,
brewed myself some strong coffee, and set to work.
I first read through again very carefully the forged letter which had
been sent to Volheno. That it was the work of an enemy who was
well versed in my movements was of course on the surface. My
friendship with the man to whom it was addressed, my secret
knowledge of the house in the Rua Catania, my business in regard to
these Beira concessions, these three points told their story as plainly
as the attempt proved the ingenious malignity of the writer, and his
intention to cause Barosa and his friends to suspect me of treachery.
The blow was aimed at my life.
There was only one man in all Lisbon who could have the needed
information and would have the motive.
Sampayo.
Jealousy was one motive, and fear of what I knew about him
another. And he was just the sort of cunning beast to go to work in
this mole-like way. He had reckoned that Barosa’s people would
accept without question such a proof of my treachery and act upon
it. And in all probability they would have done so, but for my
conversation with Barosa on the night of the reception and his
conviction of my good faith.
But there was another point. He must have known that the contents
of the letter would be at once passed on to Barosa. There was
therefore some one about Volheno in league with the revolutionary
party, and that some one must be sufficiently high in his confidence
to be able to get the letter and send it to his friends.
I must find that man out; and then I studied the little slip of paper
which Maral had inadvertently given me with the letter.
The line of nonsense ran as follows.
“Real effects to you truly. You know what this only can
mean. 134”
Absolute gibberish of course. But I had the key.
I noticed that the sentence exactly fitted a line of the same length as
the strip of paper with the holes in it; and when I laid the first line of
holes on the top of the words the meaning was clear.
All the letters were covered by it except the following:
RETURN AT ONCE
“Return at once.”
A simple direction to send the letter back; and 134 was probably the
number by which the man was known to his companions. I had had
my trouble for nothing—or next to nothing; for the cipher key did
not cover the figures at the end of the message.
Then a thought struck me. The numerals might stand for letters: 134
would be “A. C. D.;” or 13 and 4, “M.D.”
“M.D.!” I uttered the letters aloud in my surprise. They were
Miralda’s initials. “Miralda Dominguez.”
The coincidence mazed me; but a moment’s reflection made the
inference appear grotesque, preposterous, idiotic; and I laughed at
it.
But my nerves were out of balance. The ordeal of the last few hours,
following so close upon the tense interview with Miralda on the
Stella, had tried me severely. Everybody appeared to be playing at
make-believe to cause me to misread everything I saw and heard.
Even as I laughed at the thought that Miralda could have had even
the remotest connexion with the cipher message, the disconcerting
possibility suggested by the coincidence would not be shaken off.
Furious with myself, for the subconscious distrust of her which this
depression of spirits implied, I huddled the papers together and
went off to bed.
CHAPTER XII
THE REAL “M. D.”

A FEW hours’ sleep enabled me to laugh much more sincerely at the


thought which had sent me off to bed in a hurry, and I was
reviewing the whole situation when Miralda’s brother called. He had
the look of a man who had been making a night of it, and was
washed out and generally sorry for himself.
“Hullo, then, I have caught you, Mr. Donnington. May I come in?”
“Of course you may,” I said as I shook hands with him, put him into
an easy chair and handed him the cigarettes. “Why, did you think
you wouldn’t catch me?”
He lit a cigarette and I saw that his hand shook badly.
“Eh? Oh, you’re such a busy man, aren’t you?” His hesitancy and a
note in his voice suggested nervousness, as if he had been
momentarily at a loss how to answer.
“Not too busy for a chat with you at any time, lieutenant.” I spoke
cordially because I wished to be friendly.
“Thanks,” he said, adding after a puff or two: “You look
confoundedly fit.”
“Not much the matter, I’m glad to say.”
“No, I should think not, indeed.” Another pause followed and he put
his eyeglass in position, glanced at me and then round the room,
and let it fall again. “I suppose not.”
“Will you have a pick-me-up?” I asked. It struck me he had been
looking about for one.
“Cognac,” he replied with a nod. I rang for my servant, Bryant, and
mixed a brandy and soda, which Vasco drank eagerly. “Had a hot
night of it,” he murmured with one of his inane grins as he set the
empty glass down.
“Lost?”
“I always do, curse the luck,” he answered, and pouring himself out
about a wine-glassful of brandy he gulped it down. “Hair of the dog,
you know,” he added, smacking his lips. The spirit stimulated him.
“Better luck next time;” and he laughed, the frown left his face, and
he lolled back smoking with an air of indifference real or assumed.
“So you’re off, eh? Going in your yacht?”
“Off? Where to?”
“Home, I suppose. That’s what I meant about catching you.”
“I am not going away.”
“Not? Why Sampayo——” he stopped suddenly. “No, it wasn’t
Sampayo of course—but I heard you were going last night,” he said,
evidently confused by his first slip.
My interest awoke in an instant. If Sampayo had sent him to me, it
was probably to learn the issue of the previous night’s scheme.
“No no. I shan’t be able to get away for a long time to come.”
“Then I wonder why the deuce—I’m awfully glad to hear it. Then
you won’t be taking your boat away?”
“Of course not. But I’m afraid the weather yesterday made your trip
in her rather unpleasant.”
“Not a bit of it. The fact is I—I came to ask you a favour. I wonder if
you’d mind lending her to me for a day. As a matter of fact I want to
give some of the fellows of my regiment a bit of an outing, and I
should like to take ’em out in her.”
He said all this with the air of one repeating a lesson and very much
afraid of forgetting it. “My dear lieutenant, you can have her and
welcome. Give me a couple of days’ notice, that’s all.”
“Thanks. I’m afraid you’ll think it cool of me.”
“Not cool of you at all; but I think Major Sampayo himself might
have asked, instead of worrying you to do it.”
He sat bolt upright and stared at me. “I say, how the deuce did you
know?” he cried, astonishment shaking all the pretence out of him.
“Never mind that. You can have the Stella,” I answered, with a smile,
intending him to infer that I knew much more.
“I know I’m a clumsy sort of ass. I suppose I gave it away. Dashed if
you don’t beat me;” and he shook his head in perplexity as he first
tried to relight his cigarette and then threw it away and started a
fresh one.
“Did Major Sampayo tell you why he thought I was leaving in such a
hurry?”
“Here, hold on. I’m getting a bit afraid of you.”
“I am the last man in Lisbon you need be afraid of, lieutenant. I
have the greatest desire for your friendship and—if you would like to
give it—your confidence.”
I spoke earnestly and he glanced at me with a hunted, harassed
look in his eyes, and then reached for the brandy again. I put it out
of his reach. “I never was more serious in my life,” I added. “If I can
ever help you, you have only to ask.”
He got up. He was pale and shaking. “I think I’ll go,” he said.
“Very well. But don’t forget what I’ve said. I mean it, on my
honour;” and I held out my hand.
Instead of taking it he looked intently into my eyes and then, to my
surprise, and pain, he seemed to crumple up suddenly. He threw
himself back into the chair, covered his face with his hands and burst
into tears.
It is hateful to see a man cry, but the feeling I had for him was
rather pity than contempt. His tears told me so much. He was the
merest tool in Sampayo’s hands, and his weak nature was as clay for
the stronger man’s moulding. Miralda’s words flashed across my
mind—that behind her betrothal to Sampayo was a “story of shame
and crime.” Here was the key to it, I was convinced.
The shock of learning that I knew Sampayo was in the background,
his fear of what I knew, followed by my earnest offer of friendship,
confidence and help, coming at a moment when he was shaken by a
night of dissipation, had unmanned him.
With an excuse that I had to speak to Bryant, I left him alone for a
few minutes, and when I returned he was staring out of the window
smoking.
“You’ll think me an awful fool and baby, Mr. Donnington,” he said
nervously and shamefacedly.
“No. Any man might break down under the load you are carrying.”
“May I come and see you again? I’m all shaken up now.”
“You can do better than that. Tell me now.”
“How you read a fellow’s thoughts.”
“Sit down and tell me frankly what hold Major Sampayo has on you.”
“I—I can’t tell you.”
“Is it money?”
“I—I can’t tell you,” he repeated, in the same hesitating way.
“I shan’t preach. I only wish to help.”
“I—I can’t tell you. I—I daren’t. I wish to heaven I dared.”
“You mean because of—your sister and all the others involved?”
With a quick start he asked, “Is it on her account you ask?”
“It is on your account, I ask.”
He wavered, but with a shrug of his thin shoulders he turned back to
stare out of the window again. After a pause he said somewhat
irritably. “I’m not in the confessional box, Mr. Donnington. You’ve no
right to question me. And after all, you can’t help me.”
“If you think that, there’s an end of the thing, lieutenant.”
“Now I’ve put your back up, I suppose?” and he laughed feebly.
“Not in the least, I assure you. I know that you are in a devil of a
mess——”
“How do you know it? Has Miralda——” he broke in.
“Don’t mention your sister’s name, please,” I interposed in my turn,
speaking sharply.
“Sampayo says you hate him on her account. And he hates you.
There’s no mistake about that.”
“Yet he sent you to borrow my yacht.”
“That’s for another thing altogether—there I go. If I stop here you’ll
have everything out of me.”
“If you mean in regard to this wretched conspiracy, I probably know
much more than you could tell me.”
His jaw fell in his surprise. “You know and yet lend the Stella? Why,
are you——” He paused and stared at me in gaping bewilderment.
There could be only one reason for this. The Stella was to be used
for some purpose connected with the revolutionaries and he had
jumped to the conclusion that I was in league with them. Before I
could reply he saw his mistake. “What a mess I’m making of things,”
he muttered to himself; and then to me weakly—“Don’t question me
any more, Donnington.”
“Very well. But I was not asking you about that at all, merely your
personal affairs.”
He stood glancing at me nervously and irresolutely. “I say, you won’t
give me away, will you?”
“You have my word on that.”
“Not even to Miralda, I mean? I told her I wanted to talk to you, but
she wouldn’t hear of it.”
“When was that?”
“A couple of days ago.” That was before our talk on the Stella when
she had been intent upon keeping me at a distance.
“Why did you ask her?”
“There you go again. You said you wouldn’t question me. I wish you
wouldn’t,” he said peevishly, and then added with utter
inconsequence; “she used to be always speaking of you when she
came back from Paris. You were Miralda’s Englishman, you know.
And when you turned up here——”
“I’d rather you didn’t tell me.”
“You are an odd mixture. One minute you want to know everything
and the next you shut me up. She’s awfully white and it’s because
it’s so hard on her that I feel such a brute. I——” he pulled up
suddenly and seized his hat. “No, hang it, I can’t tell you now.”
At that moment Bryant brought in a letter from Volheno asking me
to go to him at once, and when we were alone again Vasco held out
his hand. “May I come again? I—I should like to tell you.”
I told him to come any time, and having made me repeat my
promise not to give him away, he wrung my hand and went off.
So Miralda was being sacrificed to save her brother from the
consequences of the “shame and crime” of which he had been guilty.
That was unmistakably plain now; as plain as that Sampayo was the
brute who was demanding the sacrifice as the price of his silence.
In one way it was good news to me. I had feared that there might
prove to be some other obstacle far more difficult to overcome. But
the instant I sent Sampayo flying for life from the vengeance of the
Corsican, Prelot, this barrier would cease to have terrors for either
Miralda or her weak-kneed brother. It would be best, however, to
learn what this crime was before dealing with Sampayo.
It must be serious, for Vasco was absolutely helpless; so much so
that Miralda had forbidden him to speak to me. But that must have
been before our explanation on the Stella. Would she still forbid
him?
Other points in the interview were by no means so clear as the
evidence of Sampayo’s power. Why had he been sent to me? Was it
merely to ascertain whether I had escaped the snare laid on the
previous night? If so why the request about the Stella?
The two things appeared to be inconsistent, and yet there was a
possible explanation. Knowing Vasco to be a fool, Sampayo had had
to prompt him with a reason for the call, supposing I had escaped
from the toils. Vasco was prepared to find me gone. He had blurted
that out; and Sampayo had probably coached him with the request
for the yacht to conceal his own hope—that I was dead—and at the
same time to give him something to talk about if I were found at
home.
Could that request for the yacht be genuine? If so, for what purpose
was it wanted? I could not answer that riddle at present, but I might
be able to get the answer from Vasco.
As I was leaving to go to Volheno, I remembered the ease with
which Barosa’s men had got into the flat, so I told Bryant to get a
new lock and a bolt and have them fitted that day. I had had enough
of midnight visitors.
Volheno received me as courteously as ever, but I soon found that
he was profoundly perplexed about my conduct.
“I expected you much earlier, Mr. Donnington.”
“I am sorry. I didn’t get to bed till six o’clock and lay late.”
“You’ll understand that I have been anxious to hear your news. You
have rendered me a most valuable service by giving me the
information about that Rua Catania house, and you will add
immensely to my obligation if you’ll tell me about this affair last
night in the Rua Formosa.”
“I have not rendered you any service at all, as a matter of fact. I
was coming to see you about your letter. It was a complete puzzle. I
did not write to you at all.”
“I don’t understand.”
“Neither do I altogether. But if you received a letter signed with my
name giving information, it was a forgery.”
“Mr. Donnington! Are you serious?”
“Never more sober in my life.”
He rang his table bell. “Tell M. Dagara to come to me.”
“He is out, sir.”
“Tell him to come to me the instant he returns. I had no doubt that
the signature was yours. I couldn’t doubt it.”
“Well, you must doubt it now. I declare to you positively that I did
not write the letter which put you on the track of that Rua Catania
business.”
“I am bound to say I thought it strange that, having been only a few
hours in the city, you should have got secret information which my
people have been trying in vain to get for weeks.”
I let this go without a reply, but he guessed my reason for silence.
“Had you any such information in your possession?” he asked,
shooting a quick questioning glance at me.
“I think I would rather not answer that question.”
“That means that you had, of course, and makes the matter all the
stranger.”
“Well, I’ll admit I knew something,” I said on second thoughts,
reflecting that I should have to explain the previous night’s affair.
“These are the facts. You remember warning me not to be in the
streets at night. I disregarded the warning and on the second night I
got into the middle of a fight between the mob and the police, and
had to run for it. By chance I found shelter in that house in the Rua
Catania and afterwards learnt the character of the place.”
“You saw some of these villains there, of course?”
“Yes, and had a bit of trouble, but I got out all right.”
“Do you know the men?”
“Yes,” I said, after considering. “But the position is this. I only got
away by passing my word of honour not to speak of anything or any
person I had seen there.”
“Of course such a pledge given under those circumstances is not to
be considered binding. Do you know the names of any of them or
——”
I shook my head. “I must keep the word I gave, M. Volheno.”
“Would you keep your word to a murderer who spared your life on
condition that you kept secret a murder you had seen him commit?”
“That case has not arisen and I would prefer not to discuss
questions of casuistry.”
“But these men are assassins and worse. They are enemies of the
State ripe for any evil work. I must press you to tell me all you
know.”
“My lips are sealed. And to that fact I owe my escape from worse
trouble last night.”
“Well, tell me that then,” he said, with a deep frown of vexation.
“The letter you received in my name was really intended to fix on
me a charge of having broken my pledge;” and I went on to give
him a short and carefully worded account of what had passed, laying
particular stress upon my treatment by the police.
He put the last point aside with a short promise that the matter
should be sifted, and then questioned me at great length and with
all the pressure he could exert to get me to give the names of the
men I had seen, or a description of them.
I resisted all his pressure and then he tried argument. He explained
the position of the Government, and their difficulties; the urgent
necessity that they should know who were their friends and who
their enemies, declaring that my information might be of positively
vital importance.
In reply I uttered one or two home truths, telling him that in my
opinion they were trying their hands at repression in a very
amateurish fashion; employing enough force to render many classes
of the people dissatisfied and violent, but not enough to keep them
in subjection.
We were hammering away at this when Dagara entered.
“You asked for me, sir?”
“Oh, yes. Bring me the file of personal letters—A to F. That brings us
back from the general question to your part in particular, Mr.
Donnington,” he said, when the secretary had gone out again.
“You must not press me any more. I cannot do what you ask.”
But he did press me very strongly indeed, and then Dagara returned
with the file of letters.
“I want that which Mr. Donnington wrote about the Rua Catania
affair. Just find it.”
I was not a little curious to see whether the copy I had made had
been returned.
“I think I left it in my desk,” said Dagara.
“Oh, how many times have I told you to file these at once.”
“I did file it, sir, but if you remember you asked for it when you were
dictating the reply to Mr. Donnington.”
“Manoel, Manoel, is that any excuse for not refiling it at once?”
exclaimed Volheno, and proceeded to lecture the man for his
carelessness.
It was well for me that both of them were thus engaged, and I rose
and strolled to the window and looked out.
“Manoel,” was his first name, then, “Manoel Dagara”; and in a flash
the identity of the “M. D.” of the cipher message was plain.
This sleek, secretive, smooth-tongued secretary who had parried my
questions with the unctuous plea that his employer enjoined such
close silence in regard to his affairs, was in league with Barosa! On
such terms indeed that he even purloined private letters and carried
them to his other masters.
Here in the very eye of the web of Government was a traitor.
Volheno might well say they did not know who were friends and who
enemies.
CHAPTER XIII
MIRALDA’S CONFIDENCE

AS the door closed behind Dagara I returned to my seat. M. Volheno


was obviously annoyed by the incident, but I observed that it was
rather the fact of the secretary’s negligence than the consequences
of it which had ruffled his temper.
“You would scarcely believe, judging by this, the trouble I have
taken to train that young man. Since his marriage there has been
some difference in him; but he is usually as dependable as a
machine, and does his work with precision, speed and silence.”
“A man of the kind is, of course, essential for such confidential
affairs as yours,” I replied.
“Of course I can trust him. He has my entire confidence and is a
perfect encyclopædia of details. As a matter of fact he is a distant
connexion of mine, an orphan, and I educated him.”
“Such a man has reason to be grateful,” I said.
“I believe he would give his life for me,” declared Volheno
confidently.
Dagara came back then, but without the letter, and I concluded that
Maral had failed to send him the copy I had made. While he was
making his explanation I observed him very carefully.
He was genuinely troubled, as he might well be, indeed; but there
was so little in his look and manner suggestive of roguery or
hypocrisy that, despite what I knew, I set him down as an honest
fellow who had been forced against his will into this treachery.
His explanation was that the letter was probably among his
employer’s papers and that he would make a search for it; and
Volheno, trusting him implicitly, accepted the story and sent him
away with another word or two of censure.
Then he resumed his efforts to get me to disclose what I knew, but
adopted a different line. He referred to the concessions, and gave
me to understand that, whereas it would help me in regard to them
if I told him things, my refusal would as certainly prejudice my
chances.
I did not attach the value of a rotten orange to them, but I deemed
it judicious to make a fine display of rather indignant surprise.
From that he went a step further—that although he himself had no
doubt that I had acquired the information innocently, it was highly
probable that those to whom he was bound to report the matter
would not take the same view; and he hinted that in such a case I
might receive a request to leave the country.
That touched me on the raw, but I instantly professed a readiness to
leave. I would go that very day if he wished, but in such a case, of
course, the concessions would be dropped and there would be no
plums in the future for those who looked for them in return for help
at the present.
And then he grew a little more subtle.
“There is another point, Mr. Donnington. We shall necessarily take
more interest than heretofore in your movements.”
“I am quite indifferent about that,” I replied. “You may quarter your
agents in my rooms and on my yacht, if you wish.”
“I don’t mean any such thing as you imply. But you have certain
friends in Lisbon, and——”
“On your introduction,” I reminded him.
“There is, for instance, the Visconte de Linto.”
“To whom I was presented by the Marquis de Pinsara.”
“Some of his family were known to you previously. The whole of that
family occupy a somewhat peculiar position. You may have heard
that the visconte filled for some years a Court position with a good
emolument and no duties. M. Franco has put an end to that—as in
so many other cases—and this has produced both discontent and
bitterness in some quarters. Between such discontent and actual
disaffection, the gap is small; and we cannot help being impressed
by a coincidence where we find close friendly relations between
some such family and a foreigner who suddenly acquires such
dangerous information as you yourself possess.”
“If you mean that my acquaintance is likely to prejudice them in any
way, it shall cease. But it is a mare’s nest—nothing more.”
“The prejudice might be against you, Mr. Donnington. The position
of that family is—peculiar. The visconte is angry and embittered by
the loss of his salary. His wife is indiscreet and has often spoken
against the Government in very strong terms. The son is a lieutenant
in the one regiment in Lisbon some of whose officers are not wholly
free from a suspicion of disaffection. And the daughter, a very
charming young lady, is engaged to marry another officer of the
same regiment and, further, has one or two friends—one especially—
who is something of an enigma. Then you arrive, and—well, you can
draw the inference.”
I smiled. “The inference I draw, M. Volheno, is not from surmise but
from a knowledge of facts.”
“Now don’t you think you would be well advised to let me have in
confidence the information you have gained?”
“I have already explained—I am bound by my word.”
“Then we can do no good by further discussion,” he exclaimed
abruptly, and rose to end the interview.
I hesitated a moment whether to tell him that I had really come to
Lisbon on Miralda’s account, but thought it better to hold my tongue.
It would have shown him the strength of his threat to pack me out
of the country.
The interview left me with the extremely unpleasant and disquieting
feeling that I was getting out of my depth in troubled waters which
might easily be lashed into a storm.
Why he had introduced the topic of the de Linto family, I could not
understand. Yet he must have had a reason, and I ought to know it.
Could I get it from Dagara? He had Volheno’s confidence, and if
Barosa and his associates could force him to give them information,
I might be able to squeeze him also under a threat of exposure. The
plan was infinitely distasteful; but if Miralda’s safety was at stake, I
was ready to adopt almost any means to protect her.
She was in some danger, clearly. She had told me herself that,
although she was no rebel, she was compromised. And as Volheno
suspected her, it might be only a short time before discovery would
follow and suspicion materialize into an actual charge.
Considerably alarmed at this prospect I decided to come to close
grips with Sampayo at once. He might not be the only obstacle
between Miralda and me, but the situation would certainly be much
clearer the instant he was out of the way.
I went off in search of him that afternoon, therefore, but learnt that
he was in Oporto and would not return until the following day. On
my way back I met the Visconte de Linto close to his house and he
urged me to go in with them. He was eager to know something
more about the concessions and his own prospects in regard to
them.
This proved to be a preface to a long account of his grievances
against the Dictator. I was a very patient, sympathetic listener; and
my patience was rewarded, for I succeeded in steering the talk
round to the subject of Sampayo, about whom I wished to know the
visconte’s real opinion. I appealed to his cupidity, therefore.
“I should very much value your advice on a point concerning Major
Sampayo,” I said in a confidence-inviting tone. “I am told that his
influence with the Government is so great that his help alone would
be enough to secure me all I want. Of course you’ll see my difficulty.
I should be delighted to have my friends sharing in the good things;
but those behind me naturally expect me to limit the number. Now, if
he can do everything, of course he is just the man for their
purpose.”
His face fell. “He couldn’t do that, Mr. Donnington. Of course, he is a
wealthy man and all that, but——” and he shook his head.
“Scarcely wealthy—in our sense of the word, visconte,” I replied
airily. “Not wealthy compared with men who are prepared to put fifty
or a hundred thousand pounds into a single scheme.”
“Will your friends go that extent?”
“If the concessions are such as I desire, I should be ready to do
much more than that myself.” I spoke intentionally as if such a sum
were a mere bagatelle.
“You must be a very wealthy man, then, Mr. Donnington,” he
exclaimed.
I smiled blandly and shrugged my shoulders, and then became very
earnest. “I could of course finance the whole thing myself; and if I
could find some one here in Lisbon to co-operate with me
honourably and straightforwardly—he must of course be a man of
the highest honour—I might do so; and should of course leave all
the negotiations here to him. Well, the question is then whether
Major Sampayo is such a man. I place great reliance upon your
opinion, as he is to marry your daughter.”
His perplexity at this was almost comical. He saw that his own
chance of plunder was in danger, and did not know how to save it
without running down the man who was to marry Miralda.
“You place me in a great difficulty, sir,” he said nervously.
“Let me tell you something in confidence, then. I do not like Major
Sampayo. Of course in business matters we do not allow such
personal considerations to determine our actions, although they may
influence us. I would much rather work with such a man as yourself
for instance. But as his name is known to those behind me, of
course any decision I may make and my reason for it might reach
him.”
His alarm at this was obvious. “I—I am afraid I cannot say anything.”
“Of course as your son-in-law, his success would benefit you. An
indirect benefit, perhaps, but still a benefit.”
“Our conversation has taken a very unexpected turn, Mr.
Donnington. I was under the impression you desired my influence in
any event.”
“It may be a question between yours or his,” I said, pressing him
further into the corner. “That is why I have spoken as I have.”
“I—I really cannot say anything. You must decide for yourself. I
should be delighted to be associated with you, but—but——” he
shook his head and paused.
“But you are afraid of Sampayo?” I finished for him.
“Mr. Donnington!” he exclaimed with no little indignation.
“Don’t take offence, please, at least until you have heard me out.
Will you give me your word of honour not to speak of what I wish to
tell you?”
“Yes, certainly.”
“In coming to Lisbon I had another object besides these
concessions. I met your daughter in Paris, and my disappointment
was intense when I found that she was betrothed to Major
Sampayo. I had hoped that in all my affairs I should have enjoyed
the advantage of your help—as that of a relative by marriage.”
He tossed up his hands and stared at me in speechless surprise.
“Since I have been here—you must pardon my speaking very freely
—it has come to my knowledge that Sampayo has forced himself
upon you by reason of his knowledge of certain matters.”
“My dear Mr. Donnington——” He could get no further, and jumped
up from his chair and began to pace the room in extreme agitation.
“My reason for speaking in this way is to ask you one very vital
question. If Major Sampayo were to relinquish his claims to your
daughter’s hand, would you be willing to honour me by allowing me
to plead my own cause with her?”
“I should be only too——” he cried impulsively but checked himself
in the middle of the sentence, and shook his head again. “It is out of
the question; out of the question.”
“I am answered, on the one point. Now, will you go a step further
and tell me why you deem it out of the question?”
“I really cannot discuss the matter. I really cannot,” he said
nervously. “You must excuse me.”
“I cannot press you, of course. But will you think it over and let me
see you again?”
“I am afraid I must say it would be quite useless, Mr. Donnington.”
“Well, the position may have changed when we next meet,” I said as
I rose. “And now, will you let me give you a hint on another matter.
M. Volheno is my friend, as you know, and when I was with him to-
day I learnt that your attitude toward the Government is a subject of
close and watchful interest. You and all in this house will be well
advised to be on your guard;” and without giving him time for the
alarm in his eyes to crystallize into questions, I left him.
As I crossed the hall his wife met me. She greeted me very warmly
and taking me to the saloon asked me to wait a moment for her.
Before she returned, however, Miralda and Inez came in. Both were
surprised to find me there, and judging by their manner, their
surprise was not so great as their displeasure.
“You are still in Lisbon, Mr. Donnington?” said Inez coldly.
“Obviously. Does that surprise you?”
“More than I can express. Doesn’t it, Miralda?”
“I don’t know,” murmured Miralda who was very much disturbed.
“I have no intention of leaving, madame,” I said to Inez.
“No doubt your correspondence detains you?”
“My correspondence?” I repeated.
“And your close association with M. Volheno and the Government.”
“Inez!” exclaimed Miralda, under her breath.
I understood then. They had heard part of the Rua Catania business,
but not the sequel; and Inez had been using it to poison Miralda
against me. I was not unwilling to see the result. “It is well known
that M. Volheno is friendly toward me.”
“There has been an exchange of letters between you, I believe.”
“Well, scarcely. He wrote to me and I have written to him.” Miralda
started uneasily, looked across quickly, and then dropped her eyes.
“I have seen your letter to him and have been speaking to Miralda
about it.”
“You will permit me to doubt that you have seen the letter I wrote?”
“I have a copy of it;” and she handed it to me. “You do not deny
that that is what you wrote.”
I glanced over it. It was in her own handwriting. “Word for word, as
nearly as I can recollect,” I said.
Inez smiled derisively in triumph. “That is how an Englishman keeps
his word,” she sneered.
“I have kept my word just as an Englishman would, madame.”
But Miralda was both perplexed and troubled. “Do you really mean
you wrote such a letter, Mr. Donnington?” she asked.
“It is a fact that I wrote a letter addressed to M. Volheno and
couched in those identical terms. Under the circumstances it was the
best course for me to adopt.”
Miralda caught her breath and winced as if I had struck her.
“Circumstances,” echoed Inez, with a fine scorn.
“But you had pledged your honour not to reveal a word of this,” said
Miralda, hesitatingly. “You cannot mean that you broke it deliberately
in this way?”
“That is perfectly plain,” declared Inez. “It is only what I told you.”
But Miralda shook her head and laid her hand on Inez’ arm, as she
appealed to me. “Mr. Donnington?”
“You know enough of us English, mademoiselle, to judge whether,
having given my word, I should break it.”
“There is no doubt,” said Inez, with a contemptuous toss of the
head.
“You at least have condemned me. And you, mademoiselle?”
“If you admit you broke your word, I should be forced to believe
you; but——” and she threw up her hands with a frown of perplexity.
“But I have not admitted it,” I said.
“How can you say that in the face of this letter?” cried Inez, her
fingers shaking with anger as she held it out.
“Wait, Inez. You can explain this, Mr. Donnington?”
“I cannot explain anything——”
“There, what did I say?” interposed Inez, with contemptuous scorn.
“To those who have already condemned me without explanation.”
Miralda looked at me steadily. “I have not condemned you,” she said
slowly.
“Then I tell you at once that the letter I wrote was written with the
full sanction of a man whose approval even the Contesse Inglesia
will regard as important—Dr. Barosa.”
“Dr. Barosa!” they exclaimed together, but in very different accents.
Miralda’s betokened surprise, Inez’ scorn and disbelief.
“It was written last night in his presence, long after the raid on the
Rua Catania house and when he had thoroughly satisfied himself
and others that I had not broken my word.”
“I find that very difficult of belief,” cried Inez.
“Inez! How dare you?” cried Miralda impetuously, and then winced
and flushed slightly in some confusion, as her friend turned sharply
upon her with a meaning glance.
“Mr. Donnington is to be congratulated upon having so zealous a
champion,” she said coldly.
But it was I, not she, who profited by this shaft. Miralda’s face set
and her eyes shone as she held out her hand to me. “I owe you an
apology, Mr. Donnington, for having stooped to listen to this slander.
You have my word for it that I will not do it again.”
As I took her hand, Inez coughed suggestively.
Miralda understood and turned quickly from me. “There is a limit to
what I will endure even from you, Inez. You have reached it now;”
and Inez, being a person of discretion, held her tongue.
I left them, asking Miralda to make my excuses to her mother, and
returned to my rooms in a glow of pleasure at the proof of Miralda’s
confidence in me, and her zeal in risking even a breach with Inez on
my account.
At my rooms I found a letter marked “Urgent and confidential.”
I guessed of course that it had some concern with the concessions,
and after puzzling over the unknown handwriting, as one will at
times, I opened it without much interest.
But I read it with the closest concern. It was from Vasco, and it gave
me the very facts I was so eager to learn.
CHAPTER XIV
ALONE WITH SAMPAYO

VASCO’S letter was very long, and so rambling and inconsequent in


parts as to be almost incoherent. It was obviously written under the
impulse of intense feeling, despair indeed; and was in response to
my solicitation of confidence and offer of help.
“I don’t believe you can help me even if you would, and I
don’t suppose you’ll care to try when you know the mess I
am in. But you said you would, and a drowning man
catches at straws. I am at the end of things; utterly
broken up and ruined; and bar writing to you I have only
two alternatives—to shoot myself or get more hopelessly
into the power of the man who has done a lot to drag me
down. That’s the mood in which I write to you, and the
reason I write. If you won’t or can’t help me, say so at
once.”
That was the preface to his ugly story.
Put in a few words he was hopelessly in Sampayo’s power. He was a
gambler and a hard drinker, and Sampayo had used both these
weaknesses to ruin him. And ruin him he certainly had, using a craft
and cunning worthy of the man.
Having got Vasco hopelessly in debt to him and others, Sampayo
had succeeded in having him placed in a position where he had
charge of a considerable sum of money subscribed by the officers of
the regiment. He had then dunned him for payment and set others
to do the same, and Vasco had been weak enough to use this
money. Sampayo was of course on the watch, and had discovered
the theft within a few hours of its commission.
To frighten such a weakling was easy work; and Sampayo had at
once engineered matters so that the money had to be instantly
forthcoming. Scared out of his wits, Vasco had admitted his act, and
the scoundrel, in the guise of friendship, had offered to find the sum
on condition that Vasco gave him a written confession.
Glad to escape on any terms, Vasco had only too readily agreed, and
exposure had thus been averted. This was some six months
previously. For two of them Sampayo showed nothing but friendship.
Then the persecution started. Vasco was drawn into the
revolutionary net and forced to commit himself. The next step was
that Miralda should be involved. To save Vasco she had yielded; and
after another interval the demand that she should consent to marry
Sampayo had followed.
She had resisted this strenuously—she had been home from Paris
only about a month at the time; but the utmost pressure had been
brought to bear upon her, not only by the visconte and Vasco, but by
Barosa and the leaders of the revolutionary party.
For two months she had held out, and had yielded only a month
before my arrival.
How this part of the letter stirred me will be readily understood.
After my talk with Miralda on the Stella, it was not mere coxcombry
on my part to believe that, had I come only a month earlier, I should
have found her ready to receive me on the same footing as in those
weeks in Paris.
I could understand now the reason for Inez’ warning, Barosa’s
references, Sampayo’s instant jealousy, and that regret of the
viscontesse that I had not come sooner. They had known the reason
for Miralda’s stubborn resistance, and had feared that my arrival
would lead to her rebellion.
Vasco’s immediate request was that I would lend him some money—
about five hundred pounds—but he freely admitted that even if I
consented, the money would not free him from Sampayo.
I sent him a note at once that I would do what he wanted and
would have the money ready for him if he would come to me the
following evening.
But I made it a condition that he should go on board the Stella at
once and remain there until the time for our interview. I did not
mean to give Sampayo a chance of frightening him into admitting he
had told me. I told Bryant to put the letter into Vasco’s own hands
and to go with him to the yacht, and I wrote a line to my skipper
with instructions.
It proved to be a prudent precaution. Sampayo returned about
midday and as I found out afterwards went everywhere in search of
Vasco, before going to his own quarters, where I was waiting.
He had learnt meanwhile that his attempt against me had failed, but
he was genuinely surprised to see me when he entered.
“This is an unexpected pleasure, Mr. Donnington,” he said.
“I am sure of the unexpectedness,” I replied drily, taking no notice of
the offer of his hand.
He drew himself up stiffly. “Am I to understand that your refusal of
my hand is intentional?”
“Am I to understand on my side that you made the offer of it from
any feeling of friendship?”
“That is a very extraordinary question.”
“It is not altogether an ordinary visit, Major Sampayo. It has more to
do with business of a sort than friendship. I am right in thinking you
do not feel very well disposed to me.”
“Oh, really I have no time just now for talk of that kind. I have been
away from the city and have a great press of matters to attend to.
Be good enough to state your business briefly.”
He said this in a very curt sharp tone and he crossed to a writing
desk, unlocked it and began to turn over some papers.

You might also like