diff --git a/cpp_examples/CMakeLists.txt b/cpp_examples/CMakeLists.txt index 5486a6be..bb05ee81 100644 --- a/cpp_examples/CMakeLists.txt +++ b/cpp_examples/CMakeLists.txt @@ -31,9 +31,4 @@ target_link_libraries(arm_to_cart_target ${OpenRAVE_BOTH_LIBRARIES} sco utils js add_executable(arm_to_joint_target arm_to_joint_target.cpp atlas_utils.cpp) set_target_properties(arm_to_joint_target PROPERTIES COMPILE_FLAGS "-std=c++0x") -target_link_libraries(arm_to_joint_target ${OpenRAVE_BOTH_LIBRARIES} ${Boost_LIBRARIES} sco utils json osgviewer trajopt) - -add_executable(position_base position_base.cpp atlas_utils.cpp) -set_target_properties(position_base PROPERTIES COMPILE_FLAGS "-std=c++0x") -target_link_libraries(position_base ${OpenRAVE_BOTH_LIBRARIES} ${Boost_LIBRARIES} sco utils json osgviewer trajopt) - +target_link_libraries(arm_to_joint_target ${OpenRAVE_BOTH_LIBRARIES} ${Boost_LIBRARIES} sco utils json osgviewer trajopt) \ No newline at end of file diff --git a/python_examples/arm_to_joint_target.py b/python_examples/arm_to_joint_target.py index c53c5401..3b82fa5c 100644 --- a/python_examples/arm_to_joint_target.py +++ b/python_examples/arm_to_joint_target.py @@ -31,8 +31,7 @@ "costs" : [ { "type" : "joint_vel", # joint-space velocity cost - "params": {"coeffs" : [1]} # a list of length one is automatically expanded to a list of length n_dofs - # also valid: [1.9, 2, 3, 4, 5, 5, 4, 3, 2, 1] + "params": {"coeffs" : [1]} # a list of length one is automatically expanded to a list of length n_dofs. also valid: [1.9, 2, 3, 4, 5, 5, 4, 3, 2, 1] }, { "type" : "collision", diff --git a/src/osgviewer/osgviewer.cpp b/src/osgviewer/osgviewer.cpp index b72ca1bc..f532c4ff 100644 --- a/src/osgviewer/osgviewer.cpp +++ b/src/osgviewer/osgviewer.cpp @@ -188,7 +188,7 @@ KinBodyGroup* osgNodeFromKinBody(const KinBody& body) { KinBodyGroup* group = new KinBodyGroup; const vector& links = body.GetLinks(); for (int i=0; i < links.size(); ++i) { - if (links[i]->GetGeometries().size() > 0) { + if (links[i]->GetGeometries().size() > 0 && links[i]->IsEnabled()==true) { MatrixTransform* link_node = osgNodeFromLink(*links[i]); group->addChild(link_node); group->links.push_back(links[i]); @@ -371,6 +371,10 @@ class OsgGraphHandle : public OpenRAVE::GraphHandle { ~OsgGraphHandle() { parent->removeChild(node); } + void SetTransform(const RaveTransform& t){ + //Still needs to be implemented + return; + } }; KinBodyGroup* GetOsgGroup(KinBody& body) { @@ -457,7 +461,8 @@ OSGViewer::OSGViewer(EnvironmentBasePtr env) : ViewerBase(env), m_idling(false) m_viewer.realize(); m_cam = m_viewer.getCamera(); m_handler = new EventHandler; - m_viewer.setCameraManipulator(m_handler.get()); + m_handler->setHomePosition(Vec3f(3,3,2), Vec3f(0,0,1), Vec3f(0,0,1)); + m_viewer.setCameraManipulator(m_handler.get(),true); AddLights(m_root); m_cam->setClearColor(osg::Vec4(1,1,1,1)); @@ -809,6 +814,11 @@ OpenRAVE::GraphHandlePtr OSGViewer::_drawlines(osg::PrimitiveSet::Mode mode, co OpenRAVE::GraphHandlePtr OSGViewer::drawlinestrip(const float *ppoints, int numPoints, int stride, float fwidth, const RaveVectorf &color) { return _drawlines(osg::PrimitiveSet::LINE_STRIP, ppoints, numPoints, stride, fwidth, color); } +OpenRAVE::GraphHandlePtr OSGViewer::drawlinestrip(const float* ppoints, int numPoints, int stride, float fwidth, const float* colors) { + //Place holder function, correct behavior still needs to be implemented + return _drawlines(osg::PrimitiveSet::LINE_STRIP, ppoints, numPoints, stride, fwidth, RaveVectorf(1,0,0,1)); +} + OpenRAVE::GraphHandlePtr OSGViewer::drawlinelist(const float *ppoints, int numPoints, int stride, float fwidth, const RaveVectorf &color) { return _drawlines(osg::PrimitiveSet::LINES, ppoints, numPoints, stride, fwidth, color); } diff --git a/src/osgviewer/osgviewer.hpp b/src/osgviewer/osgviewer.hpp index 3aa23613..7d74e3a3 100644 --- a/src/osgviewer/osgviewer.hpp +++ b/src/osgviewer/osgviewer.hpp @@ -1,3 +1,8 @@ +#ifndef OSGVIEWER_HPP +#define OSGVIEWER_HPP + +/*** INCLUDE FILES ***/ + #pragma once #include #include @@ -40,6 +45,7 @@ class TRAJOPT_API OSGViewer : public OpenRAVE::ViewerBase { OpenRAVE::GraphHandlePtr plot3(const float* ppoints, int numPoints, int stride, float pointsize, const float* colors, int drawstyle=0, bool bhasalpha=false); OpenRAVE::GraphHandlePtr drawlinelist(const float *ppoints, int numPoints, int stride, float fwidth, const RaveVectorf &color); OpenRAVE::GraphHandlePtr drawlinestrip(const float *ppoints, int numPoints, int stride, float fwidth, const RaveVectorf &color); + OpenRAVE::GraphHandlePtr drawlinestrip(const float* ppoints, int numPoints, int stride, float fwidth, const float* colors); OpenRAVE::GraphHandlePtr _drawlines(osg::PrimitiveSet::Mode mode, const float *ppoints, int numPoints, int stride, float fwidth, const RaveVectorf &color); OpenRAVE::GraphHandlePtr drawtext(const std::string& text, float x, float y, float fontsize, const OpenRAVE::Vector& color); @@ -80,3 +86,5 @@ typedef boost::shared_ptr OSGViewerPtr; void TRAJOPT_API SetColor(OpenRAVE::GraphHandlePtr handle, const osg::Vec4& color); void TRAJOPT_API SetTransparency(OpenRAVE::GraphHandlePtr handle, float alpha); + +#endif // OSGVIEWER_HPP \ No newline at end of file