Skip to content

Commit

Permalink
Modified CMakeLists.txt to remove position_base.cpp, still causing is…
Browse files Browse the repository at this point in the history
…sues in compiling. Also update osgviewer.cpp and .hpp for the new drawlinelist function.
  • Loading branch information
OdellDotson committed Feb 7, 2015
1 parent 80f25aa commit 345e814
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
7 changes: 1 addition & 6 deletions cpp_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions python_examples/arm_to_joint_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 12 additions & 2 deletions src/osgviewer/osgviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ KinBodyGroup* osgNodeFromKinBody(const KinBody& body) {
KinBodyGroup* group = new KinBodyGroup;
const vector<KinBody::LinkPtr>& 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]);
Expand Down Expand Up @@ -371,6 +371,10 @@ class OsgGraphHandle : public OpenRAVE::GraphHandle {
~OsgGraphHandle() {
parent->removeChild(node);
}
void SetTransform(const RaveTransform<float>& t){
//Still needs to be implemented
return;
}
};

KinBodyGroup* GetOsgGroup(KinBody& body) {
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions src/osgviewer/osgviewer.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#ifndef OSGVIEWER_HPP
#define OSGVIEWER_HPP

/*** INCLUDE FILES ***/

#pragma once
#include <openrave/openrave.h>
#include <osg/Geometry>
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -80,3 +86,5 @@ typedef boost::shared_ptr<OSGViewer> OSGViewerPtr;

void TRAJOPT_API SetColor(OpenRAVE::GraphHandlePtr handle, const osg::Vec4& color);
void TRAJOPT_API SetTransparency(OpenRAVE::GraphHandlePtr handle, float alpha);

#endif // OSGVIEWER_HPP

0 comments on commit 345e814

Please sign in to comment.