def transform_stamped(draw,
                      header=header(),
                      child_frame_id=string(),
                      transform=transform()):
    """
    Generate value for ROS geometry message type "TransformStamped".

    Parameters
    ----------
    header : hypothesis_ros.messages.std_msgs.header()
        Strategy to generate header value. (Default: Default hypothesis-ros strategy.)
    child_frame_id : hypothesis_ros.message_fields.string()
        Strategy to generate child_frame_id value. (Default: Default hypothesis-ros strategy.)
    transform : hypothesis_ros.messages.geometry_msgs.transform()
        Strategy to generate transform value. (Default: Default hypothesis-ros strategy.)

    """
    header_value = draw(header)
    child_frame_id_value = draw(child_frame_id)
    transform_value = draw(transform)
    assert isinstance(
        header_value, _Header
    ), 'drew invalid header={header_value} from {header} for _Header field'.format(
        header_value, header)
    assert isinstance(
        child_frame_id_value, str
    ), 'drew invalid child_frame_id={child_frame_id_value} from {child_frame_id} for string field'.format(
        child_frame_id_value, child_frame_id)
    assert isinstance(
        transform_value, _Transform
    ), 'drew invalid transform={transform_value} from {transform} for _Transform field'.format(
        transform_value, transform)
    return _TransformStamped(header_value, child_frame_id_value,
                             transform_value)
def pose_with_covariance_stamped(draw,
                                 header=header(),
                                 pose_with_covariance=pose_with_covariance()):
    """
    Generate value for ROS geometry message type "PoseWithCovarianceStamped".
    """
    header_value, pose_with_covariance_value = draw(header), draw(
        pose_with_covariance)
    return _PoseWithCovarianceStamped(header_value, pose_with_covariance_value)
def imu(draw,
        header=header(),
        orientation=quaternion(),
        orientation_covariance=array(elements=float64(), min_size=9, max_size=9),
        angular_velocity=vector3(),
        angular_velocity_covariance=array(elements=float64(), min_size=9, max_size=9),
        linear_acceleration=vector3(),
        linear_acceleration_covariance=array(elements=float64(), min_size=9, max_size=9)
       ):
    """
    Generate values for ROS1 sensor_msgs/Imu.msg.

    Parameters
    ----------
    header : hypothesis_ros.std_msgs.header()
        Strategy to generate header value. (Default: Default hypothesis_ros strategy.)
    orientation : hypothesis_ros.geometry_msgs.Quaternion()
        Strategy to generate orientation value. (Default: Default hypothesis_ros strategy.)
    orientation_covariance : hypothesis_ros.message_fields.array()
        Strategy to generate orientation_covariance value. (Default: Customized to 9 elements of type float64().)
    angular_velocity : hypothesis_ros.messages.geometry_msgs.vector3()
        Strategy to generate angular_velocity value. (Default: Default hypothesis_ros strategy.)
    angular_velocity_covariance : hypothesis_ros.message_fields.array()
        Strategy to generate angular_velocity_covariance value. (Default: Customized to 9 elements of type float64().)
    linear_acceleration : hypothesis_ros.messages.geometry_msgs.vector3()
        Strategy to generate linear_acceleration value. (Default: Default hypothesis_ros strategy.)
    linear_acceleration_covariance : hypothesis_ros.messages.message_fields.array()
        Strategy to generate linear_acceleration_covariance value. (Default: Customized to 9 elements of type float64().)

    """
    header_value = draw(header)
    orientation_value = draw(orientation)
    orientation_covariance_value = draw(orientation_covariance)
    angular_velocity_value = draw(angular_velocity)
    angular_velocity_covariance_value = draw(angular_velocity_covariance)
    linear_acceleration_value = draw(linear_acceleration)
    linear_acceleration_covariance_value = draw(linear_acceleration_covariance)
    # TODO: add validation
    return _Imu(header_value,
                orientation_value,
                orientation_covariance_value,
                angular_velocity_value,
                angular_velocity_covariance_value,
                linear_acceleration_value,
                linear_acceleration_covariance_value
               )
