Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2203

How to implement a ROS + Morse Semantic Camera

$
0
0
Hi ROS community! :) I'm a pretty beginner in ROS and I'm trying to implement a [**semantic camera**](https://www.openrobots.org/morse/doc/1.2/user/sensors/semantic_camera.html) in ROS + Morse + Blender platform in order to get data from specific objects from Blender scenario. The problem is that we don't a lot of information documented or code as example to follow. I follow these documentation from Morse: [Semantic camera](https://www.openrobots.org/morse/doc/1.2/user/sensors/semantic_camera.html) and [SemanticCameraPublisher class](https://www.openrobots.org/morse/doc/1.2/user/code/morse.middleware.ros.html#morse.middleware.ros.semantic_camera.SemanticCameraPublisher). Both lists some parameters and also the code to consider on Morse Builder API, but I don't know how or where I could use them in my code. In builder.py code, I set : from morse.builder import * atrv = ATRV() #the robot atrv.translate(x=2.5, y=3.2, z=0.0) #starting location #adding a passive object table = PassiveObject('props/objects','SmallTable') table.setgraspable() table.translate(x=0, y=0, z=-5) table.properties(Object = True, Graspable = True, Label = "TABLE") #adding a semantic camera camera = SemanticCamera() atrv.append(camera) camera.translate(x=0.3, z=0.762) camera.add_interface('ros',topic='/camera') Then my goal is that ATVR robot needs to identify the table object, like this [article](http://airccse.com/jares/papers/1116jares01.pdf) does. In subscriber code, I've tried to define a msg function to print **get_local_data()**, but I don't know what object I need to declare from import, because the message is a String type (because rospy publishes the data of the semantic camera as JSON in a ROS String message). My current code is like that, but it is not working at all: import rospy from std_msgs.msg import String def callback_semcam(msg): reponse = String.get_local_data() tmp = reponse.result() print (tmp['visible_objects']) if __name__=='__main__': rospy.init_node("obstacle_check_node") rospy.Subscriber('/camera', String, callback_semcam) rospy.spin() # this will block untill you hit Ctrl+C When I run the code above, I get this error: [ERROR] [WallTime: 1524369527.637321] bad callback: Traceback (most recent call last): File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 720, in _invoke_callback cb(msg) File "obstacle_check.py", line 27, in callback_semcam reponse = String.get_local_data() AttributeError: type object 'String' has no attribute 'get_local_data' Any idea of what we need to take into account when we uses a semantic camera in ROS? P.S.: I use ROS Indigo.

Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>