0

Rosanswers logo

Hello, I don't know how to ask but I'll try. I want to add condition to my launch file. For example, I want to reduce the lidar angle from 180 degrees to 150 degrees when the destination is reached after the path is planned. How can I do that? Thank you for your help


Originally posted by SuleKayiran on ROS Answers with karma: 1 on 2021-09-06

Post score: 0

2 Answers2

0

Rosanswers logo

Have a look at this: roslaunch if condition

when the destination is reached after the path is planned.

<arg name="path_planned" default="true"/>

Condition True

<group if="$(arg path_planned)">
  <!-- stuff that will only be evaluated if path_planned is true -->
</group>

Condition False

<group unless="$(arg path_planned)">
<!-- stuff that will only be evaluated if path_planned is false -->
</group>

Now, path_planned = true when the destination is not reached and else it is false when the destination is reached.


Originally posted by Ranjit Kathiriya with karma: 1622 on 2021-09-06

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by SuleKayiran on 2021-09-06:
Thanks for your help. I will try your suggestion. Also, I have another question. After reducing it to 150 degrees, I will need to increase the angle I reduced to 150 degrees to 180 degrees before my robot can move autonomously while planning the path again. Can I apply your suggestion for 180 degrees and write it in the startup file again? @Ranjit Kathiriya

Comment by Ranjit Kathiriya on 2021-09-06:
I am sorry! I couldn't get your question.

Comment by SuleKayiran on 2021-10-05:
I'm sorry for the late reply. It started to make more sense to deal with cpp files in my question, I applied your suggestions, they helped, but I realized that I needed to do something different, I realized that what I really wanted was not to deal with the launch file. Thank you for your help. @Ranjit Kathiriya

Lucas Walter
  • 3,337
  • 1
  • 14
  • 19
0

Rosanswers logo

You should know that you are trying to use roslaunch in a way that is unusual. Typically ros nodes do not start and stop very much. Rather, the idea is that roslaunch starts all the important nodes at the beginning, and then the nodes wait quietly for work to do. I'm not saying your approach will not work, but you should expect slow performance if you dynamically execute roslaunch. A typical ros node does not start up very quickly - it might take a second or two; conversely a node that is waiting for work can react in 10 or 20 milliseconds.

I would implement the kind of change you want in an always-running ros node that monitors topics for activity it cares about.


Originally posted by Mike Scheutzow with karma: 4903 on 2021-09-06

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by SuleKayiran on 2021-09-07:
Thanks. This idea sounds smarter. I'll try to resolve it with nodes.