ROS two different nodes in the same package
Hello. My package name is tum_ardrone. Inside the src file I have Autopilot,StateEstimation and UINode. I Created Autopilot2,StateEstimation2 and UINode2 to run two robots.
When I run the launch file:
<launch>
<group ns="controlo_drone1">
<node name="drone_stateestimation" pkg="tum_ardrone" type="drone_stateestimation">
</node>
<node name="drone_autopilot" pkg="tum_ardrone" type="drone_autopilot">
</node>
<node name="drone_gui" pkg="tum_ardrone" type="drone_gui">
</node>
</group>
<group ns="controlo_drone2">
<node name="drone_stateestimation2" pkg="tum_ardrone" type="drone_stateestimation">
</node>
<node name="drone_autopilot2" pkg="tum_ardrone" type="drone_autopilot">
</node>
<node name="drone_gui2" pkg="tum_ardrone" type="drone_gui">
</node>
</group>
</launch>
I want to run Autopilot,StateEstimation and UINode and Autopilot2,StateEstimation2 and UINode2.
But when I run the launch file it runs two instances of Autopilot,StateEstimation and UINode and not my Autopilot2,StateEstimation2 and UINode2.
Basically I copy-paste the folders inside src ( Autopilot,StateEstimation and UINode ) and changed the code in each one to read /drone1/image_raw and /drone2_image_raw in ( Autopilot2,StateEstimation2 and UINode2 ).
The problem is that when I run roslaunch it only starts 2 instances of the nodes Autopilot,StateEstimation and UINode and not Autopilot,StateEstimation and UINode and Autopilot2,StateEstimation2 and UINode2
Any idea? Please help me.
Edit: Maybe I have to mess with CMakeLists.txt? But what can I do?
#
# Author: Jakob Engel <jajuengel@gmail.com>
# Contributor: Stefan Wilkes <stefan.wilkes@gmail.com>
#
cmake_minimum_required(VERSION 2.8.3)
project(tum_ardrone)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
ardrone_autonomy
cv_bridge
dynamic_reconfigure
geometry_msgs
sensor_msgs
std_msgs
std_srvs
message_generation
roscpp
rospy
)
# Compile third party libs
include(ExternalProject)
ExternalProject_Add(thirdparty
URL ${PROJECT_SOURCE_DIR}/thirdparty/thirdparty.tar.gz
PREFIX ${CMAKE_BINARY_DIR}/thirdparty
CONFIGURE_COMMAND ""
BUILD_COMMAND make
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
)
# ------------------- add dynamic reconfigure api ------------------------------------
generate_dynamic_reconfigure_options(
cfg/AutopilotParams.cfg
cfg/GUIParams.cfg
cfg/StateestimationParams.cfg
)
################################################
## Declare ROS messages, services and actions ##
################################################
## Generate messages in the 'msg' folder
add_message_files(FILES filter_state.msg)
## Generate services in the 'srv' folder
add_service_files(
DIRECTORY srv
FILES
SetReference.srv
SetMaxControl.srv
SetInitialReachDistance.srv
SetStayWithinDistance.srv
SetStayTime.srv
)
## Generate added messages
generate_messages(DEPENDENCIES std_msgs)
###################################
## catkin specific configuration ##
###################################
catkin_package(CATKIN_DEPENDS message_runtime std_msgs ardrone_autonomy)
###########
## Build ##
###########
include_directories(${catkin_INCLUDE_DIRS})
# --------------------------- stateestimation & PTAM --------------------------------
# set header ans source files
set(STATEESTIMATION_SOURCE_FILES
src/stateestimation/GLWindow2.cc
src/stateestimation/GLWindowMenu.cc
src/stateestimation/main_stateestimation.cpp
src/stateestimation/DroneKalmanFilter.cpp
src/stateestimation/Predictor.cpp
src/stateestimation/PTAMWrapper.cpp
src/stateestimation/MapView.cpp
src/stateestimation/EstimationNode.cpp
src/stateestimation/PTAM/ATANCamera.cc
src/stateestimation/PTAM/Bundle.cc
src/stateestimation/PTAM/HomographyInit.cc
src/stateestimation/PTAM/KeyFrame.cc
src/stateestimation/PTAM/Map.cc
src/stateestimation/PTAM/MapMaker.cc
src/stateestimation/PTAM/MapPoint.cc
src/stateestimation/PTAM/MiniPatch.cc
src/stateestimation/PTAM/PatchFinder.cc
src/stateestimation/PTAM/Relocaliser.cc
src/stateestimation/PTAM/ShiTomasi.cc
src/stateestimation/PTAM/SmallBlurryImage.cc
src/stateestimation/PTAM/Tracker.cc
)
set(STATEESTIMATION_HEADER_FILES
src/stateestimation/GLWindow2.h
src/stateestimation/GLWindowMenu.h
src/stateestimation/MouseKeyHandler.h
src/HelperFunctions.h
src/stateestimation/DroneKalmanFilter.h
src/stateestimation/Predictor.h
src/stateestimation/PTAMWrapper.h
src/stateestimation/MapView.h
src/stateestimation/EstimationNode.h
src/stateestimation/PTAM/ATANCamera.h
src/stateestimation/PTAM/Bundle.h
src/stateestimation/PTAM/customFixes.h
src/stateestimation/PTAM/HomographyInit.h
src/stateestimation/PTAM ...
Please don't post answers unless you are actually answering your own question. For everything else, either edit your original question to update it, or comments (but only for short bits). I've merged your last post into your question, but please keep it in mind next time.