Combining WareHouseModel and Experiments - rinsim

I am trying to run experiments using the WarehouseRenderer and AgvRenderer from AgvExample.
I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve dependency for implementations of interface com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModel, as requested by WarehouseRenderer.builder().
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:437)
at com.github.rinde.rinsim.core.model.DependencyResolver.constructDependencyGraph(DependencyResolver.java:90)
at com.github.rinde.rinsim.core.model.DependencyResolver.resolve(DependencyResolver.java:115)
at com.github.rinde.rinsim.core.model.ModelManager$Builder.build(ModelManager.java:268)
at com.github.rinde.rinsim.core.Simulator.<init>(Simulator.java:88)
at com.github.rinde.rinsim.core.Simulator$Builder.build(Simulator.java:347)
at com.github.rinde.rinsim.experiment.Experiment.init(Experiment.java:191)
at com.github.rinde.rinsim.experiment.Experiment.perform(Experiment.java:195)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:202)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:193)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:258)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.github.rinde.rinsim.experiment.LocalComputer.compute(LocalComputer.java:81)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:684)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:703)
at agv.ExperimentExample.main(ExperimentExample.java:197)

This error indicates that there is a renderer attached to the simulator that expects a model of type CollisionGraphRoadModel. A renderer can only function correctly if there is a corresponding model that contains the data that needs to be rendered.
In AgvExample the following code (see lines 86-90) is used to add the required model:
.addModel(
RoadModelBuilders.dynamicGraph(GraphCreator.createSimpleGraph())
.withCollisionAvoidance()
.withDistanceUnit(SI.METER)
.withVehicleLength(VEHICLE_LENGTH))
You can add similar code if you want to use the WarehouseRenderer in your code.

Related

ActionBar complains about ActionSeparator already having a parent

When using NavigationToolbar2Kivy from garden.matplotlib in a deeply nested widget (it's why I could not setup a simple working example showing the problem), I am thrown the following exception:
WidgetException: Cannot add <kivy.uix.actionbar.ActionSeparator object at 0x147956fa0>, it already has a parent <kivy.uix.actionbar.ActionOverflow object at 0x1478e44b0>
I could fix it by introducing the following changes in actionbar.py:
In ActionView._layout_random(), replace super_add(child, group_index) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child, group_index)
over_add(child) by:
if child.parent:
child.parent.remove_widget(child)
over_add(child)
and super_add(child) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child)
In ActionView._layout_all(), replace super_add(child) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child)
I think that the problem comes from ActionView.remove_widget() and the complicated interactions between _list_action_item, _list_action_group and hidden_items, that I could not sort out.
As these changes are most probably harmless, I suggest these changes are included to improve ActionBar robustness.
The ActionOverflow widget is not supposed to contain any ActionSeparator, as shown by its overloaded add_widget method.
But in ActionView._layout_random() (in the very last lines), items in hidden_items are added to overflow_group (which is an ActionOverflow widget) using the inherited add_widget method, not the overloaded one.
So, in ActionView._layout_random(), it is necessary to prevent overflow_group to receive any ActionSeparator, so it is necessary to replace:
over_add(child)
by:
if not isinstance(child, ActionSeparator):
over_add(child)
This identifies and fixes the problem.

paper-datatable Port to Dart with custom_element_apigen: does not working

I am trying port to Dart this nice paper-datatable implementation using custom_element_apigen.
Some problems occurred and sought to find solutions according to my understanding (perhaps included more problems!).
However, still an error is thrown and not been able to move on. I need some help about how port to Dart!!! I will briefly describe the steps, errors and solutions that gave and a link to source code of the project test:
1) I following the steps, accord to https://github.com/dart-lang/custom-element-apigen. I had problems on Windows, but I got to resolve after (custom_element_apigen: gives an error importing paper-datatable to Dart)
2) apigen.yaml used with custom_element_apigen does not clear how to configuration.
I used the "trial-and-error" method until no more error occur. It was so:
files_to_generate:
- paper-datatable\paper-datatable.html
- paper-datatable\paper-datatable-column.html
- paper-datatable\paper-datatable-edit-dialog.html
- paper-datatable\paper-datatable-card.html
- paper-datatable\paper-datatable-styles.html
- paper-datatable\datatable-icons.html
files_to_load:
- package:polymer_elements/src/paper-material/paper-material.html
- package:polymer_elements/src/iron-ajax/iron-request.html
- package:polymer_elements/src/iron-ajax/iron-ajax.html
- package:polymer_elements/src/iron-form/iron-form.html
- package:polymer_elements/src/iron-meta/iron-meta.html
- package:polymer_elements/src/iron-icon/iron-icon.html
- package:polymer_elements/src/iron-iconset-svg/iron-iconset-svg.html
- package:polymer_elements/src/paper-ripple/paper-ripple.html
- package:polymer_elements/src/paper-checkbox/paper-checkbox.html
- package:polymer_elements/src/neon-animation/animations/opaque-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-in-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-out-animation.html
- package:polymer_elements/src/paper-tooltip/paper-tooltip.html
- package:polymer_elements/src/iron-resizable-behavior/iron-resizable-behavior.html
- package:polymer_interop/src/js/debug/src/lib/template/templatizer.html
Some paths imports were wrongs on paper-datatable*.(html and dart) files. p.e. : import 'packages\polymer_interop\src\js\debug\src\lib\template\templatizer.dart'; I changed to import 'package:polymer_interop/src/behaviors/templatize.dart';
on paper_datatable_column.dart.
I changed reserved Dart word default to defaultx on get defaultx => jsElement[r'default']; and set defaultx(value) { jsElement[r'default'] = (value is Map || (value is Iterable && value is! JsArray)) ? new JsObject.jsify(value) : value;} instructions on paper_datatable_column.dart and paper_datatable_card.dart;
After the following erros were occuring in several polymer componentes. P.e.: Failed to execute 'registerElement' on 'Document': Registration failed for type 'iron-meta'. A type with that name is already registered.
I changed all paths into paper-datatable*.* files to get official package (pub.dartlang) of the polymer and polymer elements. P.e.: <link rel="import" href="paper_icon_button_nodart.html"> to <link rel="import" href="../../packages/polymer_elements/paper_icon_button_nodart.html">. The register problem does not occur more!
But now, the following problem is occuring and I don't know how to resolve it: On debug console appear the following message: Uncaught SyntaxError: Unexpected token =>. The web app works on browser, but the paper-datatable does not appear.
My complete test project (webstorm) is on https://github.com/supermuka/paper_datatable_port_dart_demo
Is there some wrong in how I used Dart custom_element_apigen (and apigen.yaml)? Did I some things wrong on paths changed? I also need to change some other source?
Thanks!
Most likely you just created a syntax error when editing the files. That being said there are options built in to do most of the things you manually did, and that also makes it easier to update in the future.
omit_imports: This is used on individual items in the files_to_generate section. It can be used to get rid of the templatizer import entirely, resolving issue #3. See example here.
name_substitutions: This is used on individual items in the files_to_generate section, and allows you to rename fields. You can use this to resolve issue #4, example here.
stubs_to_generate: This option allows you to generate stubs which actually import elements from a different package, this should resolve issue #5 you listed above. See example usage here.
Hopefully that helps, and applying those options will just resolve your issues.

