Ask Your Question
0

Visualize collada file on rviz [closed]

asked 2016-03-07 00:16:14 -0600

swethmandava gravatar image

updated 2016-03-13 03:26:49 -0600

I exported a collada file through sketch up but am unable to figure out what the problem is. Here is my code! Status on Rviz is okay but cannot see any display! Please help

#!/usr/bin/env python
import rospy
from visualization_msgs.msg import Marker

marker = Marker()
marker.header.frame_id = "/surface"
marker.header.stamp = rospy.Time()
marker.ns = "primitive_surfaces"
marker.id = 0
marker.type = marker.MESH_RESOURCE
marker.action = marker.ADD
marker.pose.position.x = 0
marker.pose.position.y = 0
marker.pose.position.z = 0
marker.pose.orientation.x = 0.0
marker.pose.orientation.y = 0.0
marker.pose.orientation.z = 0.0
marker.pose.orientation.w = 1.0
marker.scale.x = 1
marker.scale.y = 1
marker.scale.z = 1
marker.color.a = 1.0
marker.color.r = 0.0
marker.color.g = 1.0
marker.color.b = 0.0
marker.mesh_resource = "file:///home/swethmandava/catkin_ws/src/planning_inspection/planning_inspection_ros/nodes
/cuboid.dae";
pub = rospy.Publisher('surface', Marker, queue_size=1)
rospy.init_node('vis_surface')
rate = rospy.Rate(60)
while not rospy.is_shutdown():
  pub.publish(marker)
  rate.sleep()

Edit: Included rviz screenshot and frame information

image description

this is my tf frame:

#!/usr/bin/env python 
import roslib
roslib.load_manifest('planning_inspection_ros')
import rospy
import tf
if __name__ == '__main__':
    rospy.init_node('tf_broadcaster')
    br = tf.TransformBroadcaster()
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        br.sendTransform((0.0,0.0,0.0), (0.0,0.0,0.0,1.0), rospy.Time.now(),"map", "surface")
        rate.sleep()
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by swethmandava
close date 2016-03-08 02:41:52.957403

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-03-07 01:30:30 -0600

ahendrix gravatar image

Your marker type is set to SPHERE. You should probably set it to MESH_RESOURCE.

edit flag offensive delete link more

Comments

Also: make sure you have the scaling right: RViz (ROS) uses meters, not millimeters.

gvdhoorn gravatar imagegvdhoorn ( 2016-03-07 01:50:42 -0600 )edit

@ahendrix I made the change, sorry I was trying everything. Originally it was mesh_resource but it doesn't seem to work either. @gvdhoorn yes ofcourse

swethmandava gravatar imageswethmandava ( 2016-03-07 02:23:16 -0600 )edit

I see two other potential issues here: (1) your publisher only publishes once, at startup. Subscribers may not be connected yet, and (2): do you have the correct fixed frame selected in rviz?

ahendrix gravatar imageahendrix ( 2016-03-07 12:13:46 -0600 )edit

A screenshot of rviz would be very helpful in debugging.

ahendrix gravatar imageahendrix ( 2016-03-07 12:14:03 -0600 )edit

Added the info @ahendrix

swethmandava gravatar imageswethmandava ( 2016-03-07 23:43:14 -0600 )edit

From your screenshot, my best guess is that rviz isn't receiving your message, because you publish immediately after you create the publisher, and the subscriber isn't connected yet. You may want to try publishing continuously or using a latched topic.

ahendrix gravatar imageahendrix ( 2016-03-08 00:20:56 -0600 )edit
1

Thank you so much @ahendrix I think the problem seems to be with my sketchup file. I downloaded another collada file off the internet and that seems to work!

swethmandava gravatar imageswethmandava ( 2016-03-08 02:41:08 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-07 00:16:14 -0600

Seen: 397 times

Last updated: Mar 13 '16