Пример #1
0
def get_walking_params(max_linear_vel, max_rotation_vel):
    max_vel_linear = geometry_pb2.Vec2(x=max_linear_vel, y=max_linear_vel)
    max_vel_se2 = geometry_pb2.SE2Velocity(linear=max_vel_linear,
                                           angular=max_rotation_vel)
    vel_limit = geometry_pb2.SE2VelocityLimit(max_vel=max_vel_se2)
    params = RobotCommandBuilder.mobility_params()
    params.vel_limit.CopyFrom(vel_limit)
    return params
Пример #2
0
def get_mobility_params():
    """Gets mobility parameters for following"""
    vel_desired = .75
    speed_limit = geo.SE2VelocityLimit(
        max_vel=geo.SE2Velocity(linear=geo.Vec2(x=vel_desired, y=vel_desired), angular=.25))
    body_control = set_default_body_control()
    mobility_params = spot_command_pb2.MobilityParams(vel_limit=speed_limit, obstacle_params=None,
                                                      body_control=body_control,
                                                      locomotion_hint=spot_command_pb2.HINT_TROT)
    return mobility_params
Пример #3
0
LOGGER = logging.getLogger()

VELOCITY_BASE_SPEED = 0.5  # m/s
VELOCITY_BASE_ANGULAR = 0.8  # rad/sec
VELOCITY_CMD_DURATION = 0.6  # seconds
COMMAND_INPUT_RATE = 0.1

# Velocity limits for navigation (optional)
NAV_VELOCITY_MAX_YAW = 1.2  # rad/s
NAV_VELOCITY_MAX_X = 1.0  # m/s
NAV_VELOCITY_MAX_Y = 0.5  # m/s
NAV_VELOCITY_LIMITS = geometry_pb2.SE2VelocityLimit(
    max_vel=geometry_pb2.SE2Velocity(linear=geometry_pb2.Vec2(
        x=NAV_VELOCITY_MAX_X, y=NAV_VELOCITY_MAX_Y),
                                     angular=NAV_VELOCITY_MAX_YAW),
    min_vel=geometry_pb2.SE2Velocity(linear=geometry_pb2.Vec2(
        x=-NAV_VELOCITY_MAX_X, y=-NAV_VELOCITY_MAX_Y),
                                     angular=-NAV_VELOCITY_MAX_YAW))


def _grpc_or_log(desc, thunk):
    try:
        return thunk()
    except (ResponseError, RpcError) as err:
        LOGGER.error("Failed %s: %s" % (desc, err))


class ExitCheck(object):
    """A class to help exiting a loop, also capturing SIGTERM to exit the loop."""
    def __init__(self):