Skip to content

Commit

Permalink
test slam after itegrating all packages to robot
Browse files Browse the repository at this point in the history
  • Loading branch information
l0g1c-80m8 committed Jun 17, 2022
1 parent 6067519 commit 6f38e1c
Show file tree
Hide file tree
Showing 27 changed files with 16,421 additions and 0 deletions.
195 changes: 195 additions & 0 deletions my_robot/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
cmake_minimum_required(VERSION 2.8.3)
project(my_robot)

## 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)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs # Or other packages containing msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES my_robot
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
# ${catkin_INCLUDE_DIRS}
)

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

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## 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/my_robot_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# 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
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_my_robot.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
Binary file added my_robot/__MACOSX/._base_local_planner_params.yaml
Binary file not shown.
Binary file added my_robot/__MACOSX/._costmap_common_params.yaml
Binary file not shown.
Binary file added my_robot/__MACOSX/._global_costmap_params.yaml
Binary file not shown.
Binary file added my_robot/__MACOSX/._local_costmap_params.yaml
Binary file not shown.
25 changes: 25 additions & 0 deletions my_robot/config/base_local_planner_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
controller_frequency: 10

TrajectoryPlannerROS:
max_vel_x: 1.0 #0.5
min_vel_x: -0.1 #0.01
max_vel_theta: 1.57 #1.5

min_in_place_vel_theta: 0.314

acc_lim_theta: 3.14
acc_lim_x: 2.0
acc_lim_y: 2.0

sim_time: 1.0

vx_samples: 5.0
vtheta_samples: 10.0

pdist_scale: 0.6 #0.6
gdist_scale: 0.8 #0.8
occdist_scale: 0.02

meter_scoring: true

holonomic_robot: false
14 changes: 14 additions & 0 deletions my_robot/config/costmap_common_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
map_type: costmap

obstacle_range: 1.0 # 2.0
raytrace_range: 2.0 # 3.0

transform_tolerance: 0.2 # 0.0

robot_radius: 0.3 # 0.0
inflation_radius: 0.5 # 0.0
cost_scaling_factor: 5.0

observation_sources: laser_scan_sensor

laser_scan_sensor: {sensor_frame: hokuyo, data_type: LaserScan, topic: /udacity_bot/laser/scan, marking: true, clearing: true}
10 changes: 10 additions & 0 deletions my_robot/config/global_costmap_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
global_costmap:
global_frame: map
robot_base_frame: robot_footprint
update_frequency: 1.0
publish_frequency: 1.0
width: 20.0
height: 20.0
resolution: 0.05
static_map: true
rolling_window: false
10 changes: 10 additions & 0 deletions my_robot/config/local_costmap_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local_costmap:
global_frame: odom
robot_base_frame: robot_footprint
update_frequency: 2.0
publish_frequency: 2.0
width: 10.0
height: 10.0
resolution: 0.05
static_map: false
rolling_window: true
53 changes: 53 additions & 0 deletions my_robot/launch/amcl.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<launch>

<!-- Map Server -->
<arg name="map_file" default="$(find my_robot)/maps/RoboOfficeWorldMap.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

<!-- AMCL Node -->
<node name="amcl" pkg="amcl" type="amcl" output="screen">
<!-- <remap from="scan" to="my_robot/laser/scan"/> --> <!-- Not required -->
<param name="base_frame_id" value="robot_footprint"/>
<param name="global_frame_id" value="map"/>

<!-- Overall filter -->
<param name="initial_pose_x" value="-0.500"/>
<param name="initial_pose_y" value="-0.900"/>
<param name="initial_pose_a" value="-1.5707"/>

<param name="min_particles" value="600"/>
<param name="max_particles" value="2000"/>

<param name="update_min_d" value="0.1"/>
<param name="update_min_a" value="0.523599"/>

<!-- Laser -->
<param name="laser_min_range" value="-1.0"/>
<param name="laser_max_range" value="-1.0"/>
<param name="laser_max_beams" value="60.0"/>
<param name="laser_z_hit" value="0.95"/>
<param name="laser_z_rand" value="0.05"/>

