Search
Data types used in the tasks are defined in the library redcp, which contains support wrappers for data structures commonly used in robotics. The individual data types allow for standardizing the interfaces between the functional parts of the robot software architecture. The implementation of the library is inspired by the ROS middleware used in robotics to manage the software architecture of the robots. While the ROS messages are only data wrappers, our implementation features several simplifications, and some classes include additional code to simplify work with them.
redcp
The data types used in the course tasks are inherited from the Message class and are as follows.
Message
Header
Vector3
Quaternion
Pose
Odometry
Twist
Path
LaserScan
OccupancyGrid
NavGraph
The structure of the individual classes and the description of their methods follows.
The general message header contains information common for most data (message) types.
Attributes
timestamp
frame_id
base_frame
Representation of 3D vectors with $x$, $y$, $z$ component.
x
y
z
Representation of 3D orientation using unit quaternion. There are multiple ways to represent the rotations in robotics, with the rotation matrices and quaternions being superior to Euler angles with their commonly used variant Tait–Bryan angles. The Euler angles represent the robot orientation in 3D using rotations around the principal axes of the robot. In particular, the original Euler angles are prescribed by one of the following orders of rotation ($zxz$, $xyx$, $yzy$, $zyz$, $xzx$, $yxy$) with the more common representation using the Tait–Bryan angles variant prescribed by one of the following orders of rotation ($xyz$, $yzx$, $zxy$, $xzy$, $zyx$, $yxz$) commonly referred to as yaw (rotation around $z$ axis), pitch (rotation around $y$ axis), and roll (rotation around $x$ axis) of the robot, similar to the following figure (courtesy of novatel.com).
There are two principal problems in using Euler (Tait–Bryan) angles. First is the missing standardization of rotation order, which leaves us with twelve possible sequences of rotations. Second, the Gimball-lock effect, which is a loss of Degree of Freedom that occurs when two axes are driven into a parallel configuration by the sequence of the rotations. Hence, representation of the orientation using quaternions and rotation matrices is considered a better option.
w
Methods
to_R()
from_R(R)
R
to_Euler()
from_Euler(yaw, pitch, roll)
yaw,pitch,roll
Class representing robot pose in free space in the form of $x$, $y$, $z$ position vector, and orientation quaternion.
position
orientation
dist(other)
other
plot(ax)
matplotlib.pyplot
ax
Class representing the robot path in free space as a list of poses.
poses
plot(ax, skipstep=0)
Class representing robot odometry as a timestamped pose in the given reference frame.
header
pose
Class representing velocity in free space broken into linear and angular components.
linear
angular
Class for representing a single line scan from a planar laser scanner.
angle_min
angle_max
angle_increment
range_min
range_max
distances
Class representing occupancy grid map.
resolution
width
height
origin
data
clone()
pose_to_xy(pose)
xy_to_idx(x, y)
xy_to_pose(x, y)
world_to_map(positions)
map_to_world(positions)
coords_to_pose(coords)
pose_to_coords(pose)
Class representing the navigation graph $\mathcal{G}=(V, E)$, where $V$ is a set of vertices and $E$ is a set of edges.
edges