Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim the starting slash from frame_id #86

Open
wants to merge 5 commits into
base: noetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions axis_camera/launch/axis.launch
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<arg name="width" default="640" />
<arg name="height" default="480" />
<arg name="camera" default="1" />
<arg name="frame_id" default="$(arg camera_name)_camera_link"/>

<arg name="enable_ptz_teleop" default="0" />
<arg name="joy_topic" default="/bluetooth_teleop/joy" />
Expand All @@ -22,21 +23,23 @@
<arg name="fps" default="0" />

<group ns="$(arg camera_name)">
<param name="hostname" value="$(arg hostname)" />
<param name="username" value="$(arg username)" />
<param name="password" value="$(arg password)" />
<param name="use_encrypted_password" value="$(arg encrypt_password)" />
<param name="width" value="$(arg width)" />
<param name="height" value="$(arg height)" />
<param name="camera" value="$(arg camera)" />
<param name="frame_id" value="$(arg camera_name)_camera_link" />
<param name="wiper" value="$(arg enable_wiper)" />
<param name="defog" value="$(arg enable_defog)" />
<param name="ir" value="$(arg enable_ir)" />
<param name="fps" value="$(arg fps)" />
<param name="ptz" value="$(arg enable_ptz)" />

<node pkg="axis_camera" type="axis_camera_node" name="axis" />
<node pkg="axis_camera" type="axis_camera_node" name="axis">
<rosparam subst_value="true">
hostname: '$(arg hostname)'
username: '$(arg username)'
password: '$(arg password)'
use_encrypted_password: $(arg encrypt_password)
width: $(arg width)
height: $(arg height)
camera: $(arg camera)
frame_id: '$(arg frame_id)'
wiper: $(arg enable_wiper)
defog: $(arg enable_defog)
fps: $(arg fps)
ptz: $(arg enable_ptz)
</rosparam>
</node>

<node pkg="image_transport" type="republish" name="republish"
args="compressed theora" if="$(arg enable_theora)">
Expand Down
21 changes: 8 additions & 13 deletions axis_camera/nodes/axis_camera_node
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,15 @@ def updateArgs(arg_defaults):
'''
args = {}
for name, val in arg_defaults.items():
full_name = rospy.search_param(name)
if full_name is None:
args[name] = val
if rospy.has_param('~' + name):
args[name] = rospy.get_param('~' + name)
else:
args[name] = rospy.get_param(full_name, val)
# resolve frame_id with tf_prefix (unless already absolute)
if args['frame_id'][0] != '/': # not absolute?
tf_prefix = rospy.search_param('tf_prefix')
prefix_val = ''
if tf_prefix is not None: # prefix defined?
prefix_val = rospy.get_param(tf_prefix)
if prefix_val[0] != '/': # prefix not absolute?
prefix_val = '/' + prefix_val
args['frame_id'] = prefix_val + '/' + args['frame_id']
args[name] = rospy.get_param(name, val)
# resolve frame_id with tf_prefix
args['frame_id'] = args['frame_id'].lstrip('/')
tf_prefix = rospy.get_param('tf_prefix', '').lstrip('/')
if tf_prefix:
args['frame_id'] = tf_prefix + '/' + args['frame_id']
return(args)


Expand Down