<!-- Odometry -->
<param name="odom_frame_id" value="odom"/>
<param name="odom_model_type" value="diff-corrected"/>
<param name="odom_alpha1" value="0.01"/>
<param name="odom_alpha2" value="0.01"/>
<param name="odom_alpha3" value="0.01"/>
<param name="odom_alpha4" value="0.01"/>
</node>

<!-- Move Base -->
<node name="move_base" pkg="move_base" type="move_base" respawn="false" output="screen">
<!-- <remap from="scan" to="my_robot/laser/scan"/> --> <!-- Not required -->
<param name="base_global_planner" value="navfn/NavfnROS" />
<param name="base_local_planner" value="base_local_planner/TrajectoryPlannerROS"/>

<rosparam file="$(find my_robot)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find my_robot)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find my_robot)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot)/config/base_local_planner_params.yaml" command="load" />
</node>

</launch>
7 changes: 7 additions & 0 deletions my_robot/launch/keyboard_teleop.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<launch>

<node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="teleop"/>

</launch>
70 changes: 70 additions & 0 deletions my_robot/launch/localization.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>

<launch>
<!-- Arguments for launch file with defaults provided -->
<arg name="database_path" default="rtabmap.db"/>
<arg name="rgb_topic" default="/camera/rgb/image_raw"/>
<arg name="depth_topic" default="/camera/depth/image_raw"/>
<arg name="camera_info_topic" default="/camera/rgb/camera_info"/>


<!-- Mapping Node -->
<group ns="rtabmap">
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen">

<!-- Basic RTAB-Map Parameters -->
<param name="database_path" type="string" value="$(arg database_path)"/>
<param name="frame_id" type="string" value="robot_footprint"/>
<param name="odom_frame_id" type="string" value="odom"/>
<param name="subscribe_depth" type="bool" value="true"/>
<param name="subscribe_scan" type="bool" value="true"/>

<!-- RTAB-Map Inputs -->
<remap from="scan" to="/scan"/>
<remap from="rgb/image" to="$(arg rgb_topic)"/>
<remap from="depth/image" to="$(arg depth_topic)"/>
<remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

<!-- RTAB-Map Output -->
<remap from="grid_map" to="/map"/>

<!-- Rate (Hz) at which new nodes are added to map -->
<param name="Rtabmap/DetectionRate" type="string" value="1"/>

<!-- 2D SLAM -->
<param name="Reg/Force3DoF" type="string" value="true"/>

<!-- Loop Closure Detection -->
<!-- 0=SURF 1=SIFT 2=ORB 3=FAST/FREAK 4=FAST/BRIEF 5=GFTT/FREAK 6=GFTT/BRIEF 7=BRISK 8=GFTT/ORB 9=KAZE -->
<param name="Kp/DetectorStrategy" type="string" value="0"/>

<!-- Maximum visual words per image (bag-of-words) -->
<param name="Kp/MaxFeatures" type="string" value="400"/>

<!-- Used to extract more or less SURF features -->
<param name="SURF/HessianThreshold" type="string" value="100"/>

<!-- Loop Closure Constraint -->
<!-- 0=Visual, 1=ICP (1 requires scan)-->
<param name="Reg/Strategy" type="string" value="0"/>

<!-- Minimum visual inliers to accept loop closure -->
<param name="Vis/MinInliers" type="string" value="15"/>

<!-- Enable localization mode for the robot -->
<param name="Mem/IncrementalMemory" type="string" value="false"/>
</node>
</group>

<!-- visualization with rtabmapviz -->
<node pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen">
<param name="subscribe_depth" type="bool" value="true"/>
<param name="subscribe_scan" type="bool" value="true"/>
<param name="frame_id" type="string" value="robot_footprint"/>

<remap from="rgb/image" to="$(arg rgb_topic)"/>
<remap from="depth/image" to="$(arg depth_topic)"/>
<remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
<remap from="scan" to="/scan"/>
</node>
</launch>
Loading

0 comments on commit 6f38e1c

Please sign in to comment.