Skip to content

Commit

Permalink
some code refactoring aimed to have obstacles.cpp as a common file in…
Browse files Browse the repository at this point in the history
… navLib

added device simpleVelocityNavigationWithLaser
  • Loading branch information
randaz81 committed Jun 27, 2019
1 parent eb4b6cb commit 2c28645
Show file tree
Hide file tree
Showing 13 changed files with 341 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@

<module>
<name>yarpdev</name>
<parameters>--device Rangefinder2DWrapper --subdevice fakeLaser --period 10 --name /ikart/laser:o --test use_mapfile --map_file C:\\software\\maps\\map_test.map</parameters>
<parameters>--device Rangefinder2DWrapper --subdevice fakeLaser --period 10 --name /robot_2wheels/laser:o --test use_mapfile --map_file C:\\software\\maps\\map_test.map</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device navigation2DServer --subdevice simpleVelocityNavigation --context simpleVelocityNavigationExamples --from robotGoto_robot_2wheels.ini</parameters>
<parameters>--device navigation2DServer --subdevice simpleVelocityNavigation --context simpleVelocityNavigationExamples --from simpleVelocityControl.ini</parameters>
<node>console</node>
</module>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<application>
<name>simpleVelocityNavigation (with Laser) EXAMPLE2</name>

<dependencies>
</dependencies>

<module>
<name>yarpdev</name>
<parameters>--device transformServer --ROS "(enable_ros_publisher 0)" "(enable_ros_subscriber 0)"</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device fakeMotionControl --name /robot_2wheels/mobile_base --GENERAL::Joints 2</parameters>
<node>console</node>
</module>

<module>
<name>baseControl</name>
<parameters>--context baseControl_SIM --from robot_2wheels.ini --skip_robot_interface_check</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device localization2DServer --subdevice odomLocalizer --context simpleVelocityNavigationExamples --from localizationServer.ini</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device map2DServer --mapCollectionContext mapsExample</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device Rangefinder2DWrapper --subdevice fakeLaser --period 10 --name /robot_2wheels/laser:o --test use_mapfile --map_file C:\\software\\maps\\map_test.map</parameters>
<node>console</node>
</module>

<module>
<name>yarpdev</name>
<parameters>--device navigation2DServer --subdevice simpleVelocityNavigationWithLaser --context simpleVelocityNavigationExamples --from simpleVelocityControl.ini</parameters>
<node>console</node>
</module>

<connection>
<from>/simpleVelocityNavigation/control:o</from>
<to>/baseControl/control:i</to>
<protocol>udp</protocol>
</connection>

<connection>
<from>/baseControl/odometry:o</from>
<to>/fakeLaser/location:i</to>
<protocol>tcp</protocol>
</connection>

</application>
7 changes: 5 additions & 2 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ set(PROJECT_NAME navigation_lib)
set(LIBRARY_TARGET_NAME ${PROJECT_NAME})

set(${LIBRARY_TARGET_NAME}_SRC
movable_localization_device/movable_localization_device.cpp)
movable_localization_device/movable_localization_device.cpp
obstacle_detection_avoidance/obstacles.cpp)


set(${LIBRARY_TARGET_NAME}_HDR
movable_localization_device/movable_localization_device.h
include/navigation_defines.h)
include/navigation_defines.h
obstacle_detection_avoidance/obstacles.h)

add_library(${LIBRARY_TARGET_NAME} ${${LIBRARY_TARGET_NAME}_SRC} ${${LIBRARY_TARGET_NAME}_HDR})
add_library(${PROJECT_NAME}::${LIBRARY_TARGET_NAME} ALIAS ${LIBRARY_TARGET_NAME})
Expand All @@ -22,6 +24,7 @@ set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES VERSION 0}
PUBLIC_HEADER "${${LIBRARY_TARGET_NAME}_HDR}")

