Reference Frame Pychrono

28 views
Skip to first unread message

Declan Mulroy

unread,
Mar 12, 2020, 6:49:58 PM3/12/20
to ProjectChrono


Hello, 

I am trying to rotate a local coordinate from of a body. The code is attatched below. I am recieving an error and it is saying I am adding to much to the function SetCoord(). The error is also attatched. 
Does anyone know how I can rotatate a local frame about the y axis by a specified angle theta. 


Thank you in advanced, 

Declan Mulroy


    # Create bots
    bot = chrono.ChBody()
    bot = chrono.ChBodyEasyCylinder(diameter / 2, height, rowr)
    bot.SetPos(chrono.ChVectorD(x, y, z))
    vector=chrono.ChVectorD(0,0,0)
    my_frame = chrono.ChFrameD(vector,chrono.Q_from_AngAxis(theta, chrono.ChVectorD(0, 1, 0)))
    bot.SetCoord(my_frame)
    # rotate them
    rotation1 = chrono.ChQuaternionD()
    rotation1.Q_from_AngAxis(-theta, chrono.ChVectorD(0, 1, 0));  
    bot.SetRot(rotation1)




 ERROR I RECIEVE
TypeError: Wrong number or type of arguments for overloaded function 'ChFrameD_SetCoord'.
  Possible C/C++ prototypes are:
    chrono::ChFrame< double >::SetCoord(chrono::ChCoordsys< double > const &)
    chrono::ChFrame< double >::SetCoord(chrono::ChVector< double > const &,chrono::ChQuaternion< double > const &)

Simone Benatti

unread,
Mar 13, 2020, 7:12:35 AM3/13/20
to ProjectChrono
Hi Declan,
This happens because SetCoord expects a coordinate system (ChCoordsys) not a frame. 
(Look at possible C++ prototypes mentioned in the error)
This works:

my_CS = chrono.ChCoordsysD(vector,chrono.Q_from_AngAxis(theta, chrono.ChVectorD(0, 1, 0) ) )
bot
.SetCoord(my_CS)



Simone
Reply all
Reply to author
Forward
0 new messages