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

Can I send a goal without quaternion? [closed]

asked 2015-07-31 04:55:09 -0500

Gork gravatar image


I'm pretty new to ROS, but I got a navigation stack working, now I want to send a goal without quaternion i.e. I don't care about the orientation of the robot, if he arrives on the coordinates I sent him to. Rotating the robot is somewhat time intensive and inaccurate. Is there an option to do this?

Thanks in advance, Gork

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Procópio
close date 2016-04-28 03:52:35.515157

2 Answers

Sort by » oldest newest most voted

answered 2016-03-19 06:52:13 -0500

Gamal Sallam gravatar image

Just answering this question for future inquiries.

You can do so by calculating the angle between the current position of the robot and the goal. Then convert this angle to quaternion and give it to send goal function. This way the robot will reach the goal without additional rotating after it arrives. Here is how:

    angle_to_goal=math.atan2(self.targety-self.currentY,  self.targetx-self.currentX)

    q_angle = tf.transformations.quaternion_from_euler(0, 0, angle_to_goal, axes='sxyz')

    q = Quaternion(*q_angle)

    self.goal = MoveBaseGoal()

    self.goal.target_pose.pose = Pose(Point(self.targetx, self.targety, 0.000), q)

    self.goal.target_pose.header.frame_id = 'map'

edit flag offensive delete link more

answered 2015-07-31 05:43:46 -0500

Porti77 gravatar image

You can create a new msg without quaternion, but you have to chage the code of nodes. Or you can send (0,0,0) (Roll, Pitch, Yaw) that in quaternion is (0,0,0,1)

edit flag offensive delete link more


But in this case, you send a specific orientation that the robot will try to reach.

NEngelhard gravatar image NEngelhard  ( 2015-07-31 06:21:14 -0500 )edit

It doesn't seem like it's possible to NOT send a specific orientation, my current workaround is to setup the navigation stack with a really high goal yaw tolerance for the local planner. But that seems rather sloppy.

Gork gravatar image Gork  ( 2015-07-31 06:46:26 -0500 )edit

Question Tools



Asked: 2015-07-31 04:55:09 -0500

Seen: 752 times

Last updated: Jul 31 '15