---
updatedAt: 2025-05-07T21:02:50.000Z
agentTools:
  projectIndex: https://movai-flow.readme.io/llms.txt
---

# move_distance

Move robot a given distance in the X axis.

## Description

This state node publishes a velocity command so that the robot moves forward or backward (x direction of base\_link frame of the robot) for a set distance. The node utilizes the odometry feedback from the robot. It is also possible to add an acceptable error margin for the distance. The node can also control the minimum and maximum velocity constraint for the robot. The default parameters send a velocity command that moves the robot 1m forward at a maximum velocity of 0.5m/s.

## Examples

...

## Input List

There are 3 parameters.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Port Name
      </th>

      <th>
        Message type
      </th>

      <th>
        Callback
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        entry
      </td>

      <td>
        Transition [movai\_msgs-MovAI/TransitionTo][movai_msgs-MovAI/TransitionTo]
      </td>

      <td>
        move\_distance\_entry.cb
      </td>
    </tr>

    <tr>
      <td>
        odometry
      </td>

      <td>
        Odometry [nav\_msgs-ROS1/Subscriber][nav_msgs-ROS1/Subscriber]
      </td>

      <td>
        move\_distance\_odometry.cb
      </td>
    </tr>

    <tr>
      <td>
        timer
      </td>

      <td>
        Timer [movai\_msgs-ROS1/Timer][movai_msgs-ROS1/Timer]
      </td>

      <td>
        move\_distance\_timer.cb
      </td>
    </tr>
  </tbody>
</Table>

## Output List

There are 2 parameters.

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Port Name
      </th>

      <th>
        Message type
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        cmd\_vel
      </td>

      <td>
        Twist [geometry\_msgs-ROS1/Publisher][geometry_msgs-ROS1/Publisher]
      </td>
    </tr>

    <tr>
      <td>
        exit
      </td>

      <td>
        Transition [movai\_msgs-MovAI/TransitionFor][movai_msgs-MovAI/TransitionFor]
      </td>
    </tr>
  </tbody>
</Table>

## Parameter List

There are 4 parameters.

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        distance
      </td>

      <td>
        [float] The distance the robot must translate. If the value is negative, the robot moves in the negative x direction of the base\_link frame. GGG positive?
      </td>
    </tr>

    <tr>
      <td>
        distance\_error
      </td>

      <td>
        [float] Acceptable distance error in m.
      </td>
    </tr>

    <tr>
      <td>
        kp
      </td>

      <td>
        [float] proportional constant for the calculation of velocity. The higher the value, the bigger the velocity of the robot in relation to the distance that the robot must traverse.
      </td>
    </tr>

    <tr>
      <td>
        max\_vel
      </td>

      <td>
        [float] Maximum velocity (m/s). The value should always be zero or positive.
      </td>
    </tr>
  </tbody>
</Table>

## More Info