GithubHelp home page GithubHelp logo

jkk-research / wayp_plan_tools Goto Github PK

View Code? Open in Web Editor NEW
66.0 1.0 5.0 279 KB

🏎 Waypoint and planner tools for ROS 2 with minimal dependencies.

License: Apache License 2.0

CMake 3.35% Python 5.84% C++ 90.81%
ros ros2 ros2-humble sze szenergy trajectory control pure-pursuit pursuit waypoint

wayp_plan_tools's Introduction

wayp_plan_tools ROS 2 package

Waypoint and planner tools for ROS 2 with minimal dependencies. Static Badge

Planner / control nodes:

  • single_goal_pursuit: Pure pursuit (for vehicles / robots), a simple cross-track error method
  • multiple_goal_pursuit: Multiple goal pursuit for vehicles / robots an implementation of our paper
  • stanley_control: Stanley controller, a heading error + cross-track error method
  • follow_the_carrot: Follow-the-carrot, the simplest controller

Waypoint nodes:

  • waypoint_saver: saves the waypoints to a csv
  • waypoint_loader: loads the waypoints from a csv to a ROS 2 topic
  • waypoint_to_target: translates the global waypoint array to local target waypoint(s), thus it makes possible to use the controller nodes in a standalone way

Build

It is assumed that the workspace is ~/ros2_ws/.

Terminal 1 🔴 clone

cd ~/ros2_ws/src
git clone https://github.com/jkk-research/wayp_plan_tools

Terminal 1 🔴 build

cd ~/ros2_ws
colcon build --packages-select wayp_plan_tools --symlink-install

Terminal 2 🔵 run

source ~/ros2_ws/install/setup.bash
ros2 launch wayp_plan_tools waypoint_saver.launch.py

Control nodes

In this project the single_goal_pursuit, the multiple_goal_pursuit, stanley_control and the follow_the_carrot controllers are implemented. A high level overview about the algorithms is visible on the following figure:

single_goal_pursuit node

The "classic" pure pursuit implementation

multiple_goal_pursuit node

Multiple goal pursuit for vehicles / robots, an implementation of our paper

follow_the_carrot node

Follow-the-carrot, the simplest controller

waypoint_to_target node

Reads the waypoint array and speeds, from that it creates single or multiple goal points.

It also provides a /metrics_wayp array topic with the following elements:

Array element Meaning Const
[0] current lateral distance to the waypoint (signed, cross-track error) CUR_LAT_DIST_SIGNED
[1] current lateral distance to the waypoint (absolute value) CUR_LAT_DIST_ABS
[2] average lateral distance over time AVG_LAT_DISTANCE
[3] maximum lateral distance over time MAX_LAT_DISTANCE
[4] current waypoint ID CUR_WAYPOINT_ID
[5] target waypoint ID TRG_WAYPOINT_ID
[6] target waypoint longitudinal distance TRG_WAY_LON_DIST

waypoint_saver node

Saves the waypoints to a csv. Important parameters are file_name and file_dir. Set from terminal or from a launch file

ros2 run wayp_plan_tools waypoint_saver --ros-args -p file_name:=tmp1.csv -p file_dir:=/mnt/bag/waypoints

waypoint_loader node

Loads the waypoints from a csv to a ROS 2 topic. Set from terminal or from a launch file

ros2 run wayp_plan_tools waypoint_loader --ros-args -p file_name:=tmp1.csv -p file_dir:=/mnt/bag/waypoints

Usage with a simulator

Please refer to github.com/jkk-research/sim_wayp_plan_tools.

Cite & paper

If you use any of this code please consider citing the paper:

@Article{horvath2020multigoalpursuit, 
    title={Theoretical background and application of multiple goal pursuit trajectory follower}, 
    volume={48}, 
    url={https://hjic.mk.uni-pannon.hu/index.php/hjic/article/view/914}, 
    DOI={10.33927/hjic-2020-03}, 
    number={1}, 
    journal={Hungarian Journal of Industry and Chemistry}, 
    author={Horváth, Ernő and Pozna, Claudiu and Kőrös, Péter and Hajdu, Csaba and Ballagi, Áron}, 
    year={2020}, 
    month={Jul.}, 
    pages={11–17} 
}

wayp_plan_tools's People

Contributors

horverno avatar norbertmarko avatar szepilot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

wayp_plan_tools's Issues

Trajectory loop closure bool

Add a boolean and detect whether trajectory is linear (loop closure false) circular (loop closure true).

If false, stop after last waypoint reached

if (target_waypoint >= int(msg.poses.size() - 1))
{
if (last_waypoint_reached == false)
{
last_waypoint_reached_time = this->now();
}
RCLCPP_INFO_STREAM(this->get_logger(), "Last waypoint reached " << std::fixed << std::setprecision(1) << (last_waypoint_reached_time - this->now()).nanoseconds() / -1e9 << "s ago");
last_waypoint_reached = true;
}

If true, repeat it

if(closest_waypoint > int(msg.poses.size()) - 10)
{
closest_waypoint = 0;
}

Read waypoint file once / at reinit

Read waypoint file once or at reinit. Currently loadWaypointsForVer3 and verifyFileConsistency is in a loop.

if (!verifyFileConsistency(file_path.c_str()))
{
RCLCPP_DEBUG_STREAM(this->get_logger(), "lane data is something wrong...");
return;
}
RCLCPP_DEBUG_STREAM(this->get_logger(), "lane data is valid. publishing...");
std::vector<geometry_msgs::msg::Pose> wps;
std::vector<float> speeds;
std_msgs::msg::Float32MultiArray speed_array;
geometry_msgs::msg::PoseArray wp_array;
visualization_msgs::msg::MarkerArray mark_array;
loadWaypointsForVer3(file_path.c_str(), &wps, &speeds);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.