How to add png file as logo to gazebo model's .STL file and the model desciption is .sdf.jinja format? - stl

I have been trying to add image file to a mesh type stl file by using
<script>
<name>Logo/R2S</name>
<uri>model://r2s_cupcar/materials/scripts/logo.material</uri>
<uri>model://r2s_cupcar/materials/logo/r2s.png</uri>
</script>
Changes I have made in .material file:
material Logo/R2S
{
technique
{
pass
{
texture_unit
{
texture r2s.png
scale 150.0 1.0
}
}
}
}
My config file:
<?xml version="1.0"?>
<model>
<name>R2S Cup Car</name>
<version>1.0</version>
<sdf version="1.5">r2s_cupcar.sdf</sdf>
<author>
<name>Benjamin Perseghetti</name>
<email>bperseghetti#rudislabs.com</email>
</author>
<description>A model of the R2S Cup Car.</description>
</model>
I have also tried adding the png image to the gazebo model which was successfully added to the geometry in blender but is not importing in gazebo as it is i.e. no changes are visible in gazebo model.
Everywhere leads are available for collada(.dae) but Its mendatory to use .STL files in our model.So, Please guide me about its further process on further changes I can make in my .sdf.jinja file to include logo image properly as for now I am just getting different colours from my image file on the model. Thanks in advance.

Related

chrome not supporting application/rtf type

