Git Product home page Git Product logo

Comments (9)

ddemidov avatar ddemidov commented on June 18, 2024 1

I'll try to compile the tests when I have time (probably this weekend).

from ev3dev-lang-cpp.

ddemidov avatar ddemidov commented on June 18, 2024

I have no experience with ROS (actually have no idea what that is), but if you tell me what exactly you are trying to do with this library, I could try to help you.

To use the library you can just copy ev3dev.cpp and ev3dev.h files into your project and compile it however you do compilation (see the README for some more info). Something like CXX -std=c++11 -O3 -o myproject ev3dev.cpp myproject.cpp, where CXX is your compiler command.

If you want to use the library in stretch, you'll need to make a couple of changes, similar to ev3dev/ev3dev-lang-python@06ae05f. Namely, you'll need to change these parts of the code:

ev3dev-lang-cpp/ev3dev.cpp

Lines 954 to 957 in 539f241

led led::red_left{"ev3:left:red:ev3dev"};
led led::red_right{"ev3:right:red:ev3dev"};
led led::green_left{"ev3:left:green:ev3dev"};
led led::green_right{"ev3:right:green:ev3dev"};

_fd( new file_descriptor("/dev/input/by-path/platform-gpio-keys.0-event", O_RDONLY) )

from ev3dev-lang-cpp.

moriarty avatar moriarty commented on June 18, 2024

Hi,

Sorry this post might not be helpful. I’m currently away for work with limited internet access... but I just wanted to link this to another issue:

moriarty/ev3dev_ros_demo#1 (comment)

from ev3dev-lang-cpp.

MadsFox avatar MadsFox commented on June 18, 2024

@ddemidov: for some reason I still can't connect to any of the sensors, motors, leds, battery, but the sound part of the test menu works fine and also the lcd part, but it looks like they are not dependent on connecting. What can be the problem?

from ev3dev-lang-cpp.

ddemidov avatar ddemidov commented on June 18, 2024

Are you using stretch?

from ev3dev-lang-cpp.

MadsFox avatar MadsFox commented on June 18, 2024

Yes and I have placed the ev3dev.cpp and ev3dev.h file in the src folder of my project and added it in my CMakelists file:
add_library(ev3dev src/ev3dev.cpp) My CMakelists file is in the project folder and the ev3dev files in the src folder.
I have also specified the library as a target link library:
target_link_libraries(ev3dev_test_node ${catkin_LIBRARIES} ev3dev ) target_link_libraries(ev3dev ${catkin_LIBRARIES} )
I have tried to put some cout calls in the ev3dev.cpp file, but they didn't get printed in the terminal.

from ev3dev-lang-cpp.

MadsFox avatar MadsFox commented on June 18, 2024

I have also checked that the SYS_ROOT matches the root of the classes on the EV3. Also I can see the sensors and motors and their values via the LCD screen.
Sorry i'm new to C++, so my questions might be flawed them self.

from ev3dev-lang-cpp.

ddemidov avatar ddemidov commented on June 18, 2024

Meanwhile, could you please check if #30 helps you? It affects leds, buttons, and port names. Note that if you use strings to specify addresses, as in

ev3dev::large_motor m("outA");

then you should change that to

ev3dev::large_motor m("ev3-ports:outA");

or, better yet, use the provided constants:

ev3dev::large_motor m(ev3dev::OUTPUT_A);

from ev3dev-lang-cpp.

MadsFox avatar MadsFox commented on June 18, 2024

thank you so much @ddemidov made the test node run the motor and it registered the sensors, thank you, thank you, thank you.
It was a matter of changing the port names.
Still an issue with the leds, but I don't need to work in my project.

from ev3dev-lang-cpp.

Related Issues (20)

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.