34 #include <std_msgs/Float64.h> 50 static const std::string joints[20] =
52 "ffj0",
"ffj3",
"ffj4",
53 "mfj0",
"mfj3",
"mfj4",
54 "rfj0",
"rfj3",
"rfj4",
55 "lfj0",
"lfj3",
"lfj4",
"lfj5",
56 "thj1",
"thj2",
"thj3",
"thj4",
"thj5",
60 static const std::string prefix =
"/sh_";
61 static const std::string suffix =
"_position_controller/command";
71 for (
unsigned int index_joint = 0; index_joint < 20; ++index_joint)
73 std::string joint_tmp = joints[index_joint];
94 std::map<std::string, ros::Publisher>::iterator publisher_iterator;
105 std_msgs::Float64 msg_to_send;
106 msg_to_send.data = target * 3.14159 / 360.0;
107 publisher_iterator->second.publish(msg_to_send);
132 int main(
int argc,
char **argv)
141 static const unsigned int length_targets = 1000;
142 std::vector<double> targets;
144 for (
unsigned int i = 0; i < length_targets; ++i)
146 double target =
static_cast<double>(i) / 1000.0 * 90.0;
147 targets.push_back(target);
151 unsigned int step = 0;
154 target_sender.
sendupdate(
"ffj3", targets[step % length_targets]);
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_WARN_STREAM(args)
ros::NodeHandle node_handle_
A node handle to be able to publish.
int main(int argc, char **argv)
std::map< std::string, ros::Publisher > publisher_map_
The map were the publishers are stored.
bool sendupdate(std::string joint_name, double target)