main.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2018 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
17 /*
18  * main.cpp
19  *
20  * Created on: 2016. 2. 18.
21  * Author: Jay Song
22  */
23 
25 
27 
28 bool is_init_pose = false;
29 
30 void demoCommandCallback(const std_msgs::String::ConstPtr& msg)
31 {
32 
33  ROS_INFO_STREAM("[Demo] : receive [" << msg->data << "] msg " );
34 
35  if(msg->data == "ini_pose")
36  {
37  ROS_INFO("demo 1: go to initial pose");
39  is_init_pose = true;
40  ROS_INFO("[Demo] : please wait 5 seconds");
41  }
42  else if ( msg->data == "set_mode")
43  {
44  ROS_INFO("demo 2: set walking control mode");
45  setCtrlModule();
46  }
47  else if( msg->data == "forward" )
48  {
49  ROS_INFO("demo 4: forward walking");
50  walkForward();
51  }
52  else if( msg->data == "backward" )
53  {
54  ROS_INFO("demo 5: backward walking");
55  walkBackward();
56  }
57  else if( msg->data == "balance_on" )
58  {
59  ROS_INFO("demo 3: balance enable");
60  setBalanceOn();
61  }
62  else if( msg->data == "balance_off" )
63  {
64  ROS_INFO("demo 3: balance disable");
65  setBalanceOff();
66  }
67  else {
68  ROS_ERROR("Invalid Command!!!");
69  }
70 
71 
72 }
73 
74 int main(int argc, char **argv)
75 {
76  ros::init(argc, argv, "thormang3_walking_demo");
77 
78  ROS_INFO("ROBOTIS THORMANG3 Walking Simple Demo");
79 
80  initialize();
81 
82  ros::NodeHandle nh;
83  g_demo_command_sub = nh.subscribe("/robotis/walking_demo/command", 10, demoCommandCallback);
84 
85  ros::spin();
86  return 0;
87 }
88 
bool is_init_pose
Definition: main.cpp:28
void setBalanceOff()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
int main(int argc, char **argv)
Definition: main.cpp:74
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void walkForward()
void walkBackward()
ros::Subscriber g_demo_command_sub
Definition: main.cpp:26
void moveToInitPose()
void setCtrlModule()
#define ROS_INFO(...)
ROSCPP_DECL void spin()
void setBalanceOn()
#define ROS_INFO_STREAM(args)
void initialize()
#define ROS_ERROR(...)
void demoCommandCallback(const std_msgs::String::ConstPtr &msg)
Definition: main.cpp:30


thormang3_walking_demo
Author(s): Zerom , SCH , Kayman , Jay Song
autogenerated on Mon Jun 10 2019 15:39:39