Skip to content

lukbieli/OfficeMate-NavigationControler

Repository files navigation

Navigation Controller

This ROS 2 package, navigation_controler, provides a simple TCP-based interface to send navigation goals to a ROS 2 action server. It includes both the ROS 2 action client (nav_ctrl.cpp) and a Python client script (client_nav.py) for sending navigation requests.

Features

  • Accepts TCP connections to receive navigation goals in the format x,y,z.
  • Sends goals to the ROS 2 Navigation stack using the nav2_msgs/action/NavigateToPose action.
  • Supports feedback on the goal's status and completion.

Package Structure

navigation_controler/
├── client_nav.py        # Python client script for sending navigation requests
├── CMakeLists.txt       # CMake build configuration for the ROS 2 package
├── nav_ctrl.cpp         # ROS 2 action client with TCP server
├── package.xml          # ROS 2 package manifest
├── README.md            # Documentation for the package

Prerequisites

Install ROS 2

Ensure ROS 2 is installed on your system. Follow the instructions on the ROS 2 Installation Page.

Install Dependencies

Run the following commands to install the necessary dependencies:

  1. Install ROS 2 dependencies:

    sudo apt update
    sudo apt install -y ros-${ROS_DISTRO}-nav2-msgs ros-${ROS_DISTRO}-rclcpp ros-${ROS_DISTRO}-rclcpp-action
  2. Install Boost libraries:

    sudo apt install -y libboost-all-dev
  3. Install Python dependencies:

    pip install --upgrade pip
    pip install socket

    Note: Replace ${ROS_DISTRO} with your ROS 2 distribution (e.g., humble or foxy).


Building the Package

  1. Clone the repository into your ROS 2 workspace:

    cd ~/ros2_ws/src
    git clone <repository_url> navigation_controler
  2. Navigate to the workspace root and build:

    cd ~/ros2_ws
    colcon build --packages-select navigation_controler
  3. Source the workspace:

    source ~/ros2_ws/install/setup.bash

Running the ROS 2 Action Client (Server)

To start the ROS 2 action client with the embedded TCP server:

ros2 run navigation_controler nav_ctrl

You should see output indicating the TCP server is running, e.g.:

[INFO] [pose_action_client]: TCP Server started on IP: 0.0.0.0, Port: 12345

Sending Navigation Requests

Use the provided Python script to send navigation requests to the server:

  1. Ensure the server is running.
  2. Run the client script:
    python3 ~/ros2_ws_v2/src/navigation_controler/client_nav.py

This script sends a navigation goal in the format x,y,z to the TCP server.

Example output:

Send start
Received from server: Goal accepted

Example Use Case

Modify client_nav.py to customize the navigation goal:

send_navigation_request("127.0.0.1", 12345, 3.5, 2.0, 0.0)

Change the coordinates as needed and rerun the script to test different goals.


Troubleshooting

  • TCP Server not accepting connections:

    • Verify the port is not in use by another application.
    • Ensure the firewall settings allow connections to the server.
  • No feedback from the action server:

    • Ensure the Navigation 2 stack is running and configured correctly.
    • Check ROS 2 topics and services for errors.

License

This package is licensed under the Apache 2.0 License. See LICENSE for details.

About

Navigation controller to give access to nav2 requests outside of ros2 environment

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published