I am a beginner in ROS and related issues. I create a URDF model of my desired robot that has a depth camera. I have 2 questions:
Robot simulated correctly in gazebo but when I add some interest object in gazebo environment, I found that my camera sensor frame is wrong and it view direction is z axis of the robot. I read some related problem but I could fix it.
I use of plugin for skid driver, but my robot wheels' not published in rviz, when I checked robot model or rqt_garph I could see the wheels.
Could you please help me regarding them?
It is my urdf:
<?xml version="1.0"?>
<robot name="bluebot" xmlns:xacro="http://ros.org/wiki/xacro">
<!-- base information-->
<xacro:property name="base_length" value="0.50" />
<xacro:property name="base_width" value="0.40" />
<xacro:property name="base_height" value="0.10" />
<xacro:property name="base_mass" value="14" />
<!-- wheel information-->
<xacro:property name="wheel_length" value="0.08" />
<xacro:property name="wheel_radius" value="0.10" />
<xacro:property name="wheel_mass" value="4.70" />
<!-- camera_stand information-->
<xacro:property name="camera_stand_length" value="0.10" />
<xacro:property name="camera_stand_radius" value="0.05" />
<xacro:property name="camera_stand_mass" value="2.50" />
<!-- camera information-->
<xacro:property name="camera_length" value="0.15" />
<xacro:property name="camera_width" value="0.03" />
<xacro:property name="camera_height" value="0.02" />
<xacro:property name="camera_mass" value="1" />
<xacro:property name="Pi" value="3.1415" />
<!--inertial-->
<xacro:macro name="solid_cuboid_inertial" params="length width height mass">
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="${mass}"/>
<inertia
ixx="${(mass / 12) * ((base_height * base_height) + (base_length * base_length))}" ixy="0.0" ixz="0.0"
iyy="${(mass / 12) * ((base_width * base_width) + (base_length * base_length))}" iyz="0.0"
izz="${(mass / 12) * ((base_width * base_width) + (base_height * base_height))}"/>
</inertial>
</xacro:macro>
<xacro:macro name="cylinder_inertial" params="mass radius height">
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="${mass}"/>
<inertia
ixx="${(mass / 12) * ((3 * (radius * radius)) + ( height * height))}" ixy="0.0" ixz="0.0"
iyy="${(mass / 12) * ((3 * ( radius* radius)) + ( height * height))}" iyz="0.0"
izz="${(mass / 12) * (radius * radius)}"/>
</inertial>
</xacro:macro>
<!--base_link-->
<link name="base_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 ${base_height / 2}"/>
<geometry>
<box size="${base_length} ${base_width} ${base_height}"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="${base_length} ${base_width} ${base_height}"/>
</geometry>
</collision>
<xacro:solid_cuboid_inertial length="${base_length}" width="${base_width}" height="${base_height}" mass="${base_mass}"/>
</link>
<gazebo reference="base_link">
<material>Gazebo/Blue</material>
</gazebo>
<!--wheel-->
<xacro:macro name="wheel" params="name reflect1 reflect2">
<link name="${name}_wheel_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length ="${wheel_length}" radius="${wheel_radius}"/>
</geometry>
</visual>
<collision>
<geometry>
<cylinder length="${wheel_length}" radius="${wheel_radius}"/>
</geometry>
</collision>
<xacro:cylinder_inertial mass="${wheel_mass}" radius="${wheel_radius}" height="${wheel_length}" />
</link>
<gazebo reference="${name}_wheel_link">
<material>Gazebo/Gray</material>
<mu1 value="10.0"/>
<mu2 value="20.0"/>
</gazebo>
<joint name="${name}_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="${name}_wheel_link"/>
<origin rpy="${Pi / 2} 0 0" xyz="${reflect2 * ((base_width / 2) + (wheel_length / 2))} ${reflect1 * base_length / 2} 0"/>
<axis xyz="0 0 -1"/>
</joint>
<transmission name="${name}_wheel_transmission">
<type>transmission_interface/SimpleTransmission</type>
<actuator name="${name}_wheel_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
<joint name="${name}_wheel_joint">
<!-- <hardwareInterface>VelocityJointInterface</hardwareInterface> -->
<hardwareInterface>EffortJointInterface</hardwareInterface>
</joint>
</transmission>
</xacro:macro>
<xacro:wheel name="right_front" reflect1="1" reflect2="1" />
<xacro:wheel name="left_front" reflect1="-1" reflect2="1" />
<xacro:wheel name="right_back" reflect1="1" reflect2="-1" />
<xacro:wheel name="left_back" reflect1="-1" reflect2="-1" />
<!--camera_stand-->
<link name="camera_stand_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="${camera_stand_length}" radius="${camera_stand_radius}"/>
</geometry>
</visual>
<collision>
<geometry>
<cylinder length="${camera_stand_length}" radius="${camera_stand_radius}"/>
</geometry>
</collision>
<xacro:cylinder_inertial mass="${camera_stand_mass}" radius="${camera_stand_radius}" height="${camera_stand_length}" />
</link>
<gazebo reference="camera_stand_link">
<material>Gazebo/Blue</material>
</gazebo>
<joint name="camera_stand_joint" type="fixed">
<parent link="base_link"/>
<child link="camera_stand_link"/>
<origin rpy="0 0 0" xyz="${base_width / 2} 0 ${(base_length / 2) - 0.10}"/>
</joint>
<!--camera-->
<link name="camera_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="${camera_length} ${camera_width} ${camera_height}"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="${camera_length} ${camera_width} ${camera_height}"/>
</geometry>
</collision>
<xacro:solid_cuboid_inertial length="${camera_length}" width="${camera_width}" height="${camera_height}" mass="${camera_mass}"/>
</link>
<gazebo reference="camera_link">
<material>Gazebo/Yellow</material>
</gazebo>
<joint name="camera_joint" type="fixed">
<parent link="base_link"/>
<child link="camera_link"/>
<origin rpy="0 0 ${Pi / 2}" xyz="${base_width / 2} 0 ${base_length / 2}"/>
</joint>
<link name="camera_sensor_link"/>
<joint name="camera_sensor_joint" type="fixed">
<parent link="camera_link"/>
<child link="camera_sensor_link"/>
<origin rpy="${-3 * Pi/2} ${Pi/2} ${Pi/2}" xyz="0 0 0"/>
<!-- <origin rpy="${3*Pi/2} 0 ${Pi}" xyz="0 0 0"/> -->
</joint>
<gazebo reference="camera_sensor_link">
<sensor type="depth" name="xtion_pro">
<always_on>true</always_on>
<visualize>true</visualize>
<camera>
<horizontal_fov>1.047</horizontal_fov>
<image>
<width>640</width>===
<height>480</height>
<format>R8G8B8</format>
</image>
<depth_camera>
</depth_camera>
<clip>
<near>0.1</near>
<far>10</far>
</clip>
</camera>
<plugin name="camera_plugin" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<!-- Keep this zero, update_rate in the parent <sensor> tag
will control the frame rate. -->
<updateRate>0.0</updateRate>
<cameraName>camera_ir</cameraName>
<imageTopicName>/camera/color/image_raw</imageTopicName>
<cameraInfoTopicName>/camera/color/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera/depth/image_raw</depthImageTopicName>
<depthImageCameraInfoTopicName>/camera/depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>/camera/depth/points</pointCloudTopicName>
<frameName>camera_sensor_link</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0</distortionK1>
<distortionK2>0</distortionK2>
<distortionK3>0</distortionK3>
<distortionT1>0</distortionT1>
<distortionT2>0</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
<gazebo>
<plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
<updateRate>100.0</updateRate>
<robotNamespace>/</robotNamespace>
<leftFrontJoint>left_front_wheel_joint</leftFrontJoint>
<rightFrontJoint>right_front_wheel_joint</rightFrontJoint>
<leftRearJoint>left_back_wheel_joint</leftRearJoint>
<rightRearJoint>right_back_wheel_joint</rightRearJoint>
<wheelSeparation>0.4</wheelSeparation>
<wheelDiameter>${wheel_radius * 2}</wheelDiameter>
<robotBaseFrame>base_link</robotBaseFrame>
<torque>20</torque>
<topicName>cmd_vel</topicName>
<broadcastTF>false</broadcastTF>
</plugin>
</gazebo>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
</robot>
and it is my launch file:
<?xml version="1.0"?>
<launch>
<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="extra_gazebo_args" default=""/>
<arg name="gui" default="true"/>
<arg name="recording" default="false"/>
<!-- Note that 'headless' is currently non-functional. See gazebo_ros_pkgs issue #491 (-r arg does not disable
rendering, but instead enables recording). The arg definition has been left here to prevent breaking downstream
launch files, but it does nothing. -->
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="physics" default="ode"/>
<arg name="verbose" default="false"/>
<arg name="output" default="screen"/>
<arg name="world_name" default="empty.world"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->
<arg name="respawn_gazebo" default="false"/>
<arg name="use_clock_frequency" default="false"/>
<arg name="pub_clock_frequency" default="100"/>
<arg name="enable_ros_network" default="true" />
<!-- set use_sim_time flag -->
<param name="/use_sim_time" value="$(arg use_sim_time)"/>
<!-- set command arguments -->
<arg unless="$(arg paused)" name="command_arg1" value=""/>
<arg if="$(arg paused)" name="command_arg1" value="-u"/>
<arg unless="$(arg recording)" name="command_arg2" value=""/>
<arg if="$(arg recording)" name="command_arg2" value="-r"/>
<arg unless="$(arg verbose)" name="command_arg3" value=""/>
<arg if="$(arg verbose)" name="command_arg3" value="--verbose"/>
<arg unless="$(arg debug)" name="script_type" value="gzserver"/>
<arg if="$(arg debug)" name="script_type" value="debug"/>
<!-- start gazebo server-->
<group if="$(arg use_clock_frequency)">
<param name="gazebo/pub_clock_frequency" value="$(arg pub_clock_frequency)" />
</group>
<group>
<param name="gazebo/enable_ros_network" value="$(arg enable_ros_network)" />
</group>
<node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="$(arg respawn_gazebo)" output="$(arg output)"
args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) -e $(arg physics) $(arg extra_gazebo_args) $(find bluebot)/worlds/$(arg world_name)" />
<!-- start gazebo client -->
<group if="$(arg gui)">
<node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="$(arg output)" args="$(arg command_arg3)"/>
</group>
<!-- Convert an xacro and put on parameter server -->
<param name="robot_description" command="xacro $(find bluebot)/urdf/bluebot.xacro" />
<!-- Spawn a robot into Gazebo -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model bluebot" />
<!-- <node name="joint_state_publisher" type="joint_state_publisher" pkg="joint_state_publisher" output="screen"/> -->
<!-- load the controllers -->
<!-- <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/" args="left_front_wheel_joint_position_controller right_front_wheel_joint_position_controller
left_back_wheel_joint_position_controller right_back_wheel_joint_position_controller joint_state_controller"/> -->
<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
<remap from="/joint_states" to="/bluebot/joint_states" />
</node>
</launch>
I am attempting to create a view through jjb that uses two regex job filters. regex-job is a dict but I am unable to get the syntax down. So far have tried things like
- view:
name: 'viewname'
view-type: 'list'
regex: 'regexfromoutsidejobfilterblock'
job-filters:
- regex-job:
- regex: 'regex1'
match-type: 'excludeMatched'
regex-name: 'one'
- regex: 'regex2'
match-type: 'includeMatched'
regex-name: 'two'
- job-status:
disabled: true
match-type: 'excludeMatched'
which returns a broken xml
+ <?xml version="1.0" encoding="utf-8"?>
+ <hudson.model.ListView>
+ <name>viewname</name>
+ <description><!-- Managed by Jenkins Job Builder --></description>
+ <filterExecutors>false</filterExecutors>
+ <filterQueue>false</filterQueue>
+ <properties class="hudson.model.View$PropertyList"/>
+ <jobNames>
+ <comparator class="hudson.util.CaseInsensitiveComparator"/>
+ </jobNames>
+ <jobFilters/>
+ <columns>
+ <hudson.views.StatusColumn/>
+ <hudson.views.WeatherColumn/>
+ <hudson.views.JobColumn/>
+ <hudson.views.LastSuccessColumn/>
+ <hudson.views.LastFailureColumn/>
+ <hudson.views.LastDurationColumn/>
+ <hudson.views.BuildButtonColumn/>
+ </columns>
+ <includeRegex>regexfromoutsidejobfilterblock</includeRegex>
+ <recurse>false</recurse>
+ </hudson.model.ListView>
and something like
job-filters:
regex-job:
regex: 'regex1'
regex-name: 'one'
match-type: 'excludeMatched'
regex-job:
regex: 'regex2'
regex-name: 'two'
match-type: 'includeMatched'
job-status:
disabled: true
match-type: 'excludeMatched'
simply used the second regex to overwrite the first.
Thank you in advance
I have to select the value of v1 which has match as V0 and (Need to make a 13 digit number , also remove the decimal point)
I am getting NaN.
Please guide.
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:output method="text" encoding="utf-8" />
<xsl:output omit-xml-declaration="yes" />
<xsl:param name="break" select="'
'" />
<xsl:template match="A">
<xsl:value-of select="format-number(B[match = V0]/v1 * 100,'0000000000000')"/>
</xsl:template>
INPUT:
<A>
<B>
<match>V0</match>
<v1>34.56</v1>
</B>
<B>
<match>V1</match>
<v1>34.54</v1>
</B>
Expected - 0000000003456
Actual - NaN
Just change
<xsl:value-of select="format-number(B[match = V0]/v1 * 100,'0000000000000')"/>
to
<xsl:value-of select="format-number(B[match = 'V0']/v1 * 100,'0000000000000')"/>
And the rest will follow.
Output is:
000000003456
You forgot to put your element value into single quotes.
We have a requirement in which need to convert XML into Fixed Length File. First record is as header and after that we have actual records..From 2 record onwards we need to apply the logic which is mentioned below:
After length 45, consider 10 numbers 0000001000, what ever be the last digit we need to check and replace by following the below table.
Same logic we need to repeat at position 59th to 74th.
77th to 80th we need to get the value 5152 and store into one variable
I had asked the question with 1st logic and got the awesome response, now I am left with 2nd and 3rd logic
For Positive: (0000001000) - (000000100{)
{= 0
A = 1
B = 2
c = 3
D = 4
E = 5
F = 6
G = 7
H = 8
I = 9
Request anyone to help me to achieve the same, I have mentioned the XSLT which I got from previous answers.Thanks
Input:
<ZR>
<INPUT>
<I_FIL>ERES</I_FIL>
</INPUT>
<TABLES>
<T_ER>
<item>
<DATA> HEADER1111111122222222333333344456</DATA>
</item>
<item>
<DATA>778944 D4E2 EA 1234567891 2018-11-060000001000EA 0000000000000100005152D04YA30TRE0000000XXXYYY 800{ Q 2018-11-05</DATA>
</item>
<item>
<DATA>987654 D4E2 EA 1987654321 2018-11-060000002001EA 0000000000000100005152D04YA30UUU0000000XXXLRB 100{ Q 2018-11-05</DATA>
</item>
.
.
.
.
.
.
.
.
<item>
<DATA>12345678912345678934562754378909726533297TRAILER</DATA>
</item>
</T_ER>
</TABLES>
</ZR>
XSLT:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output omit-xml-declaration="yes" />
<xsl:param name="break" select="'
'" />
<xsl:template match="/">
<xsl:value-of select="ZR/TABLES/T_ER/item[1]/DATA" />
<xsl:value-of select="$break" />
<xsl:for-each select="ZR/TABLES/T_ER/item[position() != 1]">
<xsl:variable name="length" select="string-length(substring(DATA,0,46))" />
<xsl:variable name="tenNumbers" select="substring(DATA, ($length + 1),
10)"/>
<xsl:variable name="charToReplace" select="translate(substring($tenNumbers, string-length($tenNumbers), 1),'0123456789','{ABCDEFGHI')" />
<xsl:value-of select="concat(substring(DATA,0,46), substring(DATA, ($length + 1), 9), $charToReplace, substring(DATA,($length+11),(string-length(DATA) + 1)))"/>
<xsl:value-of select="$break" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
OR
<xsl:template match="/">
<xsl:value-of select="
ZR/TABLES/T_ER/item[1]/DATA,
ZR/TABLES/T_ER/item[position() > 1]/DATA/concat(
substring(., 1, 54),
substring('{ABCDEFGHI', number(substring(., 55, 1)) + 1, 1),
substring(., 56)
)" separator="
" />
</xsl:template>
Expected Output:
HEADER1111111122222222333333344456
778944 D4E2 EA 1234567891 2018-11-06000000100{EA
000000000000010{005152D04YA30TRE0000000XXXYYY 800{ Q 2018-11-05
987654 D4E2 EA 1987654321 2018-11-06000000200AEA
000000000000010{005152D04YA30UUU0000000XXXLRB 100{ Q 2018-11-05
.
.
.
.
12345678912345678934562754378909726533297TRAILER
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output omit-xml-declaration="yes" />
<xsl:param name="break" select="'
'" />
<xsl:template match="/">
<xsl:value-of select="ZR/TABLES/T_ER/item[1]/DATA" />
<xsl:value-of select="$break" />
<xsl:for-each select="ZR/TABLES/T_ER/item[position() != 1]">
<xsl:variable name="length" select="string-length(substring(DATA,0,46))" />
<xsl:variable name="tenNumbers" select="substring(DATA, ($length + 1), 10)" />
<xsl:variable name="sixteenNumbers" select="substring(DATA, (string-length(substring(DATA,0,59)) + 1), 16)" />
<xsl:variable name="firstCharToReplace" select="translate(substring($tenNumbers, string-length($tenNumbers), 1),'0123456789','{ABCDEFGHI')" />
<xsl:variable name="secondCharToReplace" select="translate(substring($sixteenNumbers, string-length($sixteenNumbers), 1),'0123456789','{ABCDEFGHI')" />
<xsl:choose>
<xsl:when test="string-length($tenNumbers) != 10">
<xsl:value-of select="concat(substring(DATA,0,46), substring(DATA, ($length + 1), 9))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(substring(DATA,0,46),
substring(DATA, ($length + 1), 9),
$firstCharToReplace,
substring(DATA,($length+11), 18),
$secondCharToReplace,
substring(DATA,($length+30),(string-length(DATA) + 1)))" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$break" />
<xsl:variable name="temp" select="substring(DATA,77,4)" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
It depends on what condition you want to replace the char.
If it is based on after EA (as per comment) the solution would be different.
For now, I have implemented it solely length based with both points 2 & 3 covered.
http://xsltfiddle.liberty-development.net/6r5Gh38/1
EDIT:
http://xsltfiddle.liberty-development.net/6r5Gh38/2
EDIT 2:
Brief about the points mentioned in comment:
1. <xsl:when test="string-length($tenNumbers) != 10"> This condition is added to remove that extra R appearing for last <item> .
It means if the 10 numbers we are taking in variable is actually having 10 numbers or not.
In the last case,
<item>
<DATA>12345678912345678934562754378909726533297TRAILER</DATA>
</item>
We don't get 10 numbers after 46th character. We get less than that. That's the reason the output has been separated out for two different cases.
2. substring(DATA,0,46) --> which will take first 45 characters to match 778944 D4E2 EA 1234567891 2018-11-06
substring(DATA, ($length + 1), 9) --> which will take 9 characters from index 46th to match 000000100
$firstCharToReplace --> This will replace 10th character as your requirement of 1st question i.e. {
substring(DATA,($length+11), 18) --> It will start remaining string from index (45+11)th to 18 characters that matches EA 000000000000010
$secondCharToReplace --> This will replace (45+11+18)= 74th character as your requirement of 2nd question i.e. {
substring(DATA,($length+30),(string-length(DATA) + 1)) --> It starts from (45+30)= 75th character to last index and gives 005152D04YA30TRE0000000XXXYYY 800{ Q 2018-11-05
Note: In your case, there are extra tabs and white-spaces exist in between the string. That's why the index number has been changed to match your expected output.
How do I get the questions to number starting at 47 and not 00. I need the first number to be mc15q6647. This script below is giving me mc15q6601.
<xsl:when test="count(preceding::xhtml:li[#property = 'ktp:question']) + 1 < 50">
mc15q6647
<xsl:value-of select="format-number(count(preceding::xhtml:li[#property = 'ktp:question']) + 1, '00')" />
</xsl:when>