Use arguments from roslaunch in python.
So I have created a roslaunch file as follows
<node pkg="listen" name="listen_node" type="listen.py" args="$ (arg mode)" output="screen">
So after running this launch file
roslaunch listen listen.launch mode:=dropping
I print sys.argv to check which arguments are passing, so it give me this list of arguments:
arguments = ['/home/user/ros_ws/devel/lib/listen/listen.py', '__name:=listen',
'__log:=/home/user/.ros/log/5d25e394-00b2-11ec-b895-c912d3f66a28/listen-2.log', '$' , '(arg' ,'mode)']
So it is only giving the argument name which I passed in launch file not the one I am using in CLI.
Can anyone please tell me how can I use the arguments inside python script?