Unable to show geometry in RWS for movable frames created at runtime

12 views
Skip to first unread message

Anders Bøgild - Robo[LAB]

unread,
Nov 4, 2009, 2:41:24 AM11/4/09
to RobWorkDevel
When defining a movable frame in the scene XML file i can view the
frame coordinate system using the 'Show/Remove Frame' option in the
TreeView plugin, and any drawable added to the movable frame can be
toggled on and off with the 'Enable' option also in the TreeView
plugin.

However when i create a movable frame in runtime (see code below) i
cannot get any graphics for that frame to show up in RWS, eventhough i
can see that the frame exists in TreeView.

Is there something i'm missing?

------ example ----

MovableFrame *newFrame = new MovableFrame("AndersFrame");
_workcell->getStateStructure()->addFrame(newFrame,_workcell-
>getWorldFrame());

// now this is VERY important, remember to update the RobWorkStudio
state
State newState = _workcell->getStateStructure()->getDefaultState();
getRobWorkStudio()->setState(newState);
....
//Find the frame and transformation -works fine
State state = _rws->getState();
MovableFrame* theFrame = dynamic_cast<MovableFrame*>(_workcell-
>findFrame("AndersFrame"));

Rotation3D<double> targetR(1,0,0,0,1,0,0,0,1);
Vector3D<double> targetP(0,0,0);
Transform3D<double> target(targetP,targetR);
theFrame->setTransform(target,state);
...
// Add a drawable 'hccell1' to the frame
//_drawer->addDrawableToFrame(_workcell->getWorldFrame(), hccell1); //
drawable shows up fine here
_drawer->addDrawableToFrame(theFrame, hccell1); // cannot see any
geometry

_rws->setState(_rws->getState());

Jimmy Alison Jørgensen

unread,
Nov 4, 2009, 5:19:40 AM11/4/09
to robwor...@googlegroups.com
Its a bit hard reading the code, perhaps its my MS editor but the line endings is somewhat of.

Could you send the entire file?

Best regards

Jimmy Alison Jørgensen
PhD Student, The Maersk Mc-Kinney Moller Institute

Tel. +45 6550 3548
Fax +45 6550 3681
Email jim...@mmmi.sdu.dk
Web http://www.mip.sdu.dk
Addr. Niels Bohrs Allé 1, DK-5230 Odense M, Denmark

UNIVERSITY OF SOUTHERN DENMARK
_______________________________________________________________
Campusvej 55 * DK-5230 * Odense M * Denmark * Tel. +45 6550 1000 * www.sdu.dk

Anders Bøgild - Robo[LAB]

unread,
Nov 4, 2009, 5:44:22 AM11/4/09
to RobWorkDevel
Actually the problem is solved now :-)

Lars-Peter pointed out that the last line:
_rws->setState(_rws->getState());

Should be:
_rws->setState(state);

where state is the state i use in setTransform a bit further up in the
code example.

Thanks for the quick response!
Reply all
Reply to author
Forward
0 new messages