From 4b0d8812d2305a50a898d5895d1a22e60bbc3486 Mon Sep 17 00:00:00 2001 From: Bert Willaert Date: Mon, 26 Nov 2012 15:29:13 +0100 Subject: [PATCH] sending events functionality updated --- naxes_motion_control/src/nAxesGeneratorPos.cpp | 19 ++++++++++++++----- naxes_motion_control/src/nAxesGeneratorPos.hpp | 8 ++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/naxes_motion_control/src/nAxesGeneratorPos.cpp b/naxes_motion_control/src/nAxesGeneratorPos.cpp index 81f66dd..1eddad1 100644 --- a/naxes_motion_control/src/nAxesGeneratorPos.cpp +++ b/naxes_motion_control/src/nAxesGeneratorPos.cpp @@ -31,7 +31,12 @@ namespace motion_control nAxesGeneratorPos::nAxesGeneratorPos(const string& name) : TaskContext(name,PreOperational), - finished_event(name+"move_finished"), traj_finished_event(name+"traj_finished"), is_moving(false), isTrajMoving(false), trajIndex(0) + //stopped_event("e_"+name+"_stopped"), + moving_event("e_"+name+"_moving"), + configured_event("e_"+name+"_configured"), + move_finished_event("e_"+name+"_move_finished"), traj_finished_event("e_"+name+"_traj_finished"), + + is_moving(false), isTrajMoving(false), trajIndex(0) { //Creating TaskContext @@ -106,7 +111,7 @@ namespace motion_control p_d_port.setDataSample( p_d ); v_d.velocities.assign(num_axes,0); v_d_port.setDataSample( v_d ); - move_finished_port.setDataSample(finished_event); + move_finished_port.setDataSample(configured_event); return true; } @@ -146,9 +151,10 @@ namespace motion_control for (unsigned int i=0; imoveTraject(); } @@ -157,10 +163,13 @@ namespace motion_control p_d.positions[i] = motion_profile[i].Pos( time_passed ); v_d.velocities[i] = motion_profile[i].Vel( time_passed ); } + move_finished_port.write(moving_event); } p_d_port.write( p_d ); v_d_port.write( v_d ); } + //else + //move_finished_port.write(stopped_event); } void nAxesGeneratorPos::stopHook() diff --git a/naxes_motion_control/src/nAxesGeneratorPos.hpp b/naxes_motion_control/src/nAxesGeneratorPos.hpp index 585c2d3..50edbd8 100644 --- a/naxes_motion_control/src/nAxesGeneratorPos.hpp +++ b/naxes_motion_control/src/nAxesGeneratorPos.hpp @@ -148,7 +148,7 @@ namespace motion_control trajectory_msgs::JointTrajectory traject; bool isTrajMoving; unsigned int trajIndex; - std::string traj_finished_event; + protected: @@ -173,7 +173,11 @@ namespace motion_control double max_duration; bool is_moving; - std::string finished_event; + //std::string stopped_event; + std::string moving_event; + std::string configured_event; + std::string move_finished_event; + std::string traj_finished_event; protected: /// Vector with the maximum velocity of each axis std::vector v_max_prop; -- 1.7.4.1