Coder Social home page Coder Social logo

rust_test's Introduction

rust_test

Learn rust

rust_test's People

Contributors

lucasw avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rust_test's Issues

Simple pixel drawing with Pixels

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.

rust-windowing/winit#310

Try following minimal-sdl2 example instead.

rosnode info

$ 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

error[E0599]: no function or associated item named `new` found for struct "test_rosmaster::String" in the current scope

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?

use local rosrust

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

Futures for callbacks instead of separate threads?

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.

Image processing

Do a simple pixel manipulation operation on an uncompressed image from a ros topic, republish it.

corrosion with rosrust for catkin build

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

Store data from callback in struct

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.