I know of at least two existing packages that could provide the functionality that you want :
Carrot Planner will move your robot straight to the goal position and stop it in front of any obstacle.
I quote from their wiki page:
The planner takes a goal point from an
external user, checks if the
user-specified goal is in an obstacle,
and if it is, it walks back along the
vector between the user-specified goal
and the robot until a goal point that
is not in an obstacle is found. It
then passes this goal point on as a
plan to a local planner or controller.
In this way, the carrot planner allows
the robot to get as close to a
user-specified goal point as possible.
To test it you just have to add the following code to the launch file where you start move_base:
<param name="base_global_planner" value="carrot_planner/CarrotPlanner" />
This is an exemplary launch file:
<?xml version="1.0"?>
<launch>
<!-- Start move_base (nav stack) node and load config files -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find your_pkg)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find your_pkg)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find your_pkg)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find your_pkg)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find your_pkg)/config/base_local_planner_params.yaml" command="load" />
<!-- Set the global planner: -->
<param name="base_global_planner" value="carrot_planner/CarrotPlanner" />
</node>
</launch>
The second option I know, the asr_navfn package, is also a global planner that can navigate your robot to the closest free space if the desired destination is in an obstacle. The main benefit is that it is not limited to a stright line path, as in Carrot Planner.
The image on their wiki page is pretty self-explanatory:
Hope this helps!