Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Add Navigation Stack to Stage Simulation #27

Merged
merged 13 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@

Second iteration of the Autonomous Software Stack (ASS) for the AMP go-kart.

# Current Nodes
## stage_ros
See sim\_files inside the `env_sim` file for the image file that specifies the shape of the racetrack and the config files that define the simulated laserscanner sensor and kart.
# Design
Our software stack uses the [ROS 2d navigation package](http://wiki.ros.org/navigation) to obtain control information given sensor and odometry sources, a map, a [tf](http://wiki.ros.org/tf) transform tree, a node to publish the desired kart position (i.e. goal setting), and a set of configurations for the naviagtion stack's global and local planners and costmaps.
This repository contains top-level launch files for simulation and physical testing in `src/sim_stage/launch` and `.../launch` (TODO: Issue 34). We highlight some of the main packages below:

This simulated kart takes /cmd\_vel topic to move. (cmd\_vel contains tf map frame, quaternion, and 3d pose, but we are only using it for forward displacement and yaw displacement)
TODO(35): Add other packages and refactor current ones.

## sim_stage
This package runs the [`stage_ros`](http://wiki.ros.org/stage_ros) node. See `src/sim_stage/sim_files` for the image file that specifies the shape of the racetrack and the config files that define the simulated laserscanner sensor and kart.
This simulated kart takes /cmd\_vel topic to move. (cmd\_vel contains tf map frame, quaternion, and 3d pose, but we are only using it for forward displacement and yaw displacement)
Broadcasts /top/scan, which is the current moment laserscan data as a list of each ray's distance in a 180 degree range.

## slam_mode_goal
Reads top/scan and moves the kart towards open space (path finding). Puts out /amp\_slam\_goal which is a MoveBaseGoal structure that represents displacement. TODO: change from MoveBaseGoal to something simpler.

slam\_mode\_goal is intended to put out high-level, ideal cart commands that are translated by the mover node into hardware commands for the kart's motors and steering.

## Mover
Takes MoveBaseGoal and converts them to cmd_vel to the simulated kart

# Running
* To build the amp-cli tool, run:
```
Expand Down
22 changes: 0 additions & 22 deletions src/env_sim/launch/stage.launch

This file was deleted.

65 changes: 0 additions & 65 deletions src/mover/mover.py

This file was deleted.

32 changes: 18 additions & 14 deletions src/mover/CMakeLists.txt → src/navigation_stack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
cmake_minimum_required(VERSION 3.0.2)
project(mover)
project(navigation_stack)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED)
find_package(catkin REQUIRED COMPONENTS
move_base
teb_local_planner
global_planner
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
Expand Down Expand Up @@ -100,8 +104,8 @@ find_package(catkin REQUIRED)
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES mover
# CATKIN_DEPENDS other_catkin_pkg
# LIBRARIES navigation_stack
# CATKIN_DEPENDS move_base
# DEPENDS system_lib
)

Expand All @@ -113,12 +117,12 @@ catkin_package(
## Your package locations should be listed before other locations
include_directories(
# include
# ${catkin_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/mover.cpp
# src/${PROJECT_NAME}/navigation_stack.cpp
# )

## Add cmake target dependencies of the library
Expand All @@ -129,7 +133,7 @@ include_directories(
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/mover_node.cpp)
# add_executable(${PROJECT_NAME}_node src/navigation_stack_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
Expand All @@ -153,12 +157,12 @@ include_directories(
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

# Mark executable scripts (Python etc.) for installation
# in contrast to setup.py, you can choose the destination
catkin_install_python(PROGRAMS
mover.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
Expand Down Expand Up @@ -193,7 +197,7 @@ include_directories(
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_mover.cpp)
# catkin_add_gtest(${PROJECT_NAME}-test test/test_navigation_stack.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
Expand Down
34 changes: 34 additions & 0 deletions src/navigation_stack/launch/move_base.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!-- Run move_base node (with TebLocalPlannerROS as the local planner) to execute the navigation stack -->

<launch>
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<!-- All the configuration parameters for local and global costmaps
and planners live in the corresponding parameter files. -->
<rosparam file="$(find navigation_stack)/params/costmap_common_params.yaml"
command="load" ns="global_costmap" />
<rosparam file="$(find navigation_stack)/params/costmap_common_params.yaml"
command="load" ns="local_costmap" />
<rosparam file="$(find navigation_stack)/params/local_costmap_params.yaml"
command="load" />
<rosparam file="$(find navigation_stack)/params/global_costmap_params.yaml"
command="load" />
<rosparam file="$(find navigation_stack)/params/teb_local_planner_params.yaml"
command="load" />

<!-- Use the standard global planner -->
<param name="base_global_planner" value="global_planner/GlobalPlanner" />
<param name="planner_frequency" value ="1.0" />
<param name="planner_patience" value="5.0" />

<!-- Plugin to the base_local_planner that allows for local planning of
car-like robots -->
<param name="base_local_planner"
value="teb_local_planner/TebLocalPlannerROS" />
<param name="controller_frequency" value="5.0" />
<param name="controller_patience" value="15.0" />

<!-- Our carlike robot is not able to rotate in place -->
<param name="clearing_rotation_allowed" value="false" />
</node>
</launch>
40 changes: 27 additions & 13 deletions src/mover/package.xml → src/navigation_stack/package.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
<?xml version="1.0"?>
<package format="2">
<name>mover</name>
<name>navigation_stack</name>
<version>0.0.0</version>
<description>Light utility for sending cmd_vel messages</description>
<description>The navigation_stack package</description>

<maintainer email="[email protected]">Xuyang Chen</maintainer>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
<maintainer email="[email protected]">z</maintainer>

<license>MIT</license>

<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>


<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/navigation_stack</url> -->


<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="[email protected]">Jane Doe</author> -->


<!-- The *depend tags are used to specify dependencies -->
Expand All @@ -31,15 +50,10 @@
<!-- <doc_depend>doxygen</doc_depend> -->
<buildtool_depend>catkin</buildtool_depend>

<exec_depend>std_msgs</exec_depend>
<exec_depend>move_base_msgs</exec_depend>
<exec_depend>actionlib_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>visualization_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>nav_msgs</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>tf</exec_depend>
<depend>move_base</depend>
<depend>teb_local_planner</depend>
<depend>global_planner</depend>


<!-- The export tag contains other, unspecified, tags -->
<export>
Expand Down
38 changes: 38 additions & 0 deletions src/navigation_stack/params/costmap_common_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# All parameters are set to default values unless otherwise noted.
# See http://wiki.ros.org/costmap_2d for details.
#
# TODO(Issue 25): Ensure these params work for both simulation and match the
# kart's physical params.

# Robot footprint in meters:
# Footprint used by teb_local_planner_tutorials. Use this for simulation as of now.
footprint: [ [-0.1,-0.125], [0.5,-0.125], [0.5,0.125], [-0.1,0.125] ]

transform_tolerance: 0.2
map_type: costmap

obstacle_layer:
enabled: true
obstacle_range: 3.0
raytrace_range: 3.5
# TODO(Issue 25): May need to include and tune these in tandem with pointcloud_to_laserscan.
#max_obstacle_height: 2.0
#min_obstacle_height: 0.0
inflation_radius: 0.2
track_unknown_space: false
combination_method: 1

observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: base_scan, data_type: LaserScan,
topic: top/scan, marking: true, clearing: true}
#point_cloud_sensor: {sensor_frame: velodyne, data_type: PointCloud2,
# topic: velodyne_points, marking: true, clearing: true}

inflation_layer:
enabled: true
cost_scaling_factor: 10.0
inflation_radius: 0.5

static_layer:
enabled: true
map_topic: "map"
18 changes: 18 additions & 0 deletions src/navigation_stack/params/global_costmap_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# All parameters are set to default values unless otherwise noted.
# See http://wiki.ros.org/costmap_2d for details.

# TODO(Issue 25): Ensure these params work for both simulation and match the
# kart's physical params.
global_costmap:
global_frame: "map"
robot_base_frame: "base_link"
update_frequency: 1.0
public_frequency: 0.5
static_map: true

transform_tolerance: 0.5
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

21 changes: 21 additions & 0 deletions src/navigation_stack/params/local_costmap_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# All parameters are set to default values unless otherwise noted.
# See http://wiki.ros.org/costmap_2d for details.

# TODO(Issue 25): Ensure these params work for both simulation and match the
# kart's physical params.
local_costmap:
global_frame: "map"
robot_base_frame: "base_link"
update_frequency: 5.0
publish_frequency: 2.0
static_map: false
rolling_window: true
width: 5.5
height: 5.5
resolution: 0.1
transform_tolerance: 0.5

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}

Loading