Skip to content

Commit

Permalink
Merge pull request #2 from tlk-emb/restructRework
Browse files Browse the repository at this point in the history
Restruct rework
  • Loading branch information
ken551 authored Jun 19, 2019
2 parents 7b1d108 + 28960de commit 57be743
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion catkin_ws_sample/app/mros_test/src/mros_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ int main(int argc,char **argv){
std::string str,nav;
//ss << "Hello World!" << count;
//ss << std::cin;
nav = "\n\n[Type LED color] \n [red] or [green] or [blue] or (reset)";
//nav = "\n\n[Type LED color] \n [red] or [green] or [blue] or (reset)";
nav = "Type what you send\n";
ROS_INFO("%s",nav.c_str());
std::cin >> str;
msg.data = str;
Expand Down
2 changes: 1 addition & 1 deletion catkin_ws_sample/camera_app/fast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ find_package(catkin REQUIRED COMPONENTS
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
# INCLUDE_DIRS include
LIBRARIES fast
CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
Expand Down
2 changes: 1 addition & 1 deletion catkin_ws_sample/camera_app/mask/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ find_package(catkin REQUIRED COMPONENTS
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
# INCLUDE_DIRS include
LIBRARIES mask
CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
Expand Down
2 changes: 1 addition & 1 deletion catkin_ws_sample/camera_app/preprocess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ find_package(catkin REQUIRED COMPONENTS
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
# INCLUDE_DIRS include
LIBRARIES preprocess
CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
Expand Down
17 changes: 8 additions & 9 deletions mros-lib/mros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
char evl_flag = 0;

/***** congiuration ros master ******/
const char *m_ip = "192.168.11.4"; //ros master IP
const char *m_ip = "192.168.11.3"; //ros master IP
const int m_port = 11311; //ros master xmlrpc port

/*********global variables***************/
Expand Down Expand Up @@ -242,10 +242,10 @@ syslog(LOG_NOTICE, "========Activate mROS PUBLISH========");
break;
default:
// TODO: check last arg
/** for image data **/
int len = pub_gen_header(snd_buf,node_lst[node_num].callerid,node_lst[node_num].message_definition,node_lst[node_num].topic_name,node_lst[node_num].topic_type,"060021388200f6f0f447d0fcd9c64743"); //test function
/** for image data **/
//int len = pub_gen_header(snd_buf,node_lst[node_num].callerid,node_lst[node_num].message_definition,node_lst[node_num].topic_name,node_lst[node_num].topic_type,"060021388200f6f0f447d0fcd9c64743"); //test function
/**for string data**/
//int len = pub_gen_header(snd_buf,node_lst[node_num].callerid,node_lst[node_num].message_definition,node_lst[node_num].topic_name,node_lst[node_num].topic_type,"992ce8a1687cec8c8bd883ec73ca41d1"); //test function
int len = pub_gen_header(snd_buf,node_lst[node_num].callerid,node_lst[node_num].message_definition,node_lst[node_num].topic_name,node_lst[node_num].topic_type,"992ce8a1687cec8c8bd883ec73ca41d1"); //test function
lst.sock_vec[num].send(snd_buf,len);
node_lst[node_num].set_pub();
connect_status = false;
Expand Down Expand Up @@ -275,13 +275,12 @@ syslog(LOG_NOTICE, "========Activate mROS PUBLISH========");
memcpy(rbuf,&mem[PUB_ADDR],size);
rbuf[size] = '\0'; //cutting data end
/**for string data**/
//int l = pub_gen_msg(buf,rbuf);
int l = pub_gen_msg(buf,rbuf);
/**for image data**/
int l = pub_gen_img_msg(buf,rbuf,size);
//int l = pub_gen_img_msg(buf,rbuf,size);
//publish
int err = lst.sock_vec[num].send(buf,l);
int number = errno;
ROS_INFO(buf);
if(err < 0) ROS_INFO("PUB_TASK: PUBLISHING ERROR ! [%d] errno=%d %s",err,number,strerror(number));
}else if(lst.stat_vec[num] == 1){
syslog(LOG_NOTICE,"PUB_TASK: internal data publish");
Expand Down Expand Up @@ -614,7 +613,7 @@ void xml_mas_task(){
#endif
while(1){
syslog(LOG_NOTICE,"XML_MAS_TASK: enter loop");
TCPSocketConnecti行番号on xml_mas_sock;
TCPSocketConnection xml_mas_sock;
xml_mas_sock.set_blocking(true,1500);
rcv_dtq(XML_DTQ,dq);
syslog(LOG_NOTICE,"XML_MAS_TASK: receive dtq");
Expand Down Expand Up @@ -696,7 +695,7 @@ void xml_mas_task(){
if(num != -1){
syslog(LOG_NOTICE,"XML_MAS_TASK: request node [ID:%x, topic:%s]",node_lst[num].ID,node_lst[num].topic_name.c_str());
string body = requestTopic(node_lst[num].callerid,node_lst[num].topic_name);
node_lst[num].ip = "192.168.100.113";
//node_lst[num].ip = "192.168.100.113";
syslog(LOG_NOTICE,"XML_MAS_TASK: ip[%s],port[%d]",node_lst[num].ip.c_str(),node_lst[num].port);
//syslog(LOG_NOTICE,"XML_MAS_TASK: %s",body.c_str());
int le = xml_mas_sock.connect(node_lst[num].ip.c_str(),node_lst[num].port);
Expand Down

0 comments on commit 57be743

Please sign in to comment.