Hi Fernando,<br><br>my issue was this: the mathutils.Matrix<b>.transpose()</b> (beam.worldorientation.transpose(), line 11 ) doesn't return a new instance of Matrix, but rather it trasnposes the matrix itself, and returns None. <br>
As such, on line 11 the beam orientation is transposed, the operation returns None and the multiplication fails with and exception, and the rest of the script is ignored<br><br><span style="font-family: courier new,monospace;">rot = (beam.worldOrientation.transpose() * base.worldOrientation).to_euler()</span><br>
<span style="font-family: courier new,monospace;"> this ^ fails</span><br><br>On the Blender console I see:<br><span style="font-family: courier new,monospace;">Python script error - object 'Beam', controller 'Python Script#CONTR#1':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Traceback (most recent call last):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> File "joint_controller.py", line 11, in <module></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">TypeError: Matrix multiplication: not supported between 'NoneType' and 'mathutils.Matrix' types</span><br><br>So, here is what I did:<br><br><span style="font-family: courier new,monospace;">beam_rot = beam.worldOrientation.copy() # so that subsequent transpose() doesn't change the beam's real orientation</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">beam_rot.transpose()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">rot = (beam_rot * base.worldOrientation).to_euler()</span><br>
<span style="font-family: courier new,monospace;"></span><br>I have given it for granted this was a bug introduced by Blender's huge api change, but I'm not sure, I wanted to try it on an older Blender, but... hem, I don't know how to work with pre-2.5 :-)<br>
<br>Thank you again<br><br>Anna Chiara<br><br><br><br><div class="gmail_quote">On 10 June 2011 19:00, Fernando Garcia Bermudez <span dir="ltr"><<a href="mailto:fgb@eecs.berkeley.edu">fgb@eecs.berkeley.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Anna Chiara,<br><br>Can you provide more info on the issue/change? I'm using 2.57 and not seeing anything wrong, but I might be overlooking it. If you can send the changed script I can test it and update it on github for future users. Thanks,<br>
<font color="#888888">
<br clear="all">-- Fernando</font><div><div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Fri, Jun 10, 2011 at 02:56, Anna Chiara Bellini <span dir="ltr"><<a href="mailto:annachiara.bellini@gmail.com" target="_blank">annachiara.bellini@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ciao Fernando,<br>
I've been playing around with this for a while, and I think I got the hang of it, thank you :-)<br>I just had to change the script a little because the mathutils.Matrix api has changed in Blender 2.56 (namely: I had to copy() and then .transpose() the beam rotation Matrix), but it works very well. <br>
<br>I'm working on the linear springs now, and I'm planning to transform this in a Morse-style sensor, even though a few peculiarities will apply. <br><br>Thank you again for your kind help<br><font color="#888888"><br>
Anna Chiara Bellini</font><div><div></div><div><br>
<br><div class="gmail_quote">On 7 June 2011 17:40, Fernando Garcia Bermudez <span dir="ltr"><<a href="mailto:fgb@eecs.berkeley.edu" target="_blank">fgb@eecs.berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Since the e-mail below was being held due to a large attachment, I<br>
decided to re-post without it. You can grab the attachment from:<br>
<br>
<a href="http://github.com/fgb/passive_compliant_joint" target="_blank">http://github.com/fgb/passive_compliant_joint</a><br>
<br>
Thanks,<br>
<font color="#888888"><br>
-- Fernando<br>
</font><div><br>
On Mon, Jun 6, 2011 at 12:05, Fernando Garcia Bermudez<br>
<<a href="mailto:fgb@eecs.berkeley.edu" target="_blank">fgb@eecs.berkeley.edu</a>> wrote:<br>
> Anna,<br>
><br>
> I've constructed passive compliant joints in the past using a mixture<br>
> of rigid body joints and a python script controller, since there are<br>
> no generic spring constraints in Blender that I know of.<br>
><br>
> In a nutshell, I create a generic 6 DoF rigid body joint between two<br>
> bodies, disabling collisions between them. I then proceed to allow<br>
> only the rotations that the spring joint I'm envisioning has. I setup<br>
> rigid body physics for both bodies and then add some parameters to the<br>
> game property editor (spring constant, damping constant, and resting<br>
> position for the joint). Finally, I add an always sensor connected to<br>
> a python script which effectively controls the passive compliant<br>
> joint. The script implements torque feedback based on the game<br>
> property parameters. You could easily implement force feedback for a<br>
> linear spring joint in a similar way. For clarity, I'm including a<br>
> demonstration blend file.<br>
><br>
> As you can see, the forces/torques are available to you as part of the<br>
> simulation, but as Gilberto notes, they might not be very precise due<br>
> to Bullet's limitations.<br>
><br>
> I hope this helps you solve your issue. Let me know if you have any questions,<br>
><br>
> -- Fernando<br>
><br>
><br>
> On Mon, Jun 6, 2011 at 11:09, Anna Chiara Bellini<br>
> <<a href="mailto:annachiara.bellini@gmail.com" target="_blank">annachiara.bellini@gmail.com</a>> wrote:<br>
</div><div><div></div><div>>> Hello Gilberto,<br>
>><br>
>> I'll try to explain it better... I need to detect forces for two reasons:<br>
>><br>
>> 1 - our robot is an UAV, and as it flies, it will get in touch with objects<br>
>> and environment. On the robot I need to have a few force/torque sensors,<br>
>> that will tell me the force/torque applied in that spot, and then we combine<br>
>> the different values to get a resulting force that will get back to the user<br>
>> using a force-feedback device.<br>
>><br>
>> 2 - the robot features a grasp/manipulate tool, and I need to read the force<br>
>> applied on it.<br>
>><br>
>> Now, my first idea is this: if I model the sensor as a small pivoting<br>
>> damper, then I could read the position and pose of the damper to calculate<br>
>> force and torque... but this is just a very basic idea, I don't know if it's<br>
>> correct or if there are better ways. (Ideally, this should end up being a<br>
>> MORSE sensor, but that would be a second step, hence why I posted the<br>
>> question here instead on the morse mailing list)<br>
>><br>
>> I have also found this on the Bullet forum:<br>
>> <a href="http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=3637" target="_blank">http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=3637</a>, but<br>
>> I'm not understanding it completely, for instance I do not know what a<br>
>> "proxy" object is and how to set it up.<br>
>><br>
>> Hope this is clear enough :-)<br>
>><br>
>> You are saying that the Bullet engine is not extremely precise... can you<br>
>> tell me what are the limitations, or point me to a place where I can get<br>
>> more information?<br>
>><br>
>> Thank you again<br>
>><br>
>> Anna Chiara Bellini<br>
>><br>
>><br>
>> On 6 June 2011 18:09, Gilberto Echeverria <<a href="mailto:gilberto.echeverria@laas.fr" target="_blank">gilberto.echeverria@laas.fr</a>><br>
>> wrote:<br>
>>><br>
>>> Hello Anna Chiara,<br>
>>><br>
>>> For the moment, MORSE does not include this sort of force sensors in<br>
>>> joints. So far, the main developers of MORSE have not approached this sort<br>
>>> of simulation, so it remains an open area for development. However, maybe<br>
>>> other people in the Blender community may have worked on similar problems.<br>
>>><br>
>>> It should be possible to measure forces in Blender, but the physics engine<br>
>>> used by default (Bullet) is not extremely precise. It will depend on what<br>
>>> exactly you want to model.<br>
>>> If you can provide more details, we can give you a better insight on how<br>
>>> to deal with this kind of sensors.<br>
>>><br>
>>> Best regards,<br>
>>> Gilberto Echeverria<br>
>>><br>
>>> On 06/06/2011 04:16 PM, Anna Chiara Bellini wrote:<br>
>>><br>
>>> Dear all,<br>
>>><br>
>>> I am working on a robot simulation project ( <a href="http://www.airobots.eu/" target="_blank">http://www.airobots.eu/</a> )<br>
>>> with Blender and I am trying to do something which I'm sure someone else has<br>
>>> already done, so I'm asking for directions: I need to model passive<br>
>>> compliant joints and detect the forces acting on them. I guess that the way<br>
>>> is through Blender's rigid body joint constraint , possibly the<br>
>>> 6DofSpringConstraint, but I'm not really sure about it and I really don't<br>
>>> know which would be the best solution.<br>
>>><br>
>>> In our project, we are using MORSE for sensors/actuators/middleware, so if<br>
>>> anyone had a MORSE-specific solution or suggestion, that would be great.<br>
>>><br>
>>> Any ideas?<br>
>>><br>
>>> Thank you in advance<br>
>>><br>
>>> Anna Chiara Bellini<br>
>>><br>
>>> _______________________________________________<br>
>>> Robotics mailing list<br>
>>> <a href="mailto:Robotics@blender.org" target="_blank">Robotics@blender.org</a><br>
>>> <a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
>>><br>
>>><br>
>>> --<br>
>>> Gilberto Echeverria<br>
>>> Research Engineer<br>
>>> Robotics and Interactions Group (RIS)<br>
>>> LAAS/CNRS, Toulouse<br>
>>> <a href="tel:%2B33%20%280%295%2061%2033%2078%2095" value="+33561337895" target="_blank">+33 (0)5 61 33 78 95</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Robotics mailing list<br>
>>> <a href="mailto:Robotics@blender.org" target="_blank">Robotics@blender.org</a><br>
>>> <a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
>>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Robotics mailing list<br>
>> <a href="mailto:Robotics@blender.org" target="_blank">Robotics@blender.org</a><br>
>> <a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
><br>
_______________________________________________<br>
Robotics mailing list<br>
<a href="mailto:Robotics@blender.org" target="_blank">Robotics@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Robotics mailing list<br>
<a href="mailto:Robotics@blender.org" target="_blank">Robotics@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Robotics mailing list<br>
<a href="mailto:Robotics@blender.org">Robotics@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/robotics" target="_blank">http://lists.blender.org/mailman/listinfo/robotics</a><br>
<br></blockquote></div><br>