I have a requirement to display rtf file in my HTML. I am using object tag to embed my file into html.
When I use below code showing the plugin is not supported. Is there any way I can display rtf type document in my HTML
<object data="assets/display.rtf" type="application/rtf"></object>
Note: I am able to display PDF file with the same approach
After trying a lot found something.
First i downloaded the rtf.js from this link. rtf.js . Then went through this link. getting started with rtf.js. (download entire dist folder and place it into your html folder. dist folder doesn't contain jquery min js plz download it. and include all the script files in your html). Below is the code i modified. (Entire rtf will be converted into objects). Along with the following code please include the default code given by rtf.js.(Please make sure your rtf file is in proper way.)
const rtf =
`{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}
{\\*\\generator Msftedit 5.41.21.2510;}\\viewkind4\\uc1\\pard\\sa200\\sl276\\slmult1\\lang9\\f0\\fs22 This \\fs44 is \\fs22 a \\b simple \\ul one \\i paragraph \\ulnone\\b0 document\\i0 .\\par
{\\colortbl;\\red0\\green0\\blue0;\\red255\\green0\\blue0;}
This line is the default color\\line
\\cf2
This line is red\\line
\\cf1
This line is the default color
}
}`;
<div id="display">
</div>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
doc.render().then(function(htmlElements) {
//console.log(meta);
//console.log(htmlElements);
console.log(htmlElements);
var display = document.getElementById("display");
for(var i=0;i<htmlElements.length;i++){
//console.log(htmlElements[i][0].innerHTML);
display.innerHTML+=htmlElements[i][0].innerHTML; //RENDERING ALL DIVS INTO display DIV
}
}).catch(error => console.error(error))
</script>

Use an image from public folder

I'm trying to set as background an image located at /public/images/my-image.jpg
I've tried
<body background="public/images/my-image.jpg">
and
<body background="images/my-image.jpg">
and
<body background="my-image.jpg">
But I always get 404 (Not Found) on the Chrome console. Any idea why?
I also tried adding this:
<style>
body {
background-image: url("/public/images/my-image.jpg");
}
</style>
But nothing appears in the background of the page.
You need to have a record in the routes file
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
Then you can access the files in the public folder with the twirl helper:
<body background="#routes.Assets.versioned("images/my-image.jpg")">
It would be compiled to
<body background="/assets/images/my-image.jpg")">
You can put it as static text as well.
If you want to change "assets" to "public" or whatever, just change it in the routes file:
GET /public/*file controllers.Assets.versioned(path="/public", file: Asset)
Then your assets would be accessible by the public path, like:
<body background="/public/images/my-image.jpg")">
Still, the #routes.Assets.versioned would be the same:
<body background="#routes.Assets.versioned("images/my-image.jpg")">
This is the reason why #routes.Assets.versioned is preferable way.
As I understand it, you've got a problems obtaining assets in playframework.
Follow the documentation for play framework for assets.
To obtain assets from public directory (if you haven't change the default routes or assets controller), you need to use path with assets/ instead of public/.
Or more preferable using reverse router. In play 2.5x in your case it would be:
<body background="#routes.Assets.versioned("images/my-image.jpg")">
using reverse routing or
<body background="assets/images/my-image.jpg">
with hard coded path.
I think it is not supported anymore in HTML5, try to use css like body {
background-image: url("gradient_bg.png");
}
font: https://www.w3schools.com/tags/att_body_background.asp

html_theme_options vs. html_logo in conf.py using alabaster

hello all experienced Sphinx users,
since a few days I'm performing my first experiences with Sphinx for building a small documentation site. I'm playing around using the Alabaster theme. When I try to place a logo in the left upper corner it only works with using an entry in the build configuration file 'conf.py' like this:
html_logo = '_static/images/PJS-small.png'
when I try to use the Alabaster theme configuration like this
html_theme_options = {
'logo': '_static/images/PJS-small.png',
'logo_name': True,
'description': 'one more logo'
}
no logo appears above the sidebar.
I'd like to use the theme configurations because I'm able to place a subtitle and other things like that.
Does anyone have an idea how to use the Alabaster configurations like it is documented?
Thank you very much for helping.
As per the Alabaster installation instructions,
you have to add an html_sidebars setting to the conf.py file:
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
'donate.html',
]
}
This causes Alabaster’s customized sidebar templates to be loaded.
Then you can specify the logo path like this:
html_theme_options = {
'logo': 'images/PJS-small.png',
# etc.
}
The path is automatically prepended with _static/.
In the theme configuration (theme.conf) file, you need to use the following syntax:
logo = images/PJS-small.png
logo_name = true
description = one more logo
Note the absence of the _static directory in the logo path (it is prepended in the theme's HTML template) and the lowercase boolean.
Still, you can set any theme configuration variable through the html_theme_options object in the Sphinx project configuration file (conf.py).

locate entity in terms of coordinates of html through html parser

When we open a html file in browser it draw all entities written in html file. It calculates location of all entity and then draw using these location from some origin.
input :
<!DOCTYPE html>
<html>
<body>
Get location of below button after drawing by html parser
<br>
<br>
<button type="button" onclick="alert('Hello world!')">Click Me!</button>
</body>
</html>
{Output: pixel coordinate of button entity}
Above code will draw a button , following text. Can we calculate this distance/location.
Now assume we need to show all coordinates/pixel of all entities from top-left to different platform, so that i can show it on different platform to user to let know that how many pixel they have moved and how many more they need to shift or change.
For this we need to parse html file and store all coordinates against this entity and dynamically show it on some different platform and when user change it on different platform it reflect on html file.

Simplifying ASP.Net MVC Razor Code

I'm looking for suggestions on how to simplify/optimize a piece of code in one of my view files in my ASP.Net MVC project. The code works, but I'm not sure if I've written it the best way.
Basically, the code is used to display a list of links to documents, with little thumbnails to the left of each link. The main problem, is that there are two different types of documents, and each type has to have it's thumbnail image stored in a different location, this is a project requirement and can't be changed.
I'm currently accomplishing this with the view code shown below.
// Display a link to every document.
foreach (var document in documentList)
{
<a href="#Url.Content("~/Document/DownloadDocument/" +
document.documentid)" target="_blank">
#{
// This will be the root of all the paths.
var path = "~/Document/DisplayImage/";
// If it's a Type 1 document, we need to use a different path.
if (document.documentType == "Type 1") {
path += "Path/To/Image/Folder";
<img id="imageHolder" src="#Url.Content(path)"
onerror="imgError(this);" />
#document.documentname
}
else {
path += "Path/To/Different/Image/Folder";
<img src="#Url.Content(path)" />
#document.documentname
}
}
</a>
<br />
}
Like I said, the code works, but I'm not too happy with how it's written. Does anyone have any suggestions?
When working with MVC, it's best to keep your Views dumb (no logic, simply rendering).
You can accomplish this by using a strongly-typed View and performing all of the logic in the Controller. It looks like you may already be doing this since you have a documentList.
In this case, documentList should be a list of View Model objects that already have the appropriate image path already set on them from the controller.
I would suggest moving the path to your document image into your model. That way you can just display the image from the path in the model and you wouldn't have to put any logic in your view.