Example #4
0
def disparity_image(draw,
                    header=header(),
                    image=image(),
                    f=float32(),
                    t=float32(),
                    valid_window=region_of_interest(),
                    min_disparity=float32(),
                    max_disparity=float32(),
                    delta_d=float32()):
    """
    Generate value for ROS1 DisparityImage.msg.

    Parameters
    ----------
    header : hypothesis_ros.messages.std_msgs.header()
        Strategy to generate header value. (Default: Default hypothesis-ros strategy.)
    image : hypothesis_ros.messages.sensor_msgs.image()
        Strategy to generate image value. (Default: Default hypothesis-ros strategy.)
    f : hypothesis_ros.message_field.float32()
        Strategy to generate f value. (Default: Default hypothesis-ros strategy.)
    t : hypothesis_ros.message_field.float32()
        Strategy to generate T value. (Default: Default hypothesis-ros strategy.)
    valid_window : hypothesis_ros.messages.sensor_msgs.region_of_interest()
    min_disparity : hypothesis_ros.message_field.float32()
        Strategy to generate T value. (Default: Default hypothesis-ros strategy.)
    max_disparity : hypothesis_ros.message_field.float32()
        Strategy to generate T value. (Default: Default hypothesis-ros strategy.)
    delta_d : hypothesis_ros.message_field.float32()
        Strategy to generate T value. (Default: Default hypothesis-ros strategy.)

    """
    header_value = draw(header)
    image_value = draw(image)
    f_value = draw(f)
    t_value = draw(t)
    valid_window_value = draw(valid_window)
    min_disparity_value = draw(min_disparity)
    max_disparity_value = draw(max_disparity)
    delta_d_value = draw(delta_d)
    return _DisparityImage(header_value, image_value, f_value, t_value,
                           valid_window_value, min_disparity_value,
                           max_disparity_value, delta_d_value)
def compressed_image(draw, header=header(), format=sampled_from(['jpg', 'png']), data=array(elements=uint8())):
    """
    Generate values for ROS1 sensor_msgs/CompressedImage.msg.

    Parameters
    ----------
    header : hypothesis_ros.std_msgs.header()
        Strategy to generate header value. (Default: Default hypothesis_ros strategy.)
    format : hypothesis.strategies.sampled_from()
        Strategy to generate format value. (Default: Customized hypothesis strategy.)
    data : hypothesis_ros.message_fields.array()
        Strategy to generate format value. (Default: Customized to elements of type uint8().)

    """
    header_value = draw(header)
    format_value = draw(format)
    data_value = draw(data)
    return _CompressedImage(header_value,
                            format_value,
                            data_value
                           )
def image(draw,
          header=header(),
          height=uint32(),
          width=uint32(),
          encoding=sampled_from(IMAGE_ENCODINGS),
          step=uint32(),
          is_bigendian=uint8(),
          data=array(elements=uint8(), max_size=10000**10000)):
    """
    Generate values for ROS1 sensor_msgs/Image.msg.

    Be aware that the element count of the "data" field value is not generated dependent on
    steps and rows right now. Configuration of field "data" element size requires attention
    to avoid exceptions raised in underlying hypothesis functionality.

    Parameters
    ----------
    header : hypothesis_ros.messages.std_msgs.header()
        Strategy to generate header values. (Default: Default hypothesis_ros strategy.)
    height : hypothesis_ros.message_fields.uint32()
        Strategy to generate height value. (Default: Default hypothesis_ros strategy.)
    width : hypothesis_ros.message_fields.uint32()
        Strategy to generate width value. (Default: Default hypothesis_ros strategy.)
    encoding : hypothesis.sampled_from()
        Strategy to generate encoding value. For possible values refer to
        include/sensor_msgs/image_encodings.h . (Default: hypothesis strategy with reasonable configuration.)
    is_bigendian : hypothesis_ros.message_fields.uint8()
        Strategy to generate bigendian value. (Default: Default hypothesis_ros strategy.)
    data : hypothesis_ros.message_fields.array(elements=uint8())
        Strategy to generate matrix data values. Size is steps x rows. (Default: hypothesis_ros strategy with reasonable configuration.)

    """
    header_value = draw(header)
    height_value = draw(height)
    width_value = draw(width)
    encoding_value = draw(encoding)
    step_value = draw(step)
    is_bigendian_value = draw(is_bigendian)
    data_value = draw(data)
    return _Image(header_value, height_value, width_value, encoding_value, step_value, is_bigendian_value, data_value)
