]> defiant.homedns.org Git - ros_wild_thumper.git/commitdiff
added waypoint script
authorErik Andresen <erik@vontaene.de>
Sun, 19 Jul 2015 18:27:20 +0000 (20:27 +0200)
committerErik Andresen <erik@vontaene.de>
Sun, 19 Jul 2015 18:27:20 +0000 (20:27 +0200)
launch/move_base.launch
scripts/waypoint.py [new file with mode: 0755]

index 47c23694173cc5818eb6e64947753427b95dfc14..b6924bd364480ab432a1b215be34584ce336c4ea 100644 (file)
@@ -23,7 +23,7 @@
                <param name="odom_frame" value="odom"/>
        </node>
 
-       <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen" unless="$(arg slam_gmapping)">
+       <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
                <rosparam file="$(find wild_thumper)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
                <rosparam file="$(find wild_thumper)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
                <rosparam file="$(find wild_thumper)/config/global_costmap_params.yaml" command="load" />
diff --git a/scripts/waypoint.py b/scripts/waypoint.py
new file mode 100755 (executable)
index 0000000..ac82b36
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# -*- coding: iso-8859-15 -*-
+
+import rospy
+import actionlib
+from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
+from actionlib_msgs.msg import GoalStatus
+
+class Waypoint:
+       def __init__(self):
+               rospy.init_node('waypoint')
+               self.move_base = actionlib.SimpleActionClient("move_base", MoveBaseAction)
+               while not self.move_base.wait_for_server(rospy.Duration(5)):
+                       rospy.loginfo("Waiting for the move_base action server to come up")
+
+       def send_goal(self):
+               goal = MoveBaseGoal()
+
+               # we'll send a goal to the robot to move 1 meter forward
+               goal.target_pose.header.frame_id = "base_footprint"
+               goal.target_pose.header.stamp = rospy.Time.now()
+
+               goal.target_pose.pose.position.x = 1.0;
+               goal.target_pose.pose.orientation.w = 1.0;
+
+               self.move_base.send_goal(goal)
+
+               self.move_base.wait_for_result()
+
+               if self.move_base.get_state() == GoalStatus.SUCCEEDED:
+                       rospy.loginfo("The base moved 1 meter forward")
+               else:
+                       rospy.logerr("The base failed to move forward 1 meter")
+
+if __name__ == "__main__":
+       p = Waypoint()
+       p.send_goal()