I am parsing the 1.4.1 Collada(exported from Blender), and I have noticed under the library_visual_scenes section, some nodes have extra technique sections.
Looking online, its not really clear what these are used for, or how I can use them. I assume they are used to transform the bone... but I am not sure. And why is this even needed!? Why is it just not baked into the bone matrix itself?
Example:
<node id="Armature_femaleLThigh" name="femaleLThigh" sid="femaleLThigh" type="JOINT">
<matrix sid="transform">-0.9970781 0.002205959 -0.07635591 0.1638527 0.003207254 0.9999106 -0.01299338 0.3053502 0.07632041 -0.01320031 -0.9969959 0.8346263 0 0 0 1</matrix>
<node id="Armature_femaleLCalf" name="femaleLCalf" sid="femaleLCalf" type="JOINT">
<matrix sid="transform">0.9932371 0.1157223 -0.009409941 5.092525 -0.1157309 0.9932806 -3.67943e-4 -1.14292e-5 0.009304143 0.001454476 0.9999557 3.33786e-6 0 0 0 1</matrix>
<node id="Armature_femaleLFoot" name="femaleLFoot" sid="femaleLFoot" type="JOINT">
<matrix sid="transform">0.1140624 -0.991138 -0.06808402 4.458811 0.9934708 0.1139541 0.005483917 9.53674e-7 0.002323155 -0.0682651 0.9976645 2.38419e-7 0 0 0 1</matrix>
<extra>
<technique profile="blender">
<layer sid="layer" type="string">0</layer>
<roll sid="roll" type="float">-1.571044</roll>
<tip_x sid="tip_x" type="float">5.96046e-7</tip_x>
<tip_y sid="tip_y" type="float">4.347153</tip_y>
<tip_z sid="tip_z" type="float">0.9915916</tip_z>
</technique>
</extra>
</node>
<extra>
<technique profile="blender">
<layer sid="layer" type="string">0</layer>
<roll sid="roll" type="float">-1.509084</roll>
<tip_x sid="tip_x" type="float">-0.02554714</tip_x>
<tip_y sid="tip_y" type="float">-0.4897394</tip_y>
<tip_z sid="tip_z" type="float">4.431761</tip_z>
</technique>
</extra>
</node>
<extra>
<technique profile="blender">
<layer sid="layer" type="string">0</layer>
<roll sid="roll" type="float">-1.50752</roll>
<tip_x sid="tip_x" type="float">-0.06722211</tip_x>
<tip_y sid="tip_y" type="float">0.02900314</tip_y>
<tip_z sid="tip_z" type="float">5.091998</tip_z>
</technique>
</extra>
</node>
Thank you!
Extra element is program / library / application specific. In your case Blender exported Blender specific options (techniques or else).
For instance if Blender re-import the file then Blender will read all these parameters and will configure the scene. Probably without profile="blender" Blender can't understand the technique in extra is belongs to Blender or not.
So basically, it holds application-specific configurations or extended configurations (extensions). You can put your custom data to there and probably most loaders will ignore them.
Related
I've below xml and would like to read it reverse order using for-each in xslt 1.0.
Input:
<Tokens>
<TokenNo>370021031939737</TokenNo>
<TokenNo>370021031939717</TokenNo>
<TokenNo>370021031939745</TokenNo>
<TokenNo>370021031939726</TokenNo>
</Tokens>
I want to read 370021031939726,370021031939745,370021031939717,370021031939737 using for-each. Can someone help.
Thanks
>> ? xml
No information on xml
There's parse-xml but it seems to me that it was for Rebol2.
I've searched for xml scripts in rebol.org and found xml-object.r that seemed to me like the most up to date from all searches.
I know about altxml, too, but the examples given are for html.
So, I'd like to ask about my choices if I want to parse and use information of +1GB of files of this simplified structure:
<?xml version="1.0" encoding="Windows-1252" standalone="yes"?>
<SalesFile xmlns="urn:StandardSalesFile-1.0">
<Header>
<SalesFileVersion>1.01</SalesFileVersion>
<DateCreation>2014-04-30</DateCreation>
</Header>
<SalesInvoices>
<Invoice>
<InvoiceNo>INV 1/1</InvoiceNo>
<DocumentStatus>
<InvoiceStatus>N</InvoiceStatus>
<InvoiceStatusDate>2014-01-03T17:57:59</InvoiceStatusDate>
</DocumentStatus>
</Invoice>
<Invoice>
<InvoiceNo>INV 2/1</InvoiceNo>
<DocumentStatus>
<InvoiceStatus>N</InvoiceStatus>
<InvoiceStatusDate>2014-01-03T17:59:12</InvoiceStatusDate>
</DocumentStatus>
</Invoice>
</SalesInvoices>
</SalesFile>
Is Rebol3 going to have a parse-xml tool? Should I use xml-object? If so how? Because it's still beyong my novice level of the language. Other option?
There is also a Rebol 3 library by Christopher Ross-Gill called alt-xml.
http://www.ross-gill.com/page/XML_and_REBOL
This can translate the XML to either a block! or object! representation.
Your question states that these XML files are large and may not fit in main memory. I would suggest that creating 1GB XML files is not best practice as many parsers, including this one, do attempt to load the files into memory.
To support this you will have to chunk the files yourself by using open on the file and copy/part chunks out of the file. This is a bit messy, but it will work.
One way to make this cleaner is to use parse as per HostileFork's suggestion and modify the series as you parse it. Parse is very flexible in this regard.
Ideally parse would be able to work directly on port! objects, but this is only a future wish list item at the moment.
Do you really need to deal with the XML file as structure? If not, have you considered just using PARSE?
(Warning: the following is untested, I'm just presenting the concept.)
Invoices: copy []
parse my-doc [
<?xml version="1.0" encoding="Windows-1252" standalone="yes"?>
thru <SalesFile xmlns="urn:StandardSalesFile-1.0">
thru <Header>
thru <SalesFileVersion> copy SalesFileVersion to </SalesFileVersion>
</SalesFileVersion>
thru <DateCreation> copy DateCreation to </DateCreation>
</DateCreation>
thru </Header>
thru <SalesInvoices>
any [
thru <Invoice>
(Invoice: object [])
thru <InvoiceNo> copy InvoiceNo to </InvoiceNo>
</InvoiceNo>
(Invoice/No: InvoiceNo)
thru <DocumentStatus>
thru <InvoiceStatus> copy InvoiceStatus to </InvoiceStatus>
</InvoiceStatus>
(Invoice/Status: InvoiceStatus)
thru <InvoiceStatusDate> copy InvoiceStatusDate to </InvoiceStatusDate>
</InvoiceStatusDate>
(Invoice/StatusDate: InvoiceStatusDate)
thru </DocumentStatus>
thru </Invoice>
]
thru </SalesInvoices>
thru </SalesFile>
to end
]
If you know you have well-formed XML and don't want a dependency on a library for processing clunky-ol' XML, Rebol can get pretty far and clear with PARSE. As TAG! is just a subclass of string, you can make things look relatively literate. And it's much more lightweight to just work with the strings.
Though if structural manipulations are required, you'll need something that makes a DOM. Altxml is the go-to right now, AFAIK.
(Hmm...I had a name for the pattern copy x to <foo> <foo> that escapes me at the moment, but this is a good case for it.)
%Rebol-Dom.r or %rebol-dom-mdlparser.r,
If your willing to use rebol2 with parse to seek thru to the node-name, then copy a chunk of data, you could feed that to Rebol-Dom.r getnodename "salesInvoice" and append that node-element to a block repetitively.
I'm working on a project that uses Kinect for robot navigation. We use ROS Groovy as distro and Gazebo for simulation, and have sensor and model plugins for the robot model. We have manipulated kinect model using the .sdf file and added libgazebo_ros_openni_kinect.so file as plugin. So now, whenever we launch the robot model in Gazebo, it publishes topics like these: /cam3d/depth/image_raw, /cam3d/depth/points, /cam3d/rgb/image_raw ...
Our model.sdf contains this part for the kinect model:
<plugin name="kinect" filename="libgazebo_ros_openni_kinect.so" >
<alwaysOn>true</alwaysOn>
<updateRate>10</updateRate>
<pointCloudCutoff>0.001</pointCloudCutoff>
<imageTopicName>/cam3d/rgb/image_raw</imageTopicName>
<pointCloudTopicName>/cam3d/depth/points</pointCloudTopicName>
<cameraInfoTopicName>/cam3d/camera_info</cameraInfoTopicName>
<depthImageTopicName>/cam3d/depth/image_raw</depthImageTopicName>
<depthImageInfoTopicName>/cam3d/depth/camera_info</depthImageInfoTopicName>
<frameName>kinect</frameName>
<distortion_k1>0.00000001</distortion_k1>
<distortion_k2>0.00000001</distortion_k2>
<distortion_k3>0.00000001</distortion_k3>
<distortion_t1>0.00000001</distortion_t1>
<distortion_t2>0.00000001</distortion_t2>
<imageTopicName>kinectimage</imageTopicName>
<pointCloudTopicName>pcloud</pointCloudTopicName>
<depthImageTopicName>depth</depthImageTopicName>
<depthImageCameraInfoTopicName>depthcamerainfo</depthImageCameraInfoTopicName>
</plugin>
We intend to use pcl_to_scan package in order to convert the point cloud data into LaserScan. I've done a little research about it. People say that I have to create a launch file to use the pcl_to_scan package. I took a look at the example launch files and realized that they use openni.launch and openni_manager in order to convert /camera/depth/points into laserscan data. I need to manipulate that launch file in order to work with the model that we have created, since we're not using openni at the moment.
The launch file that they offer is like this:
<launch>
<!-- kinect nodes -->
<include file="$(find openni_launch)/launch/openni.launch"/>
<!-- openni_manager -->
<node pkg="nodelet" type="nodelet" name="openni_manager" output="screen" respawn="true" args="manager"/>
<!-- throttling -->
<node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager">
<param name="max_rate" value="2"/>
<remap from="cloud_in" to="/camera/depth/points"/>
<remap from="cloud_out" to="cloud_throttled"/>
</node>
<!-- fake laser -->
<node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager">
<!--Setting the parameters for obtaining scan data within desired ranges-->
<param name="max_height" value="0.30"/>
<param name="min_height" value="-0.15"/>
<param name="angle_min" value="-0.5233"/>
<param name="angle_max" value="0.5233"/>
<param name="range_min" value="0.50"/>
<param name="range_max" value="6.0"/>
<param name="output_frame_id" value="/camera_depth_frame"/>
<remap from="cloud" to="cloud_throttled"/>
</node>
</launch>
I've also stumbled into depthimage_to_laserscan and pointcloud_to_laserscan packages, that can also be useful for dealing with this issue. Any help regarding the pcl_to_scan issue, or any other easier methods to deal with this situation will be greately appreciated. Thanks in advance.
I have a table with a mix of escaped and non-escaped XML. Of course, the data I need is escaped. For example, I have:
<Root>
<InternalData>
<Node>
<ArrayOfComment>
<Comment>
<SequenceNo>1</SequenceNo>
<IsDeleted>false</IsDeleted>
<TakenByCode>397</TakenByCode>
</Comment>
</ArrayOfComment>
</Node>
</InternalData>
</Root>
As you can see, the data in the Node tag is all escaped. I can use a query to obtain the Node data, but how can I convert it to XML in SQL so that it can be parsed and broken up? I'm pretty new to using XML in SQL, and I can't seem to find any examples of this.
Thanks
You have not given enough information about your end goal, but this will get you very close. FYI - You had two missing ; both after comment>
declare #xml xml
set #xml = '
<Root>
<InternalData>
<Node>
<ArrayOfComment>
<Comment>
<SequenceNo>1</SequenceNo>
<IsDeleted>false</IsDeleted>
<TakenByCode>397</TakenByCode>
</Comment>
</ArrayOfComment>
</Node>
</InternalData>
</Root>
'
select convert(xml, n.c.value('.', 'varchar(max)'))
from #xml.nodes('Root/InternalData/Node/text()') n(c)
Output
<ArrayOfComment>
<Comment>
<SequenceNo>1</SequenceNo>
<IsDeleted>false</IsDeleted>
<TakenByCode>397</TakenByCode>
</Comment>
</ArrayOfComment>
The result is an XML column that you can put into a variable or cross-apply into directly to get data from the XML fragment.
Your best bet might be to look into a HTML Decoding UDF. I did a quick search and found this one:
http://www.andreabertolotto.net/Articles/HTMLDecodeUDF.aspx
You may want to modify it so it only decodes > and <. The one above seems to go above and beyond your needs.
UPDATE
#Cyberkiwi's solution seems to be a bit cleaner. I will leave this up in case the version of SQL Server you are running doesn't support his solution.
I like to have one docbook xml document that has content for several target audiences. Is there a filter that enables me to filter out the stuff only needed for "advanced" users?
The level attribute is invented by me to express what I have in mind.
<?xml version="1.0"?>
<book>
<title lang="en">Documentation</title>
<chapter id="introduction" level="advanced">
<title>Introduction for advanced users</title>
</chapter>
<chapter id="introduction" level="basic">
<title>Introduction for basic users</title>
</chapter>
<chapter id="ch1">
<para level="basic">Just press the button</para>
<para level="advanced">
Go to preferences to set your
needs and then start the process
by pressing the button.
</para>
</chapter>
</book>
DocBook does not have a level attribute. Perhaps you meant userlevel?
If you are using the DocBook XSL stylesheets to transform your documents, they have built-in support for profiling (conditional text). To use it you need to
use the profiling-enabled version of the stylesheet (e.g. use html/profile-docbook.xsl instead of the usual html/docbook.xsl), and
specify the attribute values you want to profile on via a parameter (e.g. set profile.userlevel to basic).
Chapter 26 of Bob Stayton's DocBook XSL: The Complete Guide has all the details.
Two ways, off the top of my head:
Write a quick script that takes the level as a parameter and, using XPath or regular expressions, that only spits out the XML you want.
Write an XSLT transformation that will spit out the XML you want.
(2) is cleaner, but (1) is probably faster to write up.