Which way to go with these bugs

Compiling Dart app to js these two errors arise:
Nº1:
InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element': a type with that name is already registered.
Nº2:
Breaking on exception: TypeError: Object #<qE> has no method 'vL'
The object qE is created by dart2js.
How to find the solution?
There are appropriate tools to find the solution?
Thanks for advance !
I heard N1 occurs when Angular and Polymer is used in the same app. This is a known bug.
related open issues:
- duplicate polymer-element registration should not break the app
- Get error "Uncaught InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element'
For the N2 use pub build --mode=debug so you get unmangled names and then use one of the available strategies to fix the problem (use of MirrorsUsed, #observable, #reflectable)

java.io.InvalidObjectException with JMX MXBean with CompositeData

I am trying to publish an MXBean to JMX but I am getting the following stack when I start the program and the bean is being published:
Caused by: java.io.InvalidObjectException: Do not know how to make a javax.management.openmbean.CompositeType from a CompositeData: no method from(CompositeData); no constructor has #ConstructorProperties annotation; does not have a public no-arg constructor; not an interface
at com.sun.jmx.mbeanserver.OpenConverter.invalidObjectException(OpenConverter.java:1403)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.makeCompositeBuilder(OpenConverter.java:891)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.checkReconstructible(OpenConverter.java:897)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeBuilderCheckGetters.applicable(OpenConverter.java:1034)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.makeCompositeBuilder(OpenConverter.java:868)
... 48 more
Now I now that MXBeans are only supposed use OpenMbean types as per the documentation but my class is only using java.lang.String and javax.management.openmbean.CompositeData, so I do not know why it is failing. The interface is:
import javax.management.MXBean;
import javax.management.openmbean.CompositeData;
#MXBean
public interface JmxAdministrationApi {
String synchronize(CompositeData clientInfo);
}
It is worth noting that the bean was being published correctly until I added the CompositeData parameter (i.e. with no parameters), and only then did this error occur.
Any help with this would be greatly appreciated.
Thanks in advance,
Rob
Edit: also, we are using Spring JMX
You shouldn't be using CompositeData directly even though the documentation sounds like you should. The MXBean will take care of converting a proprietary data type into a CompositeData instance and back automatically.
Take a look at the samples provided in the documentation to see how you should use #ConstructorProperties annotation to make your data type play nicely with composite data and MXBeans.
-JB-

DomainTypes in XmlProvider FS0039 not defined

I am trying to use the FSharp.Data XmlProvider.
According to the samples you can access nested types and create a function that will receive a parameter of one of those types.
https://github.com/fsharp/FSharp.Data/blob/master/samples/library/XmlProvider.fsx (line 177)
However when I try to do the following:
type businessesT = XmlProvider<"Businesses.xml">
type businessT = businessesT.DomainTypes.Business
let testfunc (b:businessesT.DomainTypes.Business) =
b
It seems to work until I actually compiles and then I get
error FS0039: The type 'Business' is not defined
UPDATE:
The problem can be reproduced with the sample from FSharp.Data (XmlProvider.fsx)
adding a type alias after line 205
type Rss = XmlProvider<"http://tomasp.net/blog/rss.aspx">
type test = Rss.DomainTypes.Channel
What is strange is that the sample with the printDiv function is working...
This is most likely caused by some problem with loading the type provider - if the compiler fails to load the type provider, then it cannot run it and so none of the provided types like Business would be defined.
Are you using #r in a script file, or are you referencing the type provider through "Add References" in a project? If you're using #r, check if there is any error message on that line. In case of project, check other error messages output by the compiler.
I already listed some common reasons why type provider fails to load in another answer.
This was probably the same problem as "type provider" not recognized when building project, which has been fixed in FSharp.Data 1.1.10

Resources