Skip to content

Commit 0eae79d

Browse files
author
Felix Exner
committed
Implemented consuming for all primary types
Also removed unused datatypes
1 parent 5ffbe23 commit 0eae79d

File tree

15 files changed

+115
-246
lines changed

15 files changed

+115
-246
lines changed

ur_robot_driver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ add_library(ur_robot_driver
8989
#src/ur/robot_mode.cpp
9090
src/primary/primary_package.cpp
9191
src/primary/robot_message.cpp
92+
src/primary/robot_state.cpp
9293
src/primary/robot_message/version_message.cpp
9394
src/primary/robot_state/kinematics_info.cpp
9495
src/rtde/control_package_pause.cpp

ur_robot_driver/include/ur_robot_driver/primary/abstract_primary_consumer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class AbstractPrimaryConsumer : public comm::IConsumer<PrimaryPackage>
6868
}
6969

7070
// To be implemented in specific consumers
71-
virtual bool consume(PrimaryPackage& pkg) = 0;
71+
virtual bool consume(RobotMessage& pkg) = 0;
72+
virtual bool consume(RobotState& pkg) = 0;
7273
virtual bool consume(VersionMessage& pkg) = 0;
7374
virtual bool consume(KinematicsInfo& pkg) = 0;
7475

ur_robot_driver/include/ur_robot_driver/primary/primary_package.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PrimaryPackage : public comm::URPackage<PackageHeader>
7171
*
7272
* \returns true on success
7373
*/
74-
virtual bool consumeWith(AbstractPrimaryConsumer& consumer);
74+
virtual bool consumeWith(AbstractPrimaryConsumer& consumer) = 0;
7575

7676
/*!
7777
* \brief Produces a human readable representation of the package object.

ur_robot_driver/include/ur_robot_driver/primary/primary_parser.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#include "ur_robot_driver/primary/package_header.h"
2727
#include "ur_robot_driver/primary/robot_state.h"
2828
#include "ur_robot_driver/primary/robot_message.h"
29-
//#include "ur_robot_driver/primary/robot_state/robot_mode_data.h"
3029
#include "ur_robot_driver/primary/robot_state/kinematics_info.h"
31-
//#include "ur_robot_driver/primary/robot_state/master_board.h"
3230
#include "ur_robot_driver/primary/robot_message/version_message.h"
3331

3432
namespace ur_driver

ur_robot_driver/include/ur_robot_driver/primary/robot_message.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ class RobotMessage : public PrimaryPackage
7777
*/
7878
virtual bool parseWith(comm::BinParser& bp);
7979

80+
/*!
81+
* \brief Consume this package with a specific consumer.
82+
*
83+
* \param consumer Placeholder for the consumer calling this
84+
*
85+
* \returns true on success
86+
*/
87+
virtual bool consumeWith(AbstractPrimaryConsumer& consumer);
88+
8089
/*!
8190
* \brief Produces a human readable representation of the package object.
8291
*

ur_robot_driver/include/ur_robot_driver/primary/robot_message/version_message.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class VersionMessage : public RobotMessage
6262
*/
6363
virtual bool parseWith(comm::BinParser& bp);
6464

65+
/*!
66+
* \brief Consume this package with a specific consumer.
67+
*
68+
* \param consumer Placeholder for the consumer calling this
69+
*
70+
* \returns true on success
71+
*/
72+
virtual bool consumeWith(AbstractPrimaryConsumer& consumer);
73+
6574
/*!
6675
* \brief Produces a human readable representation of the package object.
6776
*

ur_robot_driver/include/ur_robot_driver/primary/robot_state.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,23 @@ class RobotState : public PrimaryPackage
7777
*
7878
* \returns True, if the package was parsed successfully, false otherwise
7979
*/
80-
virtual bool parseWith(comm::BinParser& bp)
81-
{
82-
return PrimaryPackage::parseWith(bp);
83-
}
80+
virtual bool parseWith(comm::BinParser& bp);
81+
82+
/*!
83+
* \brief Consume this specific package with a specific consumer.
84+
*
85+
* \param consumer Placeholder for the consumer calling this
86+
*
87+
* \returns true on success
88+
*/
89+
virtual bool consumeWith(AbstractPrimaryConsumer& consumer);
8490

8591
/*!
8692
* \brief Produces a human readable representation of the package object.
8793
*
8894
* \returns A string representing the object
8995
*/
90-
virtual std::string toString() const
91-
{
92-
std::stringstream ss;
93-
ss << "Type: " << static_cast<int>(state_type_) << std::endl;
94-
ss << PrimaryPackage::toString();
95-
return ss.str();
96-
}
96+
virtual std::string toString() const;
9797

9898
private:
9999
RobotStateType state_type_;

ur_robot_driver/include/ur_robot_driver/primary/robot_state/kinematics_info.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ class KinematicsInfo : public RobotState
6363
*/
6464
virtual bool parseWith(comm::BinParser& bp);
6565

66+
/*!
67+
* \brief Consume this specific package with a specific consumer.
68+
*
69+
* \param consumer Placeholder for the consumer calling this
70+
*
71+
* \returns true on success
72+
*/
73+
virtual bool consumeWith(AbstractPrimaryConsumer& consumer);
74+
6675
/*!
6776
* \brief Produces a human readable representation of the package object.
6877
*

ur_robot_driver/include/ur_robot_driver/primary/robot_state/master_board.h

Lines changed: 0 additions & 117 deletions
This file was deleted.

ur_robot_driver/include/ur_robot_driver/primary/robot_state/robot_mode_data.h

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)