_ConfigClient.py
Go to the documentation of this file.
1 # SPDX-License-Identifier: Apache-2.0
2 # Copyright (C) 2021 ifm electronic, gmbh
3 
4 """
5 Mimics (mostly) the `ifm3d config` command but communicates through the ROS
6 graph
7 """
8 
9 import json
10 import rospy
11 import sys
12 from ifm3d_ros_msgs.srv import Config
13 
14 SRV_TIMEOUT = 2.0 # seconds
15 SRV_NAME = "/ifm3d_ros_examples/camera/Config"
16 
17 class ConfigClient(object):
18 
19  def __init__(self):
20  rospy.init_node('ifm3d_config_client')
21 
22  def run(self):
23  j = json.load(sys.stdin)
24  rospy.wait_for_service(SRV_NAME, timeout=SRV_TIMEOUT)
25  proxy = rospy.ServiceProxy(SRV_NAME, Config)
26  resp = proxy(json.dumps(j))
27  if resp.status != 0:
28  print("Error: %s - %s" % (str(resp.status), resp.msg))
29 
30  return resp.status


ifm3d_ros_msgs
Author(s): CSR ifm sytron
autogenerated on Tue Feb 21 2023 03:13:24