c++ - rosrun via ssh doesnt start a node properly -
we working ros , try run node via ssh in shell script. have controlling (master) computer on execute script following line:
ssh user@xxx.xxx.x.x -x "/bin/bash -c 'source /etc/profile; rosrun stargazer_alter stargazer_node'"
the node getting started (it occurs in "rosnode list" , node listed publisher in "rostopic info") main method seems not executed (neither print lines show nor messages published).
#include "stargazer_listener.h" enum states {config, readdata}; int main(int argc, char** argv) { ros_info("test!!!! stargazer starts!"); ros::init(argc, argv, "stargazer_node"); stargazer_listener starg; int ifd = 0; char *rec_msg = (char*)malloc(buffsize * sizeof(char)); ifd = starg.portsetup(); states state = config; while(ros::ok()) { switch(state) { case config: starg.cmd(ifd, rec_msg, "~#calcstop`"); printf("calcstop\n"); starg.cmd(ifd, rec_msg, "~#calcstart`"); printf("calcstart\n"); state = readdata; break; case readdata: starg.publish_data(ifd, rec_msg); break; } } free(rec_msg); return 0; }
the line "starg.portsetup()" opens ttyusb0 port not used other processes.
the stargazer_node getting compiled via catkin_make. according code, first thing happen should following print line: "ros_info("test!!!! stargazer starts!");". doesnt happen!
the same shell script command did work fine other nodes. if add node ros ".launch" file, same thing happens.
if connect via ssh in terminal (ssh user@xxx.xxx.x.x) , run same line (rosrun stargazer_alter stargazer_node) works fine!
Comments
Post a Comment