ros.utils
This file contains some util functions for ROS 2 nodes.
append_measurement(data, time, pos, quat, command=None)
¶
Appends each measurment data to the corresponding of list in the dictionary.
Source code in drone_estimators/ros/utils.py
append_state(data, time, state)
¶
Appends each states data to the corresponding of list in the dictionary.
Source code in drone_estimators/ros/utils.py
create_array(time_stamp, drone, data)
¶
Creates a generic Float64Array with the length of data.
If data is None, an array zeros of length 4 is created.
Source code in drone_estimators/ros/utils.py
create_marker_array(time_stamp, drone, pos, quat, vel, ang_vel, force, torque)
¶
Creates a MarkerArray for visualization in RViz.
Source code in drone_estimators/ros/utils.py
create_pose(time_stamp, drone, pos, quat)
¶
Creates a PoseStamped from position and orientation.
Source code in drone_estimators/ros/utils.py
create_twist(time_stamp, drone, vel, ang_vel)
¶
Creates a TwistStamped based on velocity and angular velocity.
Source code in drone_estimators/ros/utils.py
create_wrench(time_stamp, drone, force, torque)
¶
Creates a WrenchStamped based on force and torque.
If force or torque is None, it gets set to zeros.
Source code in drone_estimators/ros/utils.py
find_transform(transforms, child_frame_id)
¶
Finds the transform of a given child frame.
header2sec(header)
¶
make_arrow_marker_from_vector(id, ns, start_pos, vector, color_rgba=[1, 1, 1, 1], scale=1.0)
¶
Create an arrow marker for visualization in RViz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
The id of the marker. |
required |
ns
|
str
|
The namespace of the marker. |
required |
start_pos
|
Array
|
The start position of the arrow. |
required |
vector
|
Array
|
The vector the arrow points along. |
required |
color_rgba
|
Array
|
The color of the arrow. |
[1, 1, 1, 1]
|
scale
|
float
|
The scaling of the vector. |
1.0
|
Returns:
| Type | Description |
|---|---|
Marker
|
The arrow marker from start_pos to start_pos + vector * scale. |
Source code in drone_estimators/ros/utils.py
tf2array(tf)
¶
Converts a Transform into numpy arrays.