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

How to save wavepoints?

asked 2020-09-15 08:34:38 -0500

sree gravatar image

I am new to the ROS.Please help me out with the trouble. I am doing obstacle avoidance robot which self navigates and moves around the Room to given goals. I have used to wave points to give continues goals,so that it navigates continuously. I have some multiple questions : 1.How to save those wave points, so that I can need not give the goals wave points each and every time I run the program? https://www.theconstructsim.com/ros-qa-175-sending-goals-to-the-navigation-stack-using-waypoints/This the link referred for wave points .I am able navigate ,But I want to save all the wave points ,so that I can access as soon as I launch the file.How to do that Please helpme? 2. In this I created map and running the robot,it is avoiding obstacle by itself, Is it possible that in real life it will run as same? 3. If saving wave points is not possible , Please suggest me any method so that I can move robot to the multiple goals and save them ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-09-21 07:34:24 -0500

Weasfas gravatar image

updated 2020-09-23 11:10:06 -0500

Hi @sree,

I will do my best to answer properly all your questions.

  1. If you want to save all your goals at once and execute each sequentially you can use a move_base_msgs::MoveBaseGoal goal vector and store each goal in it. You also can read them as parameter from a yaml file with the ROS parameter server. Then in the code just perform a loop for each vector goal, waiting for result and resuming in the next step when the action server returns a success. Since the move_base is based on the actionlib paradigm you will be able to check goal status and success state in each moment, cancel goals and traverse the vector in the order you decide.
  2. Simulation are just approximations to real life. You can expect that you real robot is going to behave relatively equal than in the simulation but you need to understand that there are a lot of variables that are not present in the simulation and can variate the output in real life. For instance, sensor reading errors (that in simulation tend to be perfect), constrained movement (traversed floor or any mechanical problem the robot has), etc. For this reason you may end adjusting several params and configuration to suit not only your robot/sensor but also you environment.
  3. Hope solution 1. helps you with it.

Regards.

EDIT:

In order to give a use case for the approach 1 I will post a chunk of code.

Disclaimer: I am not an expert on using action_lib with python, the functioning is strictly different when comparing roscpp and rospy. There may be solutions that are better and more suitable in this environment, but as a simple example I think it would be good.

First of all, since you want to have a set of goals at once you can load them with a yaml file and parameter server, this can be a good points.yaml config file to parametrize all your goals:

point_list: [
  {x_pos: 1.0, y_pos: 1.0, z_pos: 0.0, w: 1.0},
  {x_pos: 2.0, y_pos: 2.0, z_pos: 0.0, w: 1.0},
  {x_pos: 3.0, y_pos: 3.0, z_pos: 0.0, w: 1.0},
  {x_pos: 4.0, y_pos: 4.0, z_pos: 0.0, w: 1.0}
]

Take into account that you can convert this param to a simple vector instead of a dictionary.

Second, I changed the code you linked a bit so I can iterate all the goal list, and then pass every goal to the move_base server to process:

#!/usr/bin/env python

# license removed for brevity

import rospy
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
import actionlib
from actionlib_msgs.msg import *

class GoForwardAvoid():
    def __init__(self):
        rospy.init_node('nav_test', anonymous=False)

        #what to do if shut down (e.g. ctrl + C or failure)
        rospy.on_shutdown(self.shutdown)

        self._point_list = rospy.get_param('/nav_test/point_list')
        self._sleep_timer = rospy.Rate(5.0)

    def spin(self):
        #tell the action client that we want to spin a thread by default
        self.move_base = actionlib ...
(more)
edit flag offensive delete link more

Comments

Thank you, I want different goal points to be given ,at the same time it should avoid obstacles,I am using Obstacle avoidinf and moving forward program to move turlebot and avoid obstacles. Can u help with the program so that I can give different target poses to turtlebot

sree gravatar image sree  ( 2020-09-23 08:30:49 -0500 )edit

What is the point of marking the answers as correct if you still do not know how to proceed. There is a different between asking for help and expecting someone to solve your problems (please do not take this statement bad, I just wanted you to know that you will need to cope with these kind of problems eventually and it would be better that you try to face them not expecting someone to solve the problem.). Having said that I posted an example based on the code you linked. This solution is using the approach I wrote in my answers. Hope this can solve your problem and give you food for thought. Regards.

Weasfas gravatar image Weasfas  ( 2020-09-23 11:10:10 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-09-15 08:34:38 -0500

Seen: 711 times

Last updated: Sep 23 '20