How can I generate the density information of vehicles in only SUMO? - sumo

This is my sumocfg file code in the SUMO program.
<input>
<net-file value="updated.net.xml"/>
<route-files value="trips.trips.xml"/>
</input>
<time>
<begin value="0"/>
</time>
<report>
<verbose value="true"/>
<no-step-log value="true"/>
</report>
updated.net.xml is network file which I write, and trips.trips.xml is just the vehicle mobility file.
In https://sumo.dlr.de/wiki/Simulation/Output/Lane-_or_Edge-based_Traffic_Measures, there is the density information format, but I don't know how can I generate the additional output file including vehicle density information.
What code should I add here?

As it is stated under 'Instantiating within the Simulation', you need to add an additional file under as follows:
<input>
<net-file value = 'xxx'/>
<route-files value = 'xxx'/>
<additional-files value = 'xxx'/>
</input>
In the additional file, add the required edge and lane ids that are to be measured.

Related

RTI DDS creating own data types

I am working on a .Net example where I define my own data type using RTI Connext DDS.
Instead of creating the application from the beginning, I got help from the source code of the hello_world_xml_dynamic example in rti_workspace directory. I have made several changes to the USER_QOS_PROFILES.xml file to create my own data type and changes its name to MY_PROFILES.xml
But when I compile the application and run it from the command line, I get the following error:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
The line of code that catching the error:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
this is the configuration file MY_PROFILES.xml :
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
where am i making a mistake?
Your XML file looks correct. From the 'not found' error message, it seems that you may not have taken the right steps to instruct your application to load that profiles-file MY_PROFILES.xml to actually learn about your desired Participant. You can easily verify that this is the case by introducing an error in your XML file (for example by incorrectly renaming one tag) and rerun your application. If it does not complain about the syntax or schema of the XML, then your file did not get loaded and this hypothesis is correct.
If that turns out to be your problem indeed, then you have several options to fix that. They are listed in the User's Manual section 18.5 How to Load XML-Specified QoS Settings.

Is there any existing service in HotDocs tools to receive data from an external source to prepare a document?

HotDocs is a tool to generate documents and basically it carries 2 things. First is temple and second is answer file. Template carries variables and data to those variables are pushed through answer file.
Generally answer file is page where is it asks for data and further it generates a document.
Now our requirement is - instead of passing variable's values through answer file, I need to send through a API built using PHP which provides data in JSON format.
IS there any exiting service in HotDocs to serve this kind requests?. I can change the data from JSON to XML if required.
At the moment there is no off the shelf converter from JSON to HotDocs Answer XML however, at HotDocs we do this all the time. If you produce either JSON or XML from your application the data will need to be transformed into the HotDocs answer XML format - e.g.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AnswerSet title="Demo Answers" version="1.1">
<Answer name="Employee Name">
<TextValue>Graham Penman</TextValue>
</Answer>
<Answer name="Job Duty">
<RptValue>
<TextValue>make tea</TextValue>
<TextValue>make coffee</TextValue>
<TextValue>make some cake</TextValue>
</RptValue>
</Answer>
<Answer name="Annual Salary">
<NumValue>12.0000000</NumValue>
</Answer>
<Answer name="Contract Date">
<DateValue>10/10/2016</DateValue>
</Answer>
<Answer name="Paid Seminar Days">
<TFValue>false</TFValue>
</Answer>
</AnswerSet>
There are three key things you need to know to create the answer XML: The data type of your data, the data type in HotDocs and whether the data you are passing is a list or single item.
So to build the answer XML is relatively easy.
The answer XML is essentially key value pairs being contained between the opening and closing tags:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AnswerSet title="Demo Answers" version="1.1">
...Answers go here
</AnswerSet>
We then add answers in by adding the following and specifying the variable in the template the answer corresponds to, the actual value (from your data) you want to set the answer to and also the type of data it is in the template - in the example below it is text however, the type in HotDocs are: TextValue (string), NumValue (decimal), TFValue (boolean), DateValue (DateTime) and MCValue (see later on in this answer).
<Answer name="[Variable name in template]">
<TextValue>[Value from your data]</TextValue>
</Answer>
For multiple choices specifically you can select one or more answers so the answer XML format is slightly different:
<Answer name="[Variable name in template]">
<MCValue>
<SelValue>[First selected value]</SelValue>
<SelValue>[Second selected value]</SelValue>
</MCValue>
</Answer>
If you have repeated data you want to put into the document you can use the list repeat format:
<Answer name="[Variable name in template]">
<RptValue>
<[Variable Type]>[First value]</[Variable Type]>
<[Variable Type]>[Second value]</[Variable Type]>
</RptValue>
</Answer>
Once you build this XML structure you can pass this into the assemble document method on the REST services as a string with the template to assemble the corresponding documents.

