44 #include <gtest/gtest.h> 63 const int tcpPort = TEST_PORT_BASE+401;
64 char ipAddr[] =
"127.0.0.1";
70 ASSERT_TRUE(send.
toTopic(msgSend));
74 ASSERT_TRUE(tcpServer.
init(tcpPort));
77 ASSERT_TRUE(tcpClient.
init(&ipAddr[0], tcpPort));
82 ASSERT_TRUE(tcpClient.
sendMsg(msgSend));
84 ASSERT_TRUE(recv.
init(msgRecv));
100 EXPECT_TRUE(joint.
setJoint(8, 9.0));
101 EXPECT_TRUE(joint.
setJoint(9, 10.0));
103 EXPECT_FALSE(joint.
setJoint(10, 11.0));
116 EXPECT_FALSE(jointlhs==jointrhs);
121 EXPECT_TRUE(jointlhs==jointrhs);
133 msg.
init(1, toMessage);
137 EXPECT_TRUE(toMessage==fromMessage);
159 jointSend.
init(1, posSend);
164 ASSERT_TRUE(posRecv==posSend);
173 ASSERT_TRUE(joint.
setJoint(0, 1.0));
174 ASSERT_TRUE(joint.
setJoint(1, 2.0));
175 ASSERT_TRUE(joint.
setJoint(2, 3.0));
176 ASSERT_TRUE(joint.
setJoint(3, 4.0));
177 ASSERT_TRUE(joint.
setJoint(4, 5.0));
178 ASSERT_TRUE(joint.
setJoint(5, 6.0));
179 ASSERT_TRUE(joint.
setJoint(6, 7.0));
180 ASSERT_TRUE(joint.
setJoint(7, 8.0));
181 ASSERT_TRUE(joint.
setJoint(8, 9.0));
182 ASSERT_TRUE(joint.
setJoint(9, 10.0));
184 rhs.
init(1.0, joint, 50.0, 100);
185 EXPECT_FALSE(lhs==rhs);
187 lhs.
init(0, joint, 0, 0);
188 EXPECT_FALSE(lhs==rhs);
191 EXPECT_TRUE(lhs==rhs);
206 EXPECT_TRUE(toMessage==fromMessage);
228 posSend.
init(1, data, 99, 100);
230 jointSend.
init(posSend);
235 ASSERT_TRUE(posRecv==posSend);
245 ASSERT_TRUE(joint.
setJoint(0, 1.0));
246 ASSERT_TRUE(joint.
setJoint(1, 2.0));
247 ASSERT_TRUE(joint.
setJoint(2, 3.0));
248 ASSERT_TRUE(joint.
setJoint(3, 4.0));
249 ASSERT_TRUE(joint.
setJoint(4, 5.0));
250 ASSERT_TRUE(joint.
setJoint(5, 6.0));
251 ASSERT_TRUE(joint.
setJoint(6, 7.0));
252 ASSERT_TRUE(joint.
setJoint(7, 8.0));
253 ASSERT_TRUE(joint.
setJoint(8, 9.0));
254 ASSERT_TRUE(joint.
setJoint(9, 10.0));
256 point.
init(1.0, joint, 50.0, 100);
258 EXPECT_FALSE(lhs==rhs);
261 EXPECT_TRUE(lhs==rhs);
264 EXPECT_FALSE(lhs==rhs);
267 EXPECT_TRUE(lhs==rhs);
293 EXPECT_TRUE(status==empty);
307 EXPECT_TRUE(lhs==rhs);
309 EXPECT_FALSE(lhs==rhs);
311 EXPECT_TRUE(lhs==rhs);
314 EXPECT_FALSE(lhs==rhs);
316 EXPECT_TRUE(lhs==rhs);
319 EXPECT_FALSE(lhs==rhs);
321 EXPECT_TRUE(lhs==rhs);
324 EXPECT_FALSE(lhs==rhs);
326 EXPECT_TRUE(lhs==rhs);
329 EXPECT_FALSE(lhs==rhs);
331 EXPECT_TRUE(lhs==rhs);
334 EXPECT_FALSE(lhs==rhs);
336 EXPECT_TRUE(lhs==rhs);
339 EXPECT_FALSE(lhs==rhs);
341 EXPECT_TRUE(lhs==rhs);
356 EXPECT_TRUE(toMessage==fromMessage);
368 statusMsgSend.
init(statusSend);
373 ASSERT_TRUE(statusRecv==statusSend);
virtual bool init(industrial::simple_message::SimpleMessage &msg)=0
Initializes message from a simple message.
Defines TCP server functions.
virtual bool sendMsg(industrial::simple_message::SimpleMessage &message)
Sends a message using the data connection.
void setInError(TriState inError)
TriState getMotionPossible()
Class encapsulated joint message generation methods (either to or from a SimpleMessage type...
virtual bool toTopic(industrial::simple_message::SimpleMessage &msg)
creates a simple_message topic
bool init(char *buff, int port_num)
initializes TCP client socket. Object can either be a client OR a server, NOT BOTH.
industrial::joint_traj_pt::JointTrajPt point_
void setMotionPossible(TriState motionPossible)
void setErrorCode(industrial::shared_types::shared_int errorCode)
void setMode(RobotMode mode)
This class defines a simple messaging protocol for communicating with an industrial robot controller...
void messagePassing(TypedMessage &send, TypedMessage &recv)
Class encapsulated robot status data. The robot status data is meant to mirror the industrial_msgs/Ro...
void setInMotion(TriState inMotion)
void setSequence(industrial::shared_types::shared_int sequence)
Sets joint trajectory point sequence number.
bool makeConnect()
connects to the remote host
bool init(industrial::simple_message::SimpleMessage &msg)
Initializes message from a simple message.
Class encapsulated joint trajectory point data. The point data serves as a waypoint along a trajector...
void init()
Initializes an empty robot status.
Message interface for typed messages built from SimpleMessage.
Class encapsulated robot status message generation methods (either to or from a industrial::simple_me...
bool addPoint(industrial::joint_traj_pt::JointTrajPt &point)
Adds a point value to the end of the buffer.
void copyFrom(JointData &src)
Copies the passed in value.
bool setJoint(industrial::shared_types::shared_int index, industrial::shared_types::shared_real value)
Sets a joint value within the buffer.
void copyFrom(JointTrajPt &src)
Copies the passed in value.
bool init(industrial::simple_message::SimpleMessage &msg)
Initializes message from a simple message.
virtual bool receiveMsg(industrial::simple_message::SimpleMessage &message)
Receives a message using the data connection.
void copyFrom(JointTraj &src)
Copies the passed in value.
Class encapsulated joint trajectory. A joint trajectory includes an array of JointTrajPt data types...
void copyFrom(RobotStatus &src)
Copies the passed in value.
Class encapsulated joint data (positions, accelerations, velocity, torque, and/or effort)...
Class encapsulated joint trajectory point message generation methods (either to or from a industrial:...
void init()
Initializes a empty joint data.
industrial::robot_status::RobotStatus status_
TriState getDrivesPowered()
industrial::shared_types::shared_int getErrorCode() const
void init()
Initializes a empty joint trajectory point.
bool makeConnect()
connects to the remote host
void setDrivesPowered(TriState drivesPowered)
void setEStopped(TriState eStopped)
bool init(industrial::simple_message::SimpleMessage &msg)
Initializes message from a simple message.
bool init(int port_num)
initializes TCP server socket. The connect method must be called following initialization in order to...
Defines TCP client functions.
industrial::joint_data::JointData & getJoints()
returns reference to underlying joint class