Learn rust
lucasw / rust_test Goto Github PK
View Code? Open in Web Editor NEWLearn rust
License: BSD 3-Clause "New" or "Revised" License
Learn rust
License: BSD 3-Clause "New" or "Revised" License
Some pixels examples use winit, but the keyboard handling of winit
isn't very good, it is interpretting the keys like typing would and there is a big delay to it seeing a left or right arrow key release, it's not getting the raw is the key up or down like sdl would.
Try following minimal-sdl2 example instead.
$ rosnode info /loginfo
--------------------------------------------------------------------------------
Node [/loginfo]
Publications:
* /rosout [rosgraph_msgs/Log]
Subscriptions: None
Services: None
contacting node http://192.168.0.62:40079/ ...
ERROR: remote call failed: Method not implemented
Mostly interested in building the ros package. Install rust and minimal ros packages and then build rsc_test.
Build just in 20.04 noetic.
Also a github action for rosrust itself?
adnanademovic/rosrust@7cf2d89 tried that but actions weren't free back then?
Have it working in https://github.com/lucasw/rosrust/tree/github_action
This is coming out of having a fork of ros_comm in the sourced catkin_ws
Compiling rosrust_msg v0.1.1
error: expected one of `!` or `::`, found `=`
--> /home/lucasw/own/src/rust/rust_test/ros/rosrstest/target/debug/build/rosrust_msg-99c9329cbe7ef32c/out/messages.rs:3:9
|
...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected one of `!` or `::`
| while parsing this item list starting here
| the item list ends here
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: associated constant in `impl` without body
--> /home/lucasw/own/src/rust/rust_test/ros/rosrstest/target/debug/build/rosrust_msg-99c9329cbe7ef32c/out/messages.rs:3:9
|
3 | ... rosrust::rosmsg_incl
...
help: provide a definition for the constant: `= <expr>;`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: missing type for `const` item
--> /home/lucasw/own/src/rust/rust_test/ros/rosrstest/target/debug/build/rosrust_msg-99c9329cbe7ef32c/out/messages.rs:3:9
|
3 | ... rosrust::rosmsg_include!(tf2_msgs/TF2Error,tf2_msgs/LookupTransformAction,tf2_msgs/LookupTransformActionGoal,tf2_msgs/LookupTransformFeedback,tf2_msgs/LookupTransformGoal,tf2_msgs/LookupTransformActionFeedback,tf2_msgs/LookupTransformActionResult,tf2_msgs/TFMessage,tf2_msgs/LookupTransformResult,tf2_msgs/FrameGraph,theora_image_transport/Packet,smach_msgs/SmachContainerStatus,smach_msgs/SmachContainerInitialStatusCmd,smach_msgs/SmachContainerStr...
...
3 | ... rosrust::rosmsg_include!(tf2_msgs/TF2Error,tf2_msgs/LookupTransformAction,tf2_msgs/LookupTransformActionGoal,tf2_msgs/LookupTransformFeedback,tf2_msgs/LookupTransformGoal,tf2_msgs/LookupTransformActionFeedback,tf2_msgs/LookupTransformActionResult,tf2_msgs/TFMessa...
error[E0599]: no function or associated item named `new` found for struct "test_rosmaster::String" in the current scope
...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| function or associated item `new` not found for this
| function or associated item not found in `test_rosmaster::String`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `new`, perhaps you need to implement one of them:
candidate #1: `error_chain::ChainedError`
candidate #2: `gimli::read::lookup::PubStuffEntry`
candidate #3: `aho_corasick::Transitions`
candidate #4: `rand::distributions::uniform::UniformSampler`
candidate #5: `error_chain::ChainedError`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0599`.
error: could not compile `rosrust_msg`.
To learn more, run the command again with --verbose.
Maybe that isn't getting build if tests aren't getting build, but rosrust_msgs scans it anyhow and then fails?
Is adnanademovic/rosrust#134 related?
https://www.reddit.com/r/rust/comments/4l9ed6/nonlinear_optimization_library_for_rust
If the ceres C api isn't sufficient, can rust call through the C++ api?
It looks possible to embed C++, and get results out- what are more complex objects like to get out?
https://docs.rs/cpp/0.5.5/cpp/
Every ceres parameter can be a double coming out of the solver, but other ceres objects ought to persist?
Maybe that isn't that valuable over existing rosrust_msg tests, but could be a good learning exercise.
Could generate the nodes and the tests to test them?
Need to have dependencies like this
[dependencies]
# rosrust = "0.9.5"
# rosrust_msg = "0.1.1"
rosrust = { path = "../../../../rosrust/rosrust" }
rosrust_msg = { path = "../../../../rosrust/rosrust_msg" }
It's not possible to point at just the top level rosrust directory, the individual packages need to be called out (or for that to work it has to be called out differently, how to distinguish between rosrust
at the top level and the Cargo.toml one level down also called rosrust
?).
Also, rosrust_msg depends on rosrust, but it doesn't take the one specified above, this results in an error
error[E0277]: the trait bound `rosrust_msg::rosgraph_msgs::Log: rosrust::Message` is not satisfied
--> src/loginfo/main.rs:8:5
|
8 | rosout_pub: ros::Publisher<Log>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rosrust::Message` is not implemented for `rosrust_msg::rosgraph_msgs::Log`
|
::: /home/lucasw/own/src/rust/rosrust/rosrust/src/api/raii.rs:14:25
|
14 | pub struct Publisher<T: Message> {
| ------- required by this bound in `rosrust::Publisher`
error[E0277]: the trait bound `rosrust_msg::std_msgs::Float32: rosrust::Message` is not satisfied
--> src/loginfo/main.rs:9:5
|
9 | float_pub: ros::Publisher<Float32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rosrust::Message` is not implemented for `rosrust_msg::std_msgs::Float32`
|
::: /home/lucasw/own/src/rust/rosrust/rosrust/src/api/raii.rs:14:25
|
14 | pub struct Publisher<T: Message> {
| ------- required by this bound in `rosrust::Publisher`
error: aborting due to 2 previous errors
So have to fix the rosrust_msg dependency to depend on the local rosrust:
[dependencies]
# rosrust = "0.9.5"
rosrust = { path = "../rosrust" }
PR for above here adnanademovic/rosrust#153
Need to dig into rosrust to see how it is working, but I believe the only method it uses is to have a different thread for callbacks, which is similar to python but not the default for C++ (which requires asyncspinners or similar to put callbacks into some number of threads).
The same thread callback would make writing the node much simpler, barrier to entry for someone coming from C++ would be much lower so handing data back and forth between threads wouldn't be a prerequisite to make a very basic rust node.
Do a simple pixel manipulation operation on an uncompressed image from a ros topic, republish it.
Make the nodes do exactly the same thing, have a few subscriber node hanging off of each publisher, and a multiple publisher nodes into each subscription.
https://github.com/AndrewGaspar/corrosion
cd ~/own/src/rust/
git clone https://github.com/AndrewGaspar/corrosion.git
# Optionally, specify -DCMAKE_INSTALL_PREFIX=<target-install-path>. You can install Corrosion anyway
mkdir build_corrosion
cd build_corrosion
cmake -S../corrosion -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --config Release --prefix $HOME/other/install
Now $HOME/other/install has this tree:
$ find ~/other/install/Corrosion/
/home/lucasw/other/install/Corrosion/
/home/lucasw/other/install/Corrosion/share
/home/lucasw/other/install/Corrosion/share/cmake
/home/lucasw/other/install/Corrosion/share/cmake/FindRust.cmake
/home/lucasw/other/install/Corrosion/share/cmake/Corrosion.cmake
/home/lucasw/other/install/Corrosion/lib
/home/lucasw/other/install/Corrosion/lib/cmake
/home/lucasw/other/install/Corrosion/lib/cmake/Corrosion
/home/lucasw/other/install/Corrosion/lib/cmake/Corrosion/CorrosionConfig.cmake
/home/lucasw/other/install/Corrosion/lib/cmake/Corrosion/CorrosionConfigVersion.cmake
/home/lucasw/other/install/Corrosion/libexec
/home/lucasw/other/install/Corrosion/libexec/corrosion-generator
Instruction say 'You'll want to ensure that the install directory is available in your PATH or CMAKE_PREFIX_PATH environment variable.'
So
PATH=$PATH:$HOME/other/install/Corrosion
?
In catkin_ws_rs/src make a test project
Integrate it with ros node, ros1_lifecycle
C++ class methods could be given to subscribers along with this
then the callbacks could modify the class data. How to accomplish something similar in rosrust? Probably mostly a generic rust question that happens to be constrained by the way message callbacks are handled in rosrust.
Call
cargo fmt --all -- --check
cargo clippy -- -D warnings
and maybe something else?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.