Using pcl_to_scan without OpenNI to convert PointCloud into LaserScan

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.

latitude/longitude info in a GML Bounding box

If, for example, we have bounding box as given below in gml:
<gml:Envelope>
<gml:lowerCorner>42.943 -71.032</gml:lowerCorner>
<gml:upperCorner>43.039 -69.856</gml:upperCorner>
</gml:Envelope>
Now, for the lower corner, which value is the latitude and which is the longitude. Could not find this info in online documentation.
Thanks
Wanderer
The above GML is formatted in GeoRSS
From the GML schema:
<complexType name="EnvelopeType">
<choice>
<sequence>
<element name="lowerCorner" type="gml:DirectPositionType"/>
<element name="upperCorner" type="gml:DirectPositionType"/>
</sequence>
<element ref="gml:pos" minOccurs="2" maxOccurs="2">
<annotation>
<appinfo>deprecated</appinfo>
</annotation>
</element>
<element ref="gml:coordinates"/>
</choice>
<attributeGroup ref="gml:SRSReferenceGroup"/>
</complexType>
<element name="Envelope" type="gml:EnvelopeType" substitutionGroup="gml:AbstractObject">
<annotation>
<documentation>
Envelope defines an extent using a pair of positions defining opposite corners in arbitrary dimensions. The first direct position is the "lower corner" (a coordinate position consisting of all the minimal ordinates for each dimension for all points within the envelope), the second one the "upper corner" (a coordinate position consisting of all the maximal ordinates for each dimension for all points within the envelope). The use of the properties "coordinates" and "pos" has been deprecated. The explicitly named properties "lowerCorner" and "upperCorner" shall be used instead.
</documentation>
</annotation>
</element>
which leads to SRSReference group which contains the code to allow you to look up the axis order and units (amongst other things) about your coordinates.:
<attributeGroup name="SRSReferenceGroup">
<annotation>
<documentation>
The attribute group SRSReferenceGroup is an optional reference to the CRS used by this geometry, with optional additional information to simplify the processing of the coordinates when a more complete definition of the CRS is not needed. In general the attribute srsName points to a CRS instance of gml:AbstractCoordinateReferenceSystem. For well-known references it is not required that the CRS description exists at the location the URI points to. If no srsName attribute is given, the CRS shall be specified as part of the larger context this geometry element is part of.
</documentation>
</annotation>
<attribute name="srsName" type="anyURI"/>
<attribute name="srsDimension" type="positiveInteger"/>
<attributeGroup ref="gml:SRSInformationGroup"/>
</attributeGroup>
So without a specified SRS it is impossible to answer your question, we don't even know what units your coordinates are in.

Apache Tiles set html tag attribute using <put-attribute> value

I am using Apache Tiles 2.1 as my templating framework (along with Spring MVC).
I want to know how best to be able to set HTML attribute values from within my Tiles definitions file. For example I have a text box and want to be able to set the maxlength attribute from within my definition. I expected the following to work -
<input id="nameField" type="text"
maxlength="<tiles:insertAttribute name='maxlength' />" />
using this definition -
<definition name="sprint-goal" >
<put-attribute name="maxlength" value="100" />
</definition>
But it seems that Tiles ignores the <insertAttribute/> tag if placed within a HTML tag. It works fine otherwise.
Note: I have tried using a ViewPreparer to set request-scoped values. This will work but is not exactly what I am looking for. I would like to easily set HTML attribute values from within a Tiles definition.
To set the value of html element attributes, your best bet is to use Expression Language. First, expose the tile attribute as a java variable using the tiles useAttribute tag. Then use '${}' to print the variable.
Example:
<tiles:useAttribute name="myMaxLength" id="maxLength" />
<input id="nameField" type="text" maxlength="${myMaxLength}" />
More info:
- updated June 2014: https://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/useAttribute.html
- http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html
<put-attribute name="maxlength" value="100" type="string" />
I type isn't defined as "string" it would be taken as a URL to include...