I have a grid in which I want to set the width for auxheader in .zul but it's not working. I am using zk framework.
<grid id="chartGrid" model="#bind(vm.chartGridModel)" mold="paging"
style="overflow:auto" width="100%" >
<auxhead hflex="2" >
<auxheader hflex="2" align="center" width="200px" label="Date" rowspan="3"/>
</auxhead>
<auxhead hflex="1" children="#bind(vm.legendsFB)" visible="#bind(vm.vFb)" >
<auxheader align="center" width="200px" colspan="1"></auxheader>
<template name="children">
<auxheader align="center" label="#bind(each)" colspan="#bind(
vm.viewType eq '0' ? 3 :2)" hflex="2"/>
</template>
</auxhead>
<columns visible="false"><!-- make it invisible -->
<column width="200px"/><!-- specify width here -->
<column width="150px"/>
<column width="50px"/>
<column width="50px"/>
</columns>
<template name="model">
<row>
<cell align="center" ><label value="#load(each.report_date)"></label>
</cell>
<cell align="center"><label value="#load(each.total_action)"></label>
</cell>
<cell align="center"><label value="#load(each.from_user_male)"></label>
</cell>
<cell align="center"><label value="#load(each.from_user_female)"></label>
</cell>
</row>
</template>
</grid>
You set width and colspan.
colspan="x" means you will take the witdh of x columns of your template.
Now you can remove the colspan and it should work, but remember when you set width in px,
Be sure that the total px are the same as the px of all your rows.
You can also do width = "20%", this would mean that you take 20% of your total size of px of the columns.
Its easier to calculate to 100% then your total px.
Greetz chill.
Related
As I understand with the default settings in vscode. The properties below will only auto-wrap when it reaches to the maxiumum wordWrapColumn. (See below)
<h1 className="sample" height="20" width="30" color="20" size="200" />
// auto separated
<h1
className="sample"
height="20"
width="30"
color="blue"
size="200"
/>
I wanna ask if its possible to change this behavior? Instead of basing to wordWrapColumn, we check the total properties of an element / component.
We auto-newline when it reaches to the specified total props.
totalHtmlProps = 3
## case 1
<h1 className="sample" height="20" />
## case 2
<h1
className="sample"
height="20"
color="blue"
/>
a quick update: i'm also using prettier with this.
I am trying to simulate a simple pendulum using pydrake and am having a couple of issues creating the urdf file to creat the model for the pendulum. I have no background knowledge on urdf or drake and am open to any suggestions to resolve this issue.
This is the code I have so far:
import os
from tempfile import mkdtemp
from pydrake.all import (
AddMultibodyPlantSceneGraph,
DiagramBuilder,
Meshcat,
MeshcatVisualizerCpp,
Parser,
Simulator,
)
from manipulation.meshcat_cpp_utils import (
StartMeshcat, MeshcatJointSlidersThatPublish)
# Start the visualizer.
meshcat = StartMeshcat()
tmp_dir = mkdtemp()
model_file = os.path.join(tmp_dir, "test_model.urdf")
model_text = f"""\
<?xml version="1.0"?>
<robot name="materials">
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
<material name="green">
<color rgba="0.0 0.8 0.0 1.0"/>
</material>
<link name="base">
<visual>
<geometry>
<box size="0.5 0.5 0.1"/>
</geometry>
</visual>
<inertial>
<mass value="1"/>
</inertial>
</link>
<joint name="world_2_base" type="fixed">
<parent link="world"/>
<child link="base"/>
<origin xyz="0 0 0.5"/>
</joint>
<link name="arm">
<visual>
<geometry>
<cylinder length="0.5" radius="0.01"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<joint name="base" type="revolute">
<parent link="base"/>
<child link="arm"/>
<axis xyz="1 0 0"/>
<origin xyz="0 0 -0.3"/>
</joint>
<link name="ball">
<visual>
<geometry>
<sphere radius="0.1"/>
</geometry>
<material name="green"/>
</visual>
</link>
<joint name="base2" type="fixed">
<parent link="arm"/>
<child link="ball"/>
<origin xyz="0 0 -0.35"/>
</joint>
</robot>
"""
# Write temporary file.
with open(model_file, "w") as f:
f.write(model_text)
builder = DiagramBuilder()
plant, scene_graph = AddMultibodyPlantSceneGraph(builder, time_step=0.0)
# Add pendulum model.
model = Parser(plant, scene_graph).AddModelFromFile(model_file)
# - Weld base at origin.
base_link = plant.GetBodyByName("base", model)
#plant.WeldFrames(plant.world_frame(), base_link.body_frame())
plant.Finalize()
visualizer = MeshcatVisualizerCpp.AddToBuilder(builder, scene_graph, meshcat)
diagram = builder.Build()
simulator = Simulator(diagram)
simulator.set_target_realtime_rate(1.0)
simulator.AdvanceTo(5.0)
This code gives me a blanck meshcat screen. But when I remove the inertia tags in the base link I can see a model of the pendulum. Please let me know what I am doing wrong. Also if you can reccomend some resources to learn about urdf and drake that would be really helpful.
Thank you very much.
I believe that the problem is that you have no mass in the arm, so when you go to simulate it, the simulation is ill-defined (probably you get NaNs in the state variables).
If you want to check just the visualization, I'd recommend doing
context = diagram.CreateDefaultContext()
diagram.Publish(context)
instead of the simulator step.
I have started working on a proper tutorial for precisely this. It's very much a draft right now, but in case it helps you can find it here. I intend for this to be one of the real Drake tutorials soon.
I am using the Drake simulator, and attempting to add joint stiffness to the Acrobot demo found in the underactuated robotics repo, and so far have been unable to successfully integrate such stiffness into the simulation.
I am running the script torque_slider_demo.py, which references the URDF file acrobot.urdf. I modified this URDF to include a torsional spring entry as follows:
<torsional_spring stiffness = "100000000" rest_angle = ".75">
<joint name = "shoulder"/>
</torsional_spring>
This element is added after defining joints (Full XML shown below), and I increased damping in both joints to more quickly see steady-state behavior.
<?xml version="1.0"?>
<robot xmlns="http://drake.mit.edu"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Acrobot">
<link name="base_link">
<visual>
<geometry>
<box size="0.2 0.2 0.2" />
</geometry>
<material name="green">
<color rgba="0 1 0 1" />
</material>
</visual>
</link>
<link name="upper_link">
<inertial>
<origin xyz="0 0 -.5" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="1" ixy="0" ixz="0" iyy="0.083" iyz="0" izz="1" />
</inertial>
<visual>
<origin xyz="0 0 -0.5" rpy="0 0 0" />
<geometry>
<cylinder length="1.1" radius="0.05" />
</geometry>
<material name="red">
<color rgba="1 0 0 1" />
</material>
</visual>
</link>
<link name="lower_link">
<inertial>
<origin xyz="0 0 -1" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="1" ixy="0" ixz="0" iyy="0.33" iyz="0" izz="1" />
</inertial>
<visual>
<origin xyz="0 0 -1" rpy="0 0 0" />
<geometry>
<cylinder length="2.1" radius=".05" />
</geometry>
<material name="blue">
<color rgba="0 0 1 1" />
</material>
</visual>
</link>
<joint name="shoulder" type="continuous">
<parent link="base_link" />
<child link="upper_link" />
<origin xyz="0 0.15 0" />
<axis xyz="0 1 0" />
<dynamics damping="1" />
</joint>
<joint name="elbow" type="continuous">
<parent link="upper_link" />
<child link="lower_link" />
<origin xyz="0 0.1 -1" />
<axis xyz="0 1 0" />
<dynamics damping="1" />
</joint>
<torsional_spring stiffness = "100000000" rest_angle = ".75">
<joint name = "shoulder"/>
</torsional_spring>
<transmission type="SimpleTransmission" name="elbow_trans">
<actuator name="elbow" />
<joint name="elbow" />
<mechanicalReduction>1</mechanicalReduction>
</transmission>
</robot>
With this absurdly high stiffness value, I would expect for the arm to stabilize around the resting angle of the spring and exhibit an obvious pull towards the resting angle, however I do not see these effects in the visualization produced by the script.
Am I improperly defining the torsional spring in the URDF? Do I need to do some other setup to tell the simulator to consider joint stiffness?
It looks like we have support for torsional springs, but don't actually load them from URDF (nor expose the interface in python):
https://github.com/RobotLocomotion/drake/blob/master/attic/multibody/test/rigid_body_tree/rigid_body_tree_spring_test.cc
It would not be hard to add, and we'd welcome the contribution if you want to add the few lines to the parser. The drake developers are focused on multibodyplant now (which will replace rigidbodyplant).
Is there a way to get 5 cell Grid per row using sap.ui.layout.Grid.
I am able to get 6 Cells when the span is 2,
4 cells when the span is 3 and
3 cells when the span is 4.
But cannot seem to get 5 cell row using this control. thoughts?
By default a Grid acts as a separation of the screen by 12 columns. The span indicates the size of each section you want to divide. In your example with a span of 2, the result is 6 Cells since 12/2 = 6.
Since you cannot specify a decimal size for the span, what you can do is play around with the indentation. If you choose a span of 2 like in your example but you use an indentation on the first element of 1, only 5 columns will appear since you won't have enough space for the sixth one (1 + 2 + 2 + 2 + 2 + 2 = 11 -> hence no space for a +2 column). A quick example that will allow you to see this in action is as such:
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns="sap.ui.commons"
controllerName="sap.ui.layout.sample.GridProperties.GridProperties"
xmlns:html="http://www.w3.org/1999/xhtml">
<l:VerticalLayout
width="100%">
<l:Grid defaultSpan="XL2 L2 M5 S12" position="Center">
<l:content>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" indent="XL1" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2"/>
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L1" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
<Label text="Text">
<layoutData>
<l:GridData span="XL2 L2" />
</layoutData>
</Label>
</l:content>
</l:Grid>
</l:VerticalLayout>
</mvc:View>
If you remove the indent from the first label, you'll see the 6 labels in the same row, otherwise only 5 will appear.
Hope this helps!
I want to remove the extra space/padding/gap from FormItem I,m using in form for a mobile project in flex 4.6
I have tried making gap and padding to 0 but there the form and it's fields are still have indent to the right and top ?
<s:FormItem label="Start Date" width="150">
<s:HGroup>
<s:TextInput id="startDate" width="90" editable="false"/>
<s:Button id="setStartDate" label="set" height="34" fontSize="10" click="setStartDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
<s:FormItem label="End Date" width="150">
<s:HGroup>
<s:TextInput id="endDate" width="90" editable="false"/>
<s:Button id="setEndDate" label="set" height="34" fontSize="10" click="setEndDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
</s:HGroup>
</s:Form>
Gap between two form items, verticalGap.(set it on Form container)
Default hgroup gap is 6, set it to 0.
If gap between two items withn the FormItem, verticalGap (set this on the form container)
Form has FormHeading, set paddingTop=0 on this FormHeading comp. Also, try to set the height of this to 0 and PaddingTop = 0 on the form to reduce the gap btwn the first element and the top of the Form container.
This has good information about it http://livedocs.adobe.com/flex/3/html/help.html?content=layouts_08.html