Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Can I avoid installing ROS if my robot can directly respond to node commands? #131

Closed
JamesNewton opened this issue Aug 30, 2019 · 10 comments

Comments

@JamesNewton
Copy link
Contributor

JamesNewton commented Aug 30, 2019

I'd like to NOT install ROS on my actual robot to save space. If this rosnodejs can receive and respond to ROS messages, can't I just start with it and add the code required to move the robot and return data from the robots sensors and skip ROS entirely? The goal is just for people who use ROS on their PC's or whatever to be able to talk to my robot via the ROS messaging system.

Again, pardon me for asking this without truly understanding ROS, but perhaps if you answer it, this will help others understand the system as a whole and rosnodejs's place in it.

@chfritz
Copy link
Contributor

chfritz commented Aug 30, 2019

Yes, you can, if you:

  • use the onTheFly option (see here), and
  • you have the message definition files of the message types you want to use in your ROS_PACKAGE_PATH (path pointed to by that env variable).

@JamesNewton
Copy link
Contributor Author

Excellent! I've made a note and will investigate this in the near future.

@justinscorringe
Copy link

Hi. I have a similar question, but with the situation reversed. I want to interface with a remote ROS master uri with a Rosnodejs node, without ROS installed on the nodes system. Is this possible or will I require a ros install/ros docker? Thank you!

@chfritz
Copy link
Contributor

chfritz commented Sep 30, 2019

Yes, that's possible using the above mentioned onTheFly option, see example. However you will need to copy the message definition files from the robot (e.g., for ROS melodic in /opt/ros/melodic/share) to your machine, and set your ROS_PACKAGE_PATH environment variable to the folder you copied it to.

@justinscorringe
Copy link

Ah thank you! I have followed through with this and copied the share folder over and set the ROS_PACKAGE_PATH to this folder.
When following the turtlesim example, with { rosMasterUri : '192.168.5.109:11311' } (master address on local network) in the initnode function, I get
Unable to find CMAKE_PREFIX_PATH environment variable. Did you source setup.bash?
I've tried to also copy these over from the melodic folder and source them but have been unsuccessful in my attempts, am I going about this the right way?

@chfritz
Copy link
Contributor

chfritz commented Oct 1, 2019

Ah yes, you should set that env variable as well, and it is usually (always?) the same value as ROS_PACKAGE_PATH.

@justinscorringe
Copy link

justinscorringe commented Oct 1, 2019

Ah so CMAKE_PREFIX_PATH as the root folder of share worked! Also changed ROS path to that too as I had it set to share folder.

next error is ;
/Users/justinscorringe/node_modules/rosnodejs/dist/utils/network_utils.js:76
let match = uriString.match(regexStr);
           ^
TypeError: Cannot read property 'match' of undefined

Any clue of this?

@chris-smith
Copy link
Collaborator

Can you give more of the error stack?

@justinscorringe
Copy link

justinscorringe commented Oct 1, 2019

Edit: All fixed and working! Thank you for your help. Unfortunately I don't know what I did to fix it on the uri error, but glad it is working now.

@JamesNewton
Copy link
Contributor Author

Just to document this a bit more:

On the standard install of Kinetic on Ubuntu, the path variables are
ROS_PACKAGE_PATH="/opt/ros/kinetic/share"
CMAKE_PREFIX_PATH="/opt/ros/kinetic"
To emulate those as close as possible, a ros folder is added wherever, and a "share" folder under that. Those can be added permanently with:

echo export ROS_PACKAGE_PATH=/whatever/share/>>/etc/environment 
echo export CMAKE_PREFIX_PATH=/whatever/ros/>>/etc/environment 

Wherever they point, there needs to be a set of folders under the share folder with message package.xml and msg folder with the .msg files. Something like you find from /opt/ros/kinetic/share/ in a ROS installation. e.g. the std_msgs folder. But watch out for depends which must also be included. e.g. the package.xml for std_msgs lists:

<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>

so the message_generation and message_runtime folders must also be included. To support std_msgs and sensor_msgs, I ended up copying in

  • geometry_msgs
  • message_generation
  • message_runtime
  • sensor_msgs
  • std_msgs

This allows messages with all the standard string, int32, etc... types from std_msgs, as well as JointState (from sensor_msgs), and Accel, Pose, Quaternion, and others from geometry_msgs. It does not support logging, which seems to have a massive list of dependencies. Of course, you can just copy the entire ros share folder to the robot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants