【问题标题】:Ros publisher not working with V-Rep after saving保存后 Ros 发布者不使用 V-Rep
【发布时间】:2014-08-11 22:48:27
【问题描述】:

我已经开始使用 V-Rep 来模拟一些机器人(最初是 Pioneers 和 quadrotor),但是当我尝试将它与 ROS 连接时遇到了问题。我试图从 RosTopicPublisherAndSubscriber.ttt 复制示例,它只在第一次工作,在我关闭它并再次加载后,它不再工作,我的代码实际上与示例相同,除了我使用 getPose 并且它是一个 Pioneer(V-Rep 附带的那个),这是我的代码:

if (simGetScriptExecutionCount()==0) then

    -- Check if the required plugin is there (libv_repExtRos.so or libv_repExtRos.dylib):
    local moduleName=0
    local moduleVersion=0
    local index=0
    local pluginNotFound=true
    while moduleName do
        moduleName,moduleVersion=simGetModuleName(index)
        if (moduleName=='Ros') then
            pluginNotFound=false
        end
        index=index+1
    end

    if (pluginNotFound) then

        simDisplayDialog('Error','ROS plugin was not found.&&nSimulation will not run properly',sim_dlgstyle_ok,false,nil,{0.8,0,0,0,0,0},{0.5,0,0,1,1,1})
    else

        -- Retrive the handle of the vision sensor we wish to stream:
        lHandle=simGetObjectHandle('Pioneer_p3dx')

        -- Now enable topic publishing and streaming of the vision sensor's data:
        topicName=simExtROS_enablePublisher('p3dx',1,simros_strmcmd_get_object_pose,lHandle,0,'')
        if (topicName == nil) then
            simDisplayDialog('Error','Nil',sim_dlgstyle_ok,false,nil,{0.8,0,0,0,0,0},{0.5,0,0,1,1,1})
        else
            simDisplayDialog('Error','Not Nil',sim_dlgstyle_ok,false,nil,{0.8,0,0,0,0,0},{0.5,0,0,1,1,1})
        end
        -- Retrive the handle of the passive vision sensor. We will use the passive vision sensor

    end
end

欢迎任何想法!提前致谢! PS:另外,如果有 1500 声望点的人可以创建 v-rep 标签,那就太好了!

【问题讨论】:

  • V-REP forums 现在可能是发布您的问题的更好地方
  • 是的,我也这样做了,我只是想看看我会先从哪里得到答案,但后来我完全忘记了。我已经解决了,所以我就在这里发布并关闭这个问题

标签: simulation ros publisher


【解决方案1】:

好的,V-REP 的人帮我解决了这个问题。所以基本上我应该使用参数作为 -1 而不是 0。

所以基本上,a 应该这样做

topicName=simExtROS_enablePublisher('p3dx',1,simros_strmcmd_get_object_pose,lHandle,-1,'')

而不是

topicName=simExtROS_enablePublisher('p3dx',1,simros_strmcmd_get_object_pose,lHandle,0,'')

【讨论】:

    猜你喜欢
    • 2021-09-13
    • 1970-01-01
    • 2021-07-28
    • 1970-01-01
    • 1970-01-01
    • 2022-08-09
    • 2019-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多