diff --git a/MobileRobot/ObjectTrack/objTracking b/MobileRobot/ObjectTrack/objTracking index 95b977fdf23da0c52090df03e227de7b52133838..69f738260ef4ea80975332f1c3f4399b12d2df7f 100755 Binary files a/MobileRobot/ObjectTrack/objTracking and b/MobileRobot/ObjectTrack/objTracking differ diff --git a/MobileRobot/ObjectTrack/objTracking.cpp b/MobileRobot/ObjectTrack/objTracking.cpp index 8c324f03f10a533e44232e170d3ded7a8bc7557f..70dc0433505b6c0289d868bdce6e542de37020d2 100644 --- a/MobileRobot/ObjectTrack/objTracking.cpp +++ b/MobileRobot/ObjectTrack/objTracking.cpp @@ -240,22 +240,23 @@ int main(int argc, char* argv[]) //video capture object to acquire webcam feed VideoCapture capture; + //open video stream from either webcam or biult-in camera + capture.open(1); // ******* 0 =built-in, 1 = webcam ******** + + // IP address for RobotlabWWW WLAN //const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; -// IP address for raw3_lund +/*// IP address for raw3_lund const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; if(!capture.open(vsa)) { std::cout << "Error opening video stream or file" << std::endl; return -1; } - - //open video stream from either webcam or biult-in camera -// capture.open(1); // ******* 0 =built-in, 1 = webcam ******** - // open the Video Stream IP camera... capture.open(vsa); +*/ //set height and width of capture frame capture.set(CV_CAP_PROP_FRAME_WIDTH, FRAME_WIDTH); diff --git a/MobileRobot/ObjectTrack/objTracking.cpp~ b/MobileRobot/ObjectTrack/objTracking.cpp~ index d55f9d5b7f82178a1e89bfd7d0b1a4f5f0d890a4..9259c3ca678fee51a5fc51e9e39ccaa9511424c3 100644 --- a/MobileRobot/ObjectTrack/objTracking.cpp~ +++ b/MobileRobot/ObjectTrack/objTracking.cpp~ @@ -240,10 +240,14 @@ int main(int argc, char* argv[]) //video capture object to acquire webcam feed VideoCapture capture; + //open video stream from either webcam or biult-in camera + capture.open(1); // ******* 0 =built-in, 1 = webcam ******** + + // IP address for RobotlabWWW WLAN //const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; -// IP address for robotlab WLAN +/*// IP address for raw3_lund const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; if(!capture.open(vsa)) { @@ -251,11 +255,10 @@ const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; return -1; } - //open video stream from either webcam or biult-in camera -// capture.open(1); // ******* 0 =built-in, 1 = webcam ******** // open the Video Stream IP camera... capture.open(vsa); +*/ //set height and width of capture frame capture.set(CV_CAP_PROP_FRAME_WIDTH, FRAME_WIDTH); diff --git a/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp b/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp index 4dcfa43e16072489f1b1193668f4e335e8bc2092..bda44520f3d4079c39622b75f14a048ca8de1b80 100644 --- a/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp +++ b/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp @@ -226,7 +226,7 @@ void ObjectDetector::trackObject(int &x, int &y, Mat threshold, Mat &cameraFeed) { putText(cameraFeed, "Marker found!", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2); drawObject(x, y, cameraFeed); - CreateMarker(x,y,0,Xcam,Ycam,Zcam); + CreateMarker(x,y,1,Xcam,Ycam,Zcam);// z value for pixel coordinate should not be 0. } } @@ -352,7 +352,7 @@ const std::string vsa = "http://192.168.0.101:8080/video?x.mjpeg"; void ObjectDetector::imageCallback(const sensor_msgs::ImageConstPtr& msg) { - transform.setOrigin( tf::Vector3(.25, 0, 0) ); + transform.setO rigin( tf::Vector3(.25, 0, 0) ); transform.setRotation( tf::Quaternion(0, 0, 0 , 1) ); time = msg->header.stamp; br.sendTransform(tf::StampedTransform(transform, (time - ros::Duration(135)) ,"/base_link", "camera")); diff --git a/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp~ b/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp~ index 94a651c3aec225e908198a4fe20a6b3759b7d6cf..d53354f7c1b44d553bc4526c5c4599bbb0715874 100644 --- a/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp~ +++ b/MobileRobot/cameraPubSub/camera/src/vspubsub.cpp~ @@ -226,7 +226,7 @@ void ObjectDetector::trackObject(int &x, int &y, Mat threshold, Mat &cameraFeed) { putText(cameraFeed, "Marker found!", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2); drawObject(x, y, cameraFeed); - CreateMarker(x,y,0,Xcam,Ycam,Zcam); + CreateMarker(x,y,1,Xcam,Ycam,Zcam); } } @@ -530,7 +530,5 @@ void ObjectDetector::CreateMarker(int inpX, int inpY, int inpZ, cout<< "]\n" <<endl; dock = new DockMarker(); - dock->MarkerStart(Pose3dX,Pose3dY,0); - - + dock->MarkerStart(Pose3dX,Pose3dY,0); } diff --git a/catkinPkg4ARMarker.txt b/catkinPkg4ARMarker.txt new file mode 100644 index 0000000000000000000000000000000000000000..af8fb7f0bf1f167b083af66151a7c19ffea6cd56 --- /dev/null +++ b/catkinPkg4ARMarker.txt @@ -0,0 +1,68 @@ +------ How to create a catkin package For AR Marker detection ------------ + + 1. create the pkg + + $ catkin_create_pkg <package name> [depend 1] [depend 2] [depend 3] + +2. $ catkin_make --source . + +to make build, devel and CMakeLists.txt file + +3. $ source ./devel/setup.bash + +4. To make sure u added the bash file to the source + $ roscd < name of the package> + +5. Try to modify "CMakeLists.txt" and "package.xml" +sth like this ... + +cmake_minimum_required(VERSION 2.8.3) +project(ros_aruco) + +## 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 + geometry_msgs + roscpp + rospy + std_msgs + tf + sensor_msgs + image_transport + cv_bridge +) + +SET(CMAKE_MODULE_PATH ${ARUCO_PATH}/lib/cmake ) +SET(ARUCO_INCLUDE_DIRS ${ARUCO_PATH}/include/aruco ) + +## System dependencies are found with CMake's conventions +find_package(aruco REQUIRED ) +find_package(OpenCV REQUIRED ) + +INCLUDE(FindPkgConfig) + +set(ROS_BUILD_TYPE Debug) + +include_directories( + ${catkin_INCLUDE_DIRS} + ${ARUCO_INCLUDE_DIRS} + ) +add_executable(ros_aruco src/ros_aruco.cpp) + +target_link_libraries(ros_aruco + ${catkin_LIBRARIES} + ${aruco_LIBS} + ) + + +6. for getting the addvantage of using Aruco package in catkin package + + + $ catkin_make --source . -DARUCO_PATH=/usr/local +Since include and cmake are saved in /usr/local. + +7. inside the package ... + $ cd /devel/lib/<name of pkg> + $ ls -l + $ ./name of the executable file