Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add remote manager #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
38 changes: 38 additions & 0 deletions naviton/nvt_core/config/planning/planner/dwa_planner_remote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
frequency: 20.0

# ROS params
local_goal_topic: /naviton/waypoint/wpManager/nowWpPose_local
local_map_topic: /naviton/planning/costmap/obstacle_costmap_generator/local_costmap
odom_topic: /naviton/mobile_base_controller/odom

cmd_vel_topic: /naviton/mobile_base_controller/cmd_vel/ros

publish_trajectory: true
#trajectory_topic:

# DWA params
target_velocity: 0.0

velocity_resolution: 16
yawrate_resolution: 16

predict_time: 4.0

error_cost_gain: 10.0
speed_cost_gain: 0.0
costmap_cost_gain: 0.0

obstacle_distance_threshould: 0.6 # [m]

# Robot params
min_linear_speed : 0.15
min_angular_speed : 0.33
min_velocity : -0.15
max_velocity : 0.7

min_yawrate : 0.3
max_yawrate : 0.8

max_d_yawrate : 4.5

max_acceleration : 3.5
28 changes: 28 additions & 0 deletions naviton/nvt_core/launch/include/planning_remote.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<launch>

<!-- ======== Parameters ======== -->
<arg name="param_file_obstacle_costmap_generator" default="$(find nvt_core)/config/planning/costmap/obstacle_costmap_generator.yaml" />
<arg name="param_file_dwa_planner" default="$(find nvt_core)/config/planning/planner/dwa_planner_remote.yaml" />

<!-- ======== Planning ======== -->
<group ns="planning">

<!-- ======== Costmap ======== -->
<group ns="costmap">
<!-- Obstacle Costmap Generator -->
<include file="$(find obstacle_costmap_generator)/launch/obstacle_costmap_generator.launch">
<arg name="param_file" value="$(arg param_file_obstacle_costmap_generator)" />
</include>
</group>

<!-- ======== Planner ======== -->
<group ns="planner">
<!-- DWA Planner -->
<include file="$(find nvt_dwa_planner)/launch/dwa_planner.launch">
<arg name="param_file" value="$(arg param_file_dwa_planner)" />
</include>
</group>

</group>

</launch>
5 changes: 5 additions & 0 deletions naviton/nvt_core/launch/include/remote_manager.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<launch>

<include file="$(find remote_manager)/launch/main.launch" />

</launch>
9 changes: 9 additions & 0 deletions naviton/nvt_core/launch/main.launch
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- Mode-->
<arg name="sim" default="true" />
<arg name="mode" default="true" /> <!-- false: Recording, true: Tracking -->
<arg name="remote" default="false" />

<!-- Basic -->
<arg name="model" default="naviton" />
Expand Down Expand Up @@ -56,7 +57,15 @@
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core perception.launch" name="nvt_perception" output="screen" />

<!-- ======== Planning ======== -->
<group unless="$(arg remote)">
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core planning.launch" name="nvt_planning" output="screen" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core planning.launch" name="nvt_planning" output="screen" />
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core planning.launch" name="nvt_planning" output="screen" />

</group>
<group if="$(arg remote)">
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core planning_remote.launch" name="nvt_planning" output="screen" />

<!-- ======== Remote Manager ======== -->
<include file="$(find remote_manager)/launch/main.launch" />
</group>

<!-- ======== Core ======== -->
<node pkg="nvt_core" type="launch_delayed.sh" args="5 roslaunch nvt_core core.launch" name="nvt_core" output="screen" />
Expand Down
211 changes: 211 additions & 0 deletions remote_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
cmake_minimum_required(VERSION 3.0.2)
project(remote_manager)

## 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 COMPONENTS
roscpp
std_msgs
geometry_msgs
)

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

################################################
## 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 exec_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 your 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 remote_manager
CATKIN_DEPENDS roscpp std_msgs geometry_msgs
# 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}/remote_manager.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/remote_manager_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}
# )

# RemoteManager
set(HEADERS include/remote_manager/remote_manager.h)
add_executable(remote_manager_node src/remote_manager src/nodes/remote_manager_node)
target_link_libraries(remote_manager_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
# 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
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_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_remote_manager.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)
51 changes: 51 additions & 0 deletions remote_manager/include/remote_manager/remote_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef REMOTE_MANAGER_H
#define REMOTE_MANAGER_H

#include <ros/ros.h>
#include <time.h>
Copy link
Collaborator

@Autumn60 Autumn60 Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe unused


#include <geometry_msgs/Twist.h>

#include <std_msgs/Int32.h>
#include <std_msgs/Bool.h>

class RemoteManager
{
public:
RemoteManager(ros::NodeHandle &nh, ros::NodeHandle &pn);
void init();
void update();

void Drive(const geometry_msgs::Twist& cmd_vel_used);
void Stop();
void Pause();
Comment on lines +19 to +21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistent naming of functions.

Suggested change
void Drive(const geometry_msgs::Twist& cmd_vel_used);
void Stop();
void Pause();
void drive(const geometry_msgs::Twist& cmd_vel_used);
void stop();
void pause();

// void Accelerate();
// void DecelerateStop();

void cmd_vel_ros_cb(const geometry_msgs::Twist& ros_msg);
void cmd_vel_remote_cb(const geometry_msgs::Twist& remote_msg);
void emg_switch_cb(const std_msgs::Bool& emg_msg);
void mode_switch_cb(const std_msgs::Int32& mode_msg);

private:
ros::Subscriber _cmd_vel_ros_sub;
ros::Subscriber _cmd_vel_remote_sub;
ros::Subscriber _emg_switch_sub;
ros::Subscriber _mode_switch_sub;
ros::Publisher _cmd_vel_pub;

geometry_msgs::Twist _cmd_vel_ros;
geometry_msgs::Twist _cmd_vel_remote;
bool _emg_switch;
int _mode_switch;
geometry_msgs::Twist _cmd_vel;

const geometry_msgs::Twist cmd_vel_zero;

bool _cmd_vel_ros_updated;
bool _cmd_vel_remote_updated;
bool _emg_switch_updated;
bool _mode_switch_updated;
};

#endif
7 changes: 7 additions & 0 deletions remote_manager/launch/main.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>
<!-- Remote Manager -->
<node name="remote_manager" pkg="remote_manager" type="remote_manager_node" output="screen" />

<!-- MQTT Communication -->
<include file="$(find mqtt_client)/launch/standalone.launch"/>
</launch>
Loading