def camera_info(draw,
                header=header(),
                height=uint32(),
                width=uint32(),
                distortion_model=string(),
                D=array(elements=float64()),
                K=array(elements=float64(), min_size=9, max_size=9),
                R=array(elements=float64(), min_size=9, max_size=9),
                P=array(elements=float64(), min_size=12, max_size=12),
                binning_x=uint32(),
                binning_y=uint32(),
                roi=region_of_interest()
               ):
    """
    Generate values for ROS1 sensor_msgs/CameraInfo.msg.
    """
    header_value = draw(header)
    height_value = draw(height)
    width_value = draw(width)
    distortion_model_value = draw(distortion_model)
    d_value = draw(D)
    k_value = draw(K)
    r_value = draw(R)
    p_value = draw(P)
    binning_x_value = draw(binning_x)
    binning_y_value = draw(binning_y)
    roi_value = draw(roi)
    return _CameraInfo(header_value,
                       height_value,
                       width_value,
                       distortion_model_value,
                       d_value,
                       k_value,
                       r_value,
                       p_value,
                       binning_x_value,
                       binning_y_value,
                       roi_value
                      )
def log(
    draw,  # DEBUG=uint8(), INFO=uint8(), WARN=uint8(), ERROR=uint8(), FATAL=uint8(),
    header=header(),
    level=uint8(),
    name=string(),
    msg=string(),
    file=string(),
    function=string(),
    line=uint32(),
    topics=array(elements=string())):
    """
    Generate value for ROS1 rosgraph message type "log".

    Parameters
    ----------
    header : hypothesis_ros.messages.std_msgs.header()
        Strategy to generate header value. (Default: Default hypothesis_ros strategy.)
    level : hypothesis_ros.message_fields.uint8()
        Strategy to generate level value. (Default: Default hypothesis_ros strategy.)
    name : hypothesis_ros.message_fields.string()
        Strategy to generate name value. (Default: Default hypothesis_ros strategy.)
    msg : hypothesis_ros.message_fields.string()
        Strategy to generate msg value. (Default: Default hypothesis_ros strategy.)
    file : hypothesis_ros.message_fields.string()
        Strategy to generate file value. (Default: Default hypothesis_ros strategy.)
    function : hypothesis_ros.message_fields.string()
        Strategy to generate function value. (Default: Default hypothesis_ros strategy.)
    line : hypothesis_ros.message_fields.string()
        Strategy to generate line value. (Default: Default hypothesis_ros strategy.)
    topics : hypothesis_ros.message_fields.array()
        Strategy to generate topics value. (Default: Default hypothesis_ros strategy.)

    """

    header_value = draw(header)
    level_value = draw(level)
    name_value = draw(name)
    msg_value = draw(msg)
    file_value = draw(file)
    function_value = draw(function)
    line_value = draw(line)
    topics_value = draw(topics)

    assert isinstance(
        level_value, int
    ), 'drew invalid level={level_value} from {level} for int field'.format(
        level_value, level)
    assert isinstance(
        name_value, str
    ), 'drew invalid name={name_value} from {name} for string field'.format(
        name_value, name)
    assert isinstance(
        msg_value, str
    ), 'drew invalid msg={msg_value} from {msg} for string field'.format(
        msg_value, msg)
    assert isinstance(
        file_value, str
    ), 'drew invalid file={file_value} from {file} for string field'.format(
        file_value, file)
    assert isinstance(
        function_value, str
    ), 'drew invalid function={function_value} from {function} for string field'.format(
        function_value, function)
    assert isinstance(
        line_value, int
    ), 'drew invalid line={line_value} from {line} for int field'.format(
        line_value, line)
    assert isinstance(
        topics_value, list
    ), 'drew invalid topics={topics_value} from {msg} for list field'.format(
        topics_value, topics)

    return _Log(header_value, level_value, name_value, msg_value, file_value,
                function_value, line_value, topics_value)