target_include_directories(${LIBRARY_TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/movable_localization_device>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/obstacle_detection_avoidance>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
#include <yarp/dev/INavigation2D.h>
#include <string>
#include <math.h>
#include <yarp/rosmsg/visualization_msgs/MarkerArray.h>
#include <yarp/rosmsg/geometry_msgs/PoseStamped.h>
#include <yarp/rosmsg/nav_msgs/Path.h>
//#include <yarp/rosmsg/visualization_msgs/MarkerArray.h>
//#include <yarp/rosmsg/geometry_msgs/PoseStamped.h>
//#include <yarp/rosmsg/nav_msgs/Path.h>

using namespace std;
using namespace yarp::os;
using namespace yarp::dev;

typedef yarp::os::Subscriber<yarp::rosmsg::geometry_msgs::PoseStamped> rosGoalSubscriber;
typedef yarp::os::Publisher<yarp::rosmsg::geometry_msgs::PoseStamped> rosGoalPublisher;
typedef yarp::os::Publisher<yarp::rosmsg::nav_msgs::Path> rosPathPublisher;
//typedef yarp::os::Subscriber<yarp::rosmsg::geometry_msgs::PoseStamped> rosGoalSubscriber;
//typedef yarp::os::Publisher<yarp::rosmsg::geometry_msgs::PoseStamped> rosGoalPublisher;
//typedef yarp::os::Publisher<yarp::rosmsg::nav_msgs::Path> rosPathPublisher;

class obstacles_class
{
Expand Down
1 change: 1 addition & 0 deletions src/navigationDevices/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ add_subdirectory(robotGotoDevice)
add_subdirectory(robotPathPlannerDevice)
add_subdirectory(rosNavigator)
add_subdirectory(simpleVelocityNavigation)
add_subdirectory(simpleVelocityNavigationWithLaser)
5 changes: 3 additions & 2 deletions src/navigationDevices/robotGotoDevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ yarp_prepare_plugin(robotGotoDev

set(CMAKE_INCLUDE_CURRENT_DIR ON)

yarp_add_plugin(robotGotoDev robotGotoDev.h robotGotoDev.cpp robotGotoCtrl.h robotGotoCtrl.cpp obstacles.h obstacles.cpp )
yarp_add_plugin(robotGotoDev robotGotoDev.h robotGotoDev.cpp robotGotoCtrl.h robotGotoCtrl.cpp)

target_link_libraries(robotGotoDev YARP::YARP_OS
YARP::YARP_sig
YARP::YARP_dev
YARP::YARP_math
YARP::YARP_rosmsg)
YARP::YARP_rosmsg
navigation_lib)


yarp_install(TARGETS robotGotoDev
Expand Down
2 changes: 1 addition & 1 deletion src/navigationDevices/robotGotoDevice/robotGotoCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <yarp/rosmsg/visualization_msgs/MarkerArray.h>
#include <yarp/rosmsg/geometry_msgs/PoseStamped.h>
#include <yarp/rosmsg/nav_msgs/Path.h>
#include "obstacles.h"
#include <obstacles.h>

using namespace std;
using namespace yarp::os;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
/*
* Copyright (C)2018 ICub Facility - Istituto Italiano di Tecnologia
* Author: Marco Randazzo
* email: [email protected]
* website: www.robotcub.org
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* later version published by the Free Software Foundation.
*
* A copy of the license can be found at
* http://www.robotcub.org/icub/license/gpl.txt
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details
• Copyright (C) 2019 Istituto Italiano di Tecnologia (IIT)
• All rights reserved.
• This software may be modified and distributed under the terms of the
• GPL-2+ license. See the accompanying LICENSE file for details.
*/

#include <yarp/os/LogStream.h>
Expand Down Expand Up @@ -133,19 +123,19 @@ void simpleVelocityNavigation::send_command(control_type control_data)

bool simpleVelocityNavigation::gotoTargetByAbsoluteLocation(yarp::dev::Map2DLocation loc)
{
yError() << "gotoTargetByAbsoluteLocation() Not implemented by simpleVelocityNavigation";
yError() << "gotoTargetByAbsoluteLocation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::gotoTargetByRelativeLocation(double x, double y)
{
yError() << "gotoTargetByRelativeLocation() Not implemented by simpleVelocityNavigation";
yError() << "gotoTargetByRelativeLocation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::gotoTargetByRelativeLocation(double x, double y, double theta)
{
yError() << "gotoTargetByRelativeLocation() Not implemented by simpleVelocityNavigation";
yError() << "gotoTargetByRelativeLocation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

Expand All @@ -167,54 +157,54 @@ bool simpleVelocityNavigation::getNavigationStatus(yarp::dev::NavigationStatusEn

bool simpleVelocityNavigation::stopNavigation()
{
yError() << "stopNavigation() Not implemented by simpleVelocityNavigation";
yError() << "stopNavigation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::getAbsoluteLocationOfCurrentTarget(yarp::dev::Map2DLocation& target)
{
yError() << "getAbsoluteLocationOfCurrentTarget() Not implemented by simpleVelocityNavigation";
yError() << "getAbsoluteLocationOfCurrentTarget() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::getRelativeLocationOfCurrentTarget(double& x, double& y, double& theta)
{
yError() << "getRelativeLocationOfCurrentTarget() Not implemented by simpleVelocityNavigation";
yError() << "getRelativeLocationOfCurrentTarget() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::getAllNavigationWaypoints(std::vector<yarp::dev::Map2DLocation>& waypoints)
{
yError() << "getAllNavigationWaypoints() Not implemented by simpleVelocityNavigation";
yError() << "getAllNavigationWaypoints() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::getCurrentNavigationWaypoint(yarp::dev::Map2DLocation& curr_waypoint)
{
yError() << "getCurrentNavigationWaypoint() Not implemented by simpleVelocityNavigation";
yError() << "getCurrentNavigationWaypoint() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::suspendNavigation(double time)
{
yError() << "suspendNavigation() Not implemented by simpleVelocityNavigation";
yError() << "suspendNavigation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::resumeNavigation()
{
yError() << "resumeNavigation() Not implemented by simpleVelocityNavigation";
yError() << "resumeNavigation() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::recomputeCurrentNavigationPath()
{
yError() << "recomputeCurrentNavigationPath() Not implemented by simpleVelocityNavigation";
yError() << "recomputeCurrentNavigationPath() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}

bool simpleVelocityNavigation::getCurrentNavigationMap(yarp::dev::NavigationMapTypeEnum map_type, yarp::dev::MapGrid2D& map)
{
yError() << "getCurrentNavigationMap() Not implemented by simpleVelocityNavigation";
yError() << "getCurrentNavigationMap() Not implemented by " << m_localName;
return NOT_IMPLEMENTED;
}
Loading

0 comments on commit 2c28645

Please sign in to comment.