The following sections describe the robot’s physical design, as well as the software and proposed algorithms.
2.1.1. Robot Design
It is essential to have a simple, robust, and physically compliant modular mechanism design to enhance the robot’s locomotion efficiency in terms of displacement and velocity, and provide an adequate locomotion strategy.
Figure 2 displays three images:
Figure 2a displays the isometric view for the chosen module,
Figure 2b shows its height,
, and width,
, and
Figure 2c depicts each module’s full length,
, and the overlapping distance,
, when two modules are directly joined. Each of the described dimensions is set to
mm,
mm, and
mm. The chosen module, previously presented in [
18,
40], is known as Erekobot
Neke.
The outer surface of each module of the robot comprises three distinct features. Firstly, a regular octagonal prism serves to deter inadvertent rolling motions. The remaining two surfaces feature unconventional geometries, similar to a chamfered trapezoidal prism, each positioned adjacent to one of the octagonal prism’s bases.
Figure 3 shows part of the internal instrumentation embedded in Erekobot
Neke. Enclosed within this central prism are essential components such as the Arduino microcontroller, a battery, a power board, and an Xbee module. Every module is outfitted with two servomotors tasked with moving the robot, one for each non-traditional geometry surface. Additionally, within the same module, one surface with a non-traditional geometry is consistently oriented 90 degrees apart from its counterpart, facilitating yaw and pitch movements. The complete module assembly weighs 3 Newtons, with each motor configured to exert a torque of 3 Newton meters.
Due to the chosen locomotion algorithm, each module’s dimensions play an essential role in the robot’s displacement. Due to the general sinusoidal generator approach of locomotion, dimensions , , , and are direct entries to the computing of the overall displacement function.
The entire robot assembly is performed by interconnecting modules and linking rods in a serial orientation. These rods measure in length and couple one module’s pitch joint with the next module’s yaw joint, enabling these servos to take turns moving the robot and creating a functional two-degrees-of-freedom module.
2.1.3. Visual Sensing
The snake robot’s planned trajectory to overcome a given obstacle (for example, climbing a step, as illustrated in this work) depends on geometrical parameters such as its length, height, distance to the obstacle, and the obstacle’s height, among others. While some of the needed values are intrinsic to the robot’s construction and configuration, others are extrinsic, and must be measured on a case-by-case basis.
Sensing and perceiving the external environment can be achieved through multiple strategies, such as force sensing, range sensors, and camera-based techniques [
7]. Out of those, vision is ubiquitous in the natural realm and is consistently employed by varied creatures. Similarly, a snake robot can use cameras and computer vision algorithms to aid in path planning and navigation, enabling it to acquire the necessary information.
In the present work, we assume the snake robot is traversing a flat terrain towards a step that consists of a rectangular prism. We assume that at least one edge of each visible face is contained entirely within a plane perpendicular to the camera. Furthermore, we consider the robot’s displacement to possess a non-zero component along the direction perpendicular to the camera plane (the direction pointed by the camera at the initial time) and that the camera returns to that orientation at a second moment. Two images are captured and compared, one at an initial time and another after a displacement.
The constraint that the two images are taken with the camera at the same orientation is flexible, given that the robot can reorient the module containing the camera to meet the requirements. As for the displacement, since the robot needs to be near the step to climb it, it is only expected that the displacement will have a component perpendicular to the image plane if the obstacle is visible.
As expected, the concepts above can be equally illustrated by an approaching obstacle and a fixed observer.
Figure 4) illustrates the case of a line segment entirely contained within a plane parallel to the image plane and approaching the camera with a constant length. The focal distance of the camera is denoted by
f,
d is the initial distance of the object to the camera,
is the modulus of the displacement,
L is the length of the segment, and
y and
are the projected lengths of the segment.
Analysing the image, through the congruency between triangles
and
, and triangles
and
, one can arrive at the following relations:
which can be written as
where the unknown terms
d, and
L are expressed in terms of known quantities.
The snake robot can determine the distance to an obstacle and its height through the previously derived expressions. That being defined, identifying the obstacle in the image requires applying the technique described. In order to locate a line segment through which the appropriate measurements are taken (height and distance), the proposed algorithm relies on identifying and matching in both images the convex quadrilateral corresponding to the face of the step nearest to the robot.
To locate convex quadrilaterals in a given image, an edge detector (a canny edge detector in this work) is applied, and the resulting output is fed to a Hough transform algorithm to locate lines represented in the image [
17]. The information on the lines in the image domain is used to find quadrilaterals. First, all pairs of lines that intersect in the domain (all lines that are not parallel intersect, not necessarily in the image domain though, and the intersection might not be drawn in the image) are located. This information is used to build an unweighted, undirected graph in which the nodes are the lines, and the vertices are connected by edges whenever two lines intersect in the image domain. It follows from the definitions that the neighborhood of a node, defined as
, where
u and
v are nodes in the set of nodes
V and
E is the set of edges, represents the set of all lines that intersect a given line in the image domain.
A quadrilateral necessarily possesses exactly four vertices connected by line segments, in which no more than two vertices belong to the same line segment forming the quadrilateral. In the earlier graph representation, vertices can be identified with the edges representing intersections between lines. All quadrilaterals form closed trails of length 4 in the graph representation of the lines and their intersections in the image (a closed trail of length 4 in the graph might not be associated with a quadrilateral though, since two different edges might be associated to the same vertex, such as the case of three lines that all intersect in the same point). Therefore, the problem of identifying quadrilaterals in the image is equivalent to finding closed trails of length 4 in the constructed graph, where each edge is associated with distinct points in the image.
To illustrate these ideas, let us consider an example.
Figure 5a is an example of an image containing some lines that represent existing lines in the image captured by the camera. It is considered that there may be more than one rectangle in the image besides the face of the step, so it is necessary to distinguish the step from any other rectangles in the image.
Figure 5a exemplifies an image in which there is a step (outer rectangle) and another extra rectangle. On the other hand,
Figure 5b represents the lines detected after pre-processing carried out in
Figure 5a where not all lines were detected.
Applying the procedure described to build a graph where the nodes are the lines detected, and every intersection between two lines in the image domain is connected by an edge, we obtain the graph illustrated in
Figure 6.
All quadrilaterals in
Figure 5b are equivalent to the trails in the graph in
Figure 6, defined by the sequences of vertices
,
, and
, which imply the sequences of edges
,
, and
, respectively. Since each edge is associated with a vertex, if no two edges are associated with the same vertex (which means the mapping between edges in the graph and points in the image is injective in the set of edges of the path), the closed path of length 4 in the graph is equivalent to a quadrilateral in the image. The quadrilateral can be traced by connecting the points mapped to the edges in sequence. In this sense, each quadrilateral can be described by a sequence of four distinct points in the image, which are connected in sequence to form it. Note that two distinct sequences containing the same points can be equivalent to the same quadrilateral (the inverse is not always true; given a permutation, the points may be the same, but the new sequence formed might not describe the same quadrilateral).
The Algorithm 1 is proposed for identifying the quadrilaterals (a set of ordered sequences of points) in the image given the graph
, where
V is the set of nodes and
E the set of edges built as described:
Algorithm 1 Quadrilaterals identification algorithm |
▹ Initialize the set of quads as an empty set. |
for do |
for do▹ Pairs of nodes in the neighbourhood of |
▹ The set of nodes already accounted for. |
|
for SetOfOpposites do |
|
end for |
end for |
Remove node from the graph |
end for |
return |
Once all quadrilaterals in both images have been identified, all that is left is to select two matching quadrilaterals (i.e., that describe the same elements in world space), one in each image, that represent the face of the step nearest to the snake robot in the environment. Noting that the ordering of quadrilaterals according to the area (that is, the ranking from smallest to largest) is preserved if the elements visible in both images are the same and the orientation is kept unchanged, in this work we select, in each image, the quadrilateral with the largest area.