joint_traj_pt_full.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Southwest Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Southwest Research Institute, nor the names
16  * of its contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef JOINT_TRAJ_PT_FULL_H
33 #define JOINT_TRAJ_PT_FULL_H
34 
35 #ifndef FLATHEADERS
40 #else
41 #include "joint_data.h"
42 #include "simple_message.h"
43 #include "simple_serialize.h"
44 #include "shared_types.h"
45 #endif
46 
47 namespace industrial
48 {
49 namespace joint_traj_pt_full
50 {
51 
52 namespace SpecialSeqValues
53 {
55 {
61 };
62 }
64 
65 namespace ValidFieldTypes
66 {
68 {
69  TIME = 0x01, POSITION = 0x02, VELOCITY = 0x04, ACCELERATION = 0x08
70 };
71 }
73 
101 {
102 public:
103 
110  JointTrajPtFull(void);
115  ~JointTrajPtFull(void);
116 
121  void init();
122 
127  void init(industrial::shared_types::shared_int robot_id,
133  industrial::joint_data::JointData & accelerations);
134 
142  {
143  this->robot_id_ = robot_id;
144  }
145 
153  {
154  return this->robot_id_;
155  }
156 
163  {
164  this->sequence_ = sequence;
165  }
166 
173  {
174  return this->sequence_;
175  }
176 
183  {
184  this->time_ = time;
185  this->valid_fields_ |= ValidFieldTypes::TIME; // set the bit
186  }
187 
195  {
196  time = this->time_;
197  return is_valid(ValidFieldTypes::TIME);
198  }
199 
203  void clearTime()
204  {
205  this->time_ = 0;
206  this->valid_fields_ &= ~ValidFieldTypes::TIME; // clear the bit
207  }
208 
215  {
216  this->positions_.copyFrom(positions);
217  this->valid_fields_ |= ValidFieldTypes::POSITION; // set the bit
218  }
219 
227  {
228  dest.copyFrom(this->positions_);
229  return is_valid(ValidFieldTypes::POSITION);
230  }
231 
236  {
237  this->positions_.init();
238  this->valid_fields_ &= ~ValidFieldTypes::POSITION; // clear the bit
239  }
240 
247  {
248  this->velocities_.copyFrom(velocities);
249  this->valid_fields_ |= ValidFieldTypes::VELOCITY; // set the bit
250  }
251 
259  {
260  dest.copyFrom(this->velocities_);
261  return is_valid(ValidFieldTypes::VELOCITY);
262  }
263 
268  {
269  this->velocities_.init();
270  this->valid_fields_ &= ~ValidFieldTypes::VELOCITY; // clear the bit
271  }
278  {
279  this->accelerations_.copyFrom(accelerations);
280  this->valid_fields_ |= ValidFieldTypes::ACCELERATION; // set the bit
281  }
282 
290  {
291  dest.copyFrom(this->accelerations_);
292  return is_valid(ValidFieldTypes::ACCELERATION);
293  }
294 
299  {
300  this->accelerations_.init();
301  this->valid_fields_ &= ~ValidFieldTypes::ACCELERATION; // clear the bit
302  }
303 
304 
310  void copyFrom(JointTrajPtFull &src);
311 
317  bool operator==(JointTrajPtFull &rhs);
318 
324  bool is_valid(ValidFieldType field)
325  {
326  return valid_fields_ & field;
327  }
328 
329  // Overrides - SimpleSerialize
330  bool load(industrial::byte_array::ByteArray *buffer);
331  bool unload(industrial::byte_array::ByteArray *buffer);
332  unsigned int byteLength()
333  {
335  + 3*this->positions_.byteLength();
336  }
337 
338 private:
339 
358 
370 
371 };
372 
373 }
374 }
375 
376 #endif /* JOINT_TRAJ_PT_FULL_H */
industrial::shared_types::shared_int robot_id_
robot group # (0-based) for controllers that support multiple axis-groups
Downloading drivers only: signal start of trajectory.
void setSequence(industrial::shared_types::shared_int sequence)
Sets joint trajectory point sequence number.
bool getTime(industrial::shared_types::shared_real &time)
Returns joint trajectory point timestamp.
void init(const M_string &remappings)
void setTime(industrial::shared_types::shared_real time)
Sets joint trajectory point timestamp.
void clearAccelerations()
Clears the acceleration data.
industrial::joint_data::JointData accelerations_
joint trajectory point acceleration data
void clearVelocities()
Clears the velocity data.
bool is_valid(ValidFieldType field)
check the validity state for a given field
void setVelocities(industrial::joint_data::JointData &velocities)
Sets joint velocity data.
industrial::shared_types::shared_int valid_fields_
bit-mask of (optional) fields that have been initialized with valid data
Interface for loading and unloading a class to/from a ByteArray.
Server should stop the current motion (if any) as soon as possible.
industrial::shared_types::shared_int getRobotID()
Gets robot_id. Robot group # (0-based), for controllers with multiple axis-groups.
bool getPositions(industrial::joint_data::JointData &dest)
Returns a copy of the position data.
industrial::joint_data::JointData velocities_
joint trajectory point velocity data
deprecated, please use START_TRAJECTORY_STREAMING instead
Downloading drivers only: signal end of trajectory.
void copyFrom(JointData &src)
Copies the passed in value.
Definition: joint_data.cpp:107
The byte array wraps a dynamic array of bytes (i.e. char).
Definition: byte_array.h:80
unsigned int byteLength()
Virtual method returns the object size when packed into a ByteArray.
void clearPositions()
Clears the position data.
Class encapsulated joint data (positions, accelerations, velocity, torque, and/or effort)...
Definition: joint_data.h:68
void setRobotID(industrial::shared_types::shared_int robot_id)
Sets robot_id. Robot group # (0-based), for controllers with multiple axis-groups.
void setPositions(industrial::joint_data::JointData &positions)
Sets joint position data.
Class encapsulated joint trajectory point data. The point data serves as a waypoint along a trajector...
bool getAccelerations(industrial::joint_data::JointData &dest)
Returns a copy of the acceleration data.
industrial::shared_types::shared_int sequence_
trajectory sequence number
ValidFieldTypes::ValidFieldType ValidFieldType
void setAccelerations(industrial::joint_data::JointData &accelerations)
Sets joint acceleration data.
industrial::shared_types::shared_int getSequence()
Returns joint trajectory point sequence number.
industrial::shared_types::shared_real time_
joint trajectory point timestamp Typically, time_from_start of this trajectory (in seconds) ...
industrial::joint_data::JointData positions_
joint trajectory point positional data
void clearTime()
Clears the joint trajectory point timestamp.
bool getVelocities(industrial::joint_data::JointData &dest)
Returns a copy of the velocity data.


simple_message
Author(s): Shaun Edwards
autogenerated on Sat Sep 21 2019 03:30:09