How to fix the codes with the newest pydrake bindings? - drake

I found a useful demo in github(https://github.com/maggiewu19/compass-gait-simulator). However, the codes didn't work with the newest pydrake. I ran the codes in google colabĀ  and got errors.
Any reply will be appreciated.

I see. This is quite old -- it is using RigidBodyPlant which has been replaced by MultibodyPlant.
Drake has supported quite a long deprecation period on this. You can make most of it work by pulling the old RigidBodyPlant classes from attic, e.g. by changing this
from pydrake.all import (Box,
DiagramBuilder,
FindResourceOrThrow,
Isometry3,
SignalLogger,
Simulator)
from pydrake.attic.all import (FloatingBaseType, RigidBodyTree, RigidBodyPlant, VisualElement)
Unfortunately, I didn't leave as long of a deprecation period on PlanarRigidBodyVisualizer in the underactuated repo. You will have to pull an old version of underactuated to make that work.
FTR -- we are currently working on a way to make the colab setup's durable, by having a peg revision of drake (and underactuated) in the setup script. For now, you could download the old version of the underactuated repo, or just that specific file that was removed after it's deprecation period.
I can't guarantee you won't hit more errors after that. It would be much better to use the updated compass gait examples from class which are all using MultibodyPlant.

Related

New version of flutter giving bunch of errors in my previous code

I have set my development environment on another system with everything new. Latest android studio version, flutter, and everything.
Now I am trying to run my previous code but the whole code is full of errors. The code was working perfectly fine on my previous version of flutter. I didn't get the issue with this new version.
Here is the screenshot of my code:
1
Anyone please help me to solve this issue. This is my whole project with some other code as well and there are nearly 70 files of code.
I would be thankful if anyone can help me with this issue.
Thanks
Well, you semed to have had a really, really old version of Flutter (and Dart) before.
One way to fix those errors is to read and understand the guide to null safety and modify your project. It will be better after you do it, null safety is an amazing feature.
If you don't have the time to do that right now, you should be able to just constrain your SDK to an earlier version. Quite frankly I'm surprised that you got null safety out of the box because your project should have had constraints. If you set the minimum SDK version to something smaller than 2.12 you should be running without that feature. But please note that sooner or later you will need to enable it, you cannot stay on an obsolete version. So maybe it's time to do that now.
This is because Dart introduced null safety. You have to make your code null safe by using various annotations and operators. You can learn more about them here -
https://dart.dev/null-safety
https://dart.dev/codelabs/null-safety
https://dart.dev/null-safety/understanding-null-safety

Error while playing scene: "There are no scenes in that module"

I installed manim with all relevant dependencies and while trying to test it by doing some of the example scenes, the following error occurred
[03/05/21 23:02:26] ERROR module_ops.py:71
There are no scenes inside that module
I installed manim by copying the repo with git. Then I made another file with code copied from this tutorial https://talkingphysics.wordpress.com/2019/01/08/getting-started-animating-with-manim-and-python-3-7/ to see if the problem was on the example_scenes.py file, but i got the same result with an example from that page. I'm running Debian 10.
ONE NOTE: The article you used is great, but it's a bit outdated now. For example, to import the manim module, it is no longer from big_ol_pile_of_manim_imports import * but it's from manim import *.
Can you please tell us your manim version (i.e. community vs. Grant's version), all the dependencies you installed, and what command you use in terminal to call manim?
There are tutorials for the manim community edition linked here (if you downloaded the community edition). Let me know if you have any questions, hope this helps!

I need help to build ERC-721 contract with solidity version 5.0 or higher

I am trying to write a contract with ERC-721 token system. I have experience with ERC-20, so I thought I can find a tutorial and follow the tutorial. However, tutorials I found are based on solidity version between 4.0~4.2. Nowadays we use 5.0~6.0. Therefore tutorial codes are not working. Is there any tutorial, or code can I look and learn? HELP!
I tried to fix the code, and make suitable for 5.0 or higher, but I failed.
Therefore I tried to downgrade solidity and use docker but still get
Error: CompileError: ParsedContract.sol:3:1: ParserError: Source
"zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol" not found:
Unknown exception in read callback. import
'zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol'; this
error. :(
+
I found https://github.com/OpenZeppelin/openzeppelin-solidity , this but I do not know how to write test. Thank you for your time to read this !.
due to renaming, ERC721Token.sol is no longer available in the latest version of OpenZeppelin v2.3.0. change ERC721Token.sol to ERC721.sol, and it should work.
I suggest you have a look at the OpenZeppelin documentation:
https://docs.openzeppelin.org/v2.3.0/tokens#erc721
If you have more questions about OpenZeppelin you can always ask in the community forum
I can put together a sample contract in the community forum if you need.

Resolving a dependency issue with a web app in Dart/Mojito

I recently stumbled across Dart, and got pretty excited about it because it almost feels like that perfect language I've always been looking for. I work with PHP at my job (Yes, I know, ew gross) as a web developer and was excited to try and build a web app using the language. Figured it couldn't be too hard as that's what Dart was originally made for. Turns out it more difficult than I though, and I can't even get off the ground. I was hoping someone else could help point me in the right direction.
So, I really haven't done any real coding in this project at all. I literally downloaded the Dart SDK, used stagehand to create web-simple project, then I added a bin/server.dart file to the project. The code in that file was pretty much taken straight out of the online documentation for the mojito package:
import 'package:mojito/mojito.dart';
main() {
var app = init();
app.router
..addStaticAssetHandler('/static');
app.start();
}
I added the dependency mojito: "^0.6.6" to the pubspec.yaml file as well of course. That's all I've done though, like I say, I haven't even managed to get off the ground yet.
When I run server.dart I get the following error:
'package:convert/src/percent/encoder.dart': malformed type: line 23 pos 13: cannot resolve class 'ChunkedConverter' from 'PercentEncoder'
I get the exact same error message if I try to build a server with the shelf_rest package instead of the mojito package.
A search of that error message doesn't bring up too much helpful info, though I found one forum where someone recommended adding convert: ^2.0.1 to the dependencies. Apparently there was a change made in that package that causes incompatibility with other packages. I tried that suggestion but it doesn't seem to be resolving the issue.
I'm certain the issue is some sort of dependency issue, I'm probably using a mix of dependencies that I guess just aren't meshing right. If someone could help me figure out what I'm doing wrong it would be much appreciated. I want to learn and start using Dart but obviously I'm not having such great luck with it...
Here's what the pubspec.yaml looks like in case it helps:
environment:
sdk: '>=1.24.0 <2.0.0'
dependencies:
shelf: ^0.6.0
mojito: "^0.6.6"
convert: ^2.0.1
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
- dart_to_js_script_rewriter
The last version of mojito was uploaded in October 2016 and it seems abandoned. Since then, Dart has added Strong mode and begun transitioning to Dart 2. This included significant changes to the type system and updates to SDK libraries.
Additionally, transformers have also been removed - any documentation you find referencing them is out of date. And in this case, the dart2js script rewriter is for client side JavaScript, not servers.
If you're looking for Server libraries, I would recommend just starting with the latest version of Shelf

Too large JS-file generated

I have this code:
// main.dart
import "package:angular/angular.dart";
main () => ngBootstrap();
I make dart2js --minify --out=main.dart.js main.dart
Then i have main.dart.js with size 2.6 MiB (2,744,320 bytes).
It is not normal. What i'm doing wrong?
Is angular.dart usable for production at this stage?
#media-slave24
Maybe this will be helpful for You:
https://code.google.com/p/dart/issues/detail?id=14686
It's reported on dart bug tracking system. Some people using mirrors got 760kb. So it's definitely a bug.
UPDATE (Jan '14): AngularDart 0.9.5 now includes a standard MirrorsUsed list. To finalize it and trigger Dart's tree-shaking optimizations, you need to add a MirrorsUsed to your program
listing all the classes you introduce.
override: '*' to finalize the MirrorsUsed.
Since helloworld has no new classes, say:
#MirrorsUsed(override: '*')
import 'dart:mirrors';
See Github for the complete helloworld program
The key is to include a #MirrorsUsed annotation in your Dart file. Pavel's link to the AngularDart tutorial is an excellent resource.
To actually answer your question: Yes, AngularDart can be used in production but be aware that it is in "beta" release right now. We expect many breaking API changes!
Take a look at angular.dart.tutorial Chapter 7 about deployment. It has a section on managing compiled code size:
https://github.com/angular/angular.dart.tutorial/tree/master/Chapter_07

Resources