Hello guys,
I am using openrave 0.9 with ROS fuerte on ubuntu 12.04. I want to display my environment using a server-client structure and for that I have writen a server using the code from this link: http://openrave.org/docs/latest_stable/coreapihtml/orloadviewer_8cpp-example.html I know that the environment loads correctly because I got theese debug messages: [kinbody.cpp:3816] _ComputeInternalInformation staubli in 0.016514s [kinbody.cpp:3816] _ComputeInternalInformation floorwalls in 0.000045s but does not show anything by screen, I mean does not open any new window with the loaded environment. this is the code of my server #include "ros/ros.h" #include "robot/planificador.h" #include "robot/openrave-core.h" //#include "robot/libopenrave.h" #include <vector> #include <cstring> #include <sstream> #include "robot/openrave/planningutils.h" #include "robot/orexample.h" #include <boost/thread/thread.hpp> #include <boost/bind.hpp> using namespace OpenRAVE; using namespace std; void SetViewer(EnvironmentBasePtr penv, const string& viewername) { ViewerBasePtr viewer = RaveCreateViewer(penv,viewername); BOOST_ASSERT(!!viewer); // attach it to the environment: penv->Add(viewer); // finally call the viewer's infinite loop (this is why a separate thread is needed) bool showgui = true; viewer->main(showgui); } bool calculo(robot::planificador::Request &req, robot::planificador::Response &res) { string scenefilename = "staubli.env.xml"; string viewername = "QtCoin"; RaveInitialize(true); EnvironmentBasePtr penv = RaveCreateEnvironment(); RaveSetDebugLevel(5); boost::thread thviewer(boost::bind(SetViewer,penv,viewername)); penv->Load(scenefilename); thviewer.join(); res.sal=0; return true; } int main(int argc, char **argv) { ros::init(argc, argv, "planificador_server"); ros::NodeHandle n; ros::ServiceServer service = n.advertiseService("calculo", calculo); ROS_INFO("Esperando coordenadas para mover robot."); ros::spin(); return 0; } Do you Know how can I solve this problem? |
Administrator
|
does the regular sample work for you? 2013/10/3 agussc <[hidden email]> Hello guys, ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ Openrave-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openrave-users |
Hi Rosen, thank for your quick answer.
yes it works fine. I have loaded my environment correctly in the following cases: 1- typing "openrave example.dae" 2- using the cppexample "./orloadviewer --scene example.env.xml qtcoin" 3- using the rosserver: "roslaunch openrave.launch; rosrun openraveros_tutorials loadscene" but I can't load it with my program. I think the problem is about the openrave thread or the openrave module textserver, and I don't know if I have missed something in my code, but I thought the function load() automaticaly initialize them, and if I must do it by hand I don't know which lines must be added. Thanks in advance. |
Free forum by Nabble | Edit this page |