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

Navigation on turtlebot3

asked 2022-01-07 05:57:44 -0500

Misrek gravatar image

updated 2022-02-13 16:50:47 -0500

lucasw gravatar image

Hi everyone, I would like to ask for help on navigation stack because I don't really understand how it works and how to use it. I have a turtlebot, a map (pgm and yaml file) and a python script I made that handles various data. In the script I need to start the navigation by setting the initial pose and the goal.... how can I do that? (the equivalent of the buttons "2d pose estimate" and "2d nav goal" in rviz when you launch turtlebot3_navigation.launch). Besides setting the poses, how do I start the navigation stack? I've followed the official turtlebot tutorial but honestly I didn't understand much about how the various launch files work. Can anyone help me/explain how to do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-01-07 07:54:01 -0500

ljaniec gravatar image

The equivalent code for initial pose estimate is there (ROS Answers), sending goal poses could be find there (YT video).

The best way to learn Navigation stack seems to be reading a lot of code on the GitHub - from official repositories and from example projects/demos (next to reading documentation, of course).

edit flag offensive delete link more

Comments

Thanks for the reply. I just read the links to set the initial pose estimate and I wrote a publisher who writes on the topic /initialpose.... but if I do rostopic echo /initialpose nothing is published.....

pub = rospy.Publisher('initialpose', PoseWithCovarianceStamped, queue_size=10)
initpose = PoseWithCovarianceStamped()
initpose.header.stamp = rospy.get_rostime()
initpose.header.frame_id = "map"
initpose.pose.pose.position.x = x
initpose.pose.pose.position.y = y
quaternion = get_quaternion(theta)
initpose.pose.pose.orientation.w = quaternion[0]
initpose.pose.pose.orientation.x = quaternion[1]
initpose.pose.pose.orientation.y = quaternion[2]
initpose.pose.pose.orientation.z = quaternion[3]
pub.publish(init_pose)
Misrek gravatar image Misrek  ( 2022-01-07 12:43:55 -0500 )edit
1

I solved it, it was enough to insert a sleep after the Publisher statement

Misrek gravatar image Misrek  ( 2022-01-08 04:15:01 -0500 )edit

@Misrek please accept @ljaniec answer if led you to the solution. You can accept by clicking on the check mark. Thank you

osilva gravatar image osilva  ( 2022-01-08 12:29:57 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-01-07 05:57:44 -0500

Seen: 521 times

Last updated: Jan 07 '22