ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to define goal in RVIZ through python script

asked 2018-02-24 08:19:23 -0500

HassanM gravatar image

Hello,

I am working on turtlebot 3 and i am trying to derive goal for robot through python script so user dont need to direct navigation goal over again n again. I tried to view move_base topic it only retrieves result once, for instance i want to direct navigation goal once and should look for msg itself based on script.

Any help ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-02-24 08:50:30 -0500

yigit gravatar image

You can send navigation goals as follows:

from geometry_msgs.msg import Pose, Point, Quaternion

goal = MoveBaseGoal()
goal.target_pose.pose = Pose(Point(1.5, -4.85, 0), Quaternion(0.0, 0.0, 0.6, 0.77))
goal.target_pose.header.frame_id = "map" 
goal.target_pose.header.stamp = rospy.Time() 
self.sac.send_goal(goal, active_cb=self.active_callback, done_cb=self.done_callback, feedback_cb=self.feedback_callback)

You can define the callback functions, which you provide while sending the goal, as follows:

def done_callback(self):
     rospy.loginfo("done callback")

The rest is up to you.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-02-24 08:19:23 -0500

Seen: 1,260 times

Last updated: Feb 24 '18