Coder Social home page Coder Social logo

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

lucasw avatar lucasw commented on August 18, 2024
error[E0599]: no function or associated item named `new` found for struct "test_rosmaster::String" in the current scope

from rust_test.

Comments (12)

lucasw avatar lucasw commented on August 18, 2024

Put a CATKIN_IGNORE in ros_comm/test.

roscd ros_comm
touch CATKIN_IGNORE

In the catkin workspace:

rm -rf build devel .catkin_tools
source /opt/ros/noetic/setup.bash
catkin build
cargo clean  # deletes target dir
cargo build

It is still finding the test_rosmaster messages.

It's also finding messages completely outside of the sourced catkin ws.
(Because they are sourced in .bashrc? No disabling that source doesn't fix it)

Maybe need to do something more than CATKIN_IGNORE - delete all references to test_rosmaster in the parts that aren't ignored.

vanilla noetic-devel ros_comm also fails, it's not just my fork.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Maybe something is broken with catkin overlays? Try overlaying a much simpler package that is also in apt repos.

Try overlaying with ros-noetic-geometry-msgs

git clone [email protected]:ros/common_msgs

Works fine.

There is something unique about ros_comm then?
Or anything that uses a ros test?

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Disable/delete tests

catkin build -DCATKIN_ENABLE_TESTING=0

Still fails with ros_comm the same way.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Try catkin build install - nope.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Reproduce with docker

docker run --rm -it ros:noetic-robot bash -c "\
apt update && \
apt install -y curl git && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source /root/.cargo/env && \
source /opt/ros/noetic/setup.bash && \
mkdir catkin_ws/src -p && \
cd catkin_ws/src && \
git clone https://github.com/ros/ros_comm.git && \
cd .. && \
catkin build && \
source devel/setup.bash && \
cd .. && \
git clone https://github.com/adnanademovic/rosrust.git && \
cd rosrust && \
cargo build"

This shows the error. Try melodic later.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Deleted all component of ros_comm except for ros_comm/tools and the build works. tools/rosgraph and tools/roslaunch are where I have my changes in a branch, so a rosrust compatible branch of ros_comm could be made to make this work with CI pipelines easily. If I make changes to other packages within ros_comm I can try to bring them in one by one.

Will have to cherry-pick changes back and forth as needed between a regular non rosrust noetic_aggregated and rosrust_compatible_noetic_aggregated.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

The rosgraph doesn't appear to be working (and logs out of rust nodes are odd not going through it either:

[ INFO][1605973982.167029391 ${shortfile}:17 /test_pub_sub]: float from rust 0.00136984 0.140187
[INFO @ src/loginfo/main.rs:78]: update 1.3738008
[INFO @ src/loginfo/main.rs:91]: test ros_info

I do see the main.rs logs in rosout_agg though, so why aren't they in stdout properly? Probably something in rosrust is re-implementing the log line output instead of going through the python (so C++ ros nodes go through python to print to stdout?).

---
header: 
  seq: 496
  stamp: 
    secs: 1605974324
    nsecs: 959169912
  frame_id: ''
level: 2
name: "/loginfo"
msg: "test ros_info"
file: "src/loginfo/main.rs"
function: ''
line: 91
topics: 
  - /rosout
  - /float_from_rust

function is blank in the rust node output, so that needs to be fixed (though maybe if it was a closure that isn't well defined?).

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

I probably need clients/rospy/src/rospy/rosconsole.py to make the rosgraph changes work.

Try leaving in both the C++ and rospy clients - that builds.

Still not proper log message output- do a clean rebuild.

Forgot about [email protected]:lucasw/rosconsole, need that for C++ nodes.

Works, now look at formatting rust log messages adnanademovic/rosrust#152

[INFO @ src/loginfo/main.rs:78]: update 0.13460626
[INFO @ src/loginfo/main.rs:91]: test ros_info
[I][1605975989.124 .../rsc_test/src/test_pub_sub.cpp:17 /test_pub_sub]: float from rust -0.00146927 0.134606

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Using a ros_comm fork with test dir deleted good enough for now, could dive into why it fails later.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Looking at debugging the test_rosmaster and related issue of trying to build messages outside of the ROS_PACKAGE_PATH, first debug all the paths passed into rosrust_msg.

(Also why even build those messages if nothing depends on them? Maybe there could be a test build that builds every message it can find- or is that what this already is?)

This is needed to use println in the rosrust_msg build.rs rust-lang/cargo#985 (comment)

find . -name output | grep rosrust_msg
cmake_paths: ["share", "/home/lucasw/other/install/lib/cmake/share", "/home/lucasw/other/install/share"]
cmake_alt_paths: ["../src", "/home/lucasw/other/install/lib/cmake/../src", "/home/lucasw/other/install/../src"]
ros_package_paths: [""]
extra_paths: [""]

The macro solution to prepend cargo:warning to every println works even better rust-lang/cargo#985 (comment)

macro_rules! build_println {
    ($($tokens: tt)*) => {
        println!("cargo:warning={}", format!($($tokens)*))
    }
}

So probably just disable the cmake and cmake alt paths, only use ros_package_paths (and set it to something in this case)

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Removed the cmake paths from rosrust_msg, now only paths are passed in through ROS_PACKAGE_PATH and ROSRUST_MSG_PATH

On a vanilla debian ros system there is no ROS_PACKAGE_PATH so

ROS_PACKAGE_PATH=/usr/share cargo build --verbose

Dependencies like diagnostic_msgs need to be on that path, and probably a few others

The only issue is that the process appears to get stuck at

     Running `/home/lucasw/own/src/rust/rosrust/target/debug/build/rosrust_msg-4e0d22fae2e75704/build-script-build`
    Building [=======================> ] 191/198: rosrust_msg(build)                                                                                                                                                             

The process is taking 100% cpu... and then locked up my computer after a few minutes.

But probably even more evidence that it shouldn't build every message, just the ones it needs.

This very narrow build works:

ROS_PACKAGE_PATH=/usr/share/std_msgs:/usr/share/diagnostic_msgs:/usr/share/actionlib_msgs cargo build

Also building on a different computer worked fine with all of /usr/share, and didn't take long at all.

from rust_test.

lucasw avatar lucasw commented on August 18, 2024

Looks like default debian catkin adds cmake prefix path to the ros package path, which fouls up rosrust compilation:

Extending:          [cached] /home/lucasw/other/install:/home/lucasw/other/install/lib/cmake

so blank it out for the config

CMAKE_PREFIX_PATH="" catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
---------------------------------------------------------------
Profile:                     default
Extending:                   None
...

It also gets fouled up if catkin is run after that, have to blank out the cmake prefix path for catkin build too- but what if it is needed?

CMAKE_PREFIX_PATH="" ROSRUST_MSG_PATH=/usr/share/sensor_msgs catkin build -j4 -v

Don't necessarily need to set the prefix path to "" though, it just is confusing when it is there

from rust_test.

Related Issues (16)

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.