Skip to content

Commit 90ea352

Browse files
committed
run ament_uncrustify
This is a formatting autofix Signed-off-by: Alex Moriarty <[email protected]>
1 parent 4722c30 commit 90ea352

File tree

9 files changed

+276
-266
lines changed

9 files changed

+276
-266
lines changed

robotiq_controllers/include/robotiq_controllers/robotiq_activation_controller.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,20 @@ class RobotiqActivationController : public controller_interface::ControllerInter
4141

4242
controller_interface::InterfaceConfiguration state_interface_configuration() const override;
4343

44-
controller_interface::return_type update(const rclcpp::Time& time, const rclcpp::Duration& period) override;
44+
controller_interface::return_type update(
45+
const rclcpp::Time & time,
46+
const rclcpp::Duration & period) override;
4547

46-
CallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override;
48+
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
4749

48-
CallbackReturn on_deactivate(const rclcpp_lifecycle::State& previous_state) override;
50+
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
4951

5052
CallbackReturn on_init() override;
5153

5254
private:
53-
bool reactivateGripper(std_srvs::srv::Trigger::Request::SharedPtr req,
54-
std_srvs::srv::Trigger::Response::SharedPtr resp);
55+
bool reactivateGripper(
56+
std_srvs::srv::Trigger::Request::SharedPtr req,
57+
std_srvs::srv::Trigger::Response::SharedPtr resp);
5558

5659
static constexpr double ASYNC_WAITING = 2.0;
5760
enum CommandInterfaces

robotiq_controllers/src/robotiq_activation_controller.cpp

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030

3131
namespace robotiq_controllers
3232
{
33-
controller_interface::InterfaceConfiguration RobotiqActivationController::command_interface_configuration() const
33+
controller_interface::InterfaceConfiguration RobotiqActivationController::
34+
command_interface_configuration() const
3435
{
3536
controller_interface::InterfaceConfiguration config;
3637
config.type = controller_interface::interface_configuration_type::INDIVIDUAL;
@@ -41,75 +42,73 @@ controller_interface::InterfaceConfiguration RobotiqActivationController::comman
4142
return config;
4243
}
4344

44-
controller_interface::InterfaceConfiguration RobotiqActivationController::state_interface_configuration() const
45+
controller_interface::InterfaceConfiguration RobotiqActivationController::
46+
state_interface_configuration() const
4547
{
4648
controller_interface::InterfaceConfiguration config;
4749
config.type = controller_interface::interface_configuration_type::INDIVIDUAL;
4850

4951
return config;
5052
}
5153

52-
controller_interface::return_type RobotiqActivationController::update(const rclcpp::Time& /*time*/,
53-
const rclcpp::Duration& /*period*/)
54+
controller_interface::return_type RobotiqActivationController::update(
55+
const rclcpp::Time & /*time*/,
56+
const rclcpp::Duration & /*period*/)
5457
{
5558
return controller_interface::return_type::OK;
5659
}
5760

5861
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
59-
RobotiqActivationController::on_activate(const rclcpp_lifecycle::State& /*previous_state*/)
62+
RobotiqActivationController::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
6063
{
6164
// Check command interfaces.
62-
if (command_interfaces_.size() != 2)
63-
{
64-
RCLCPP_ERROR(get_node()->get_logger(), "Expected %d command interfaces, but got %zu.", 2,
65-
command_interfaces_.size());
65+
if (command_interfaces_.size() != 2) {
66+
RCLCPP_ERROR(
67+
get_node()->get_logger(), "Expected %d command interfaces, but got %zu.", 2,
68+
command_interfaces_.size());
6669
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::ERROR;
6770
}
6871

69-
try
70-
{
72+
try {
7173
// Create service for re-activating the gripper.
7274
reactivate_gripper_srv_ = get_node()->create_service<std_srvs::srv::Trigger>(
73-
"~/reactivate_gripper",
74-
[this](std_srvs::srv::Trigger::Request::SharedPtr req, std_srvs::srv::Trigger::Response::SharedPtr resp) {
75-
this->reactivateGripper(req, resp);
76-
});
77-
}
78-
catch (...)
79-
{
75+
"~/reactivate_gripper",
76+
[this](std_srvs::srv::Trigger::Request::SharedPtr req,
77+
std_srvs::srv::Trigger::Response::SharedPtr resp) {
78+
this->reactivateGripper(req, resp);
79+
});
80+
} catch (...) {
8081
return LifecycleNodeInterface::CallbackReturn::ERROR;
8182
}
8283
return LifecycleNodeInterface::CallbackReturn::SUCCESS;
8384
}
8485

8586
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
86-
RobotiqActivationController::on_deactivate(const rclcpp_lifecycle::State& /*previous_state*/)
87+
RobotiqActivationController::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
8788
{
88-
try
89-
{
89+
try {
9090
reactivate_gripper_srv_.reset();
91-
}
92-
catch (...)
93-
{
91+
} catch (...) {
9492
return LifecycleNodeInterface::CallbackReturn::ERROR;
9593
}
9694

9795
return LifecycleNodeInterface::CallbackReturn::SUCCESS;
9896
}
9997

100-
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn RobotiqActivationController::on_init()
98+
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
99+
RobotiqActivationController::on_init()
101100
{
102101
return LifecycleNodeInterface::CallbackReturn::SUCCESS;
103102
}
104103

105-
bool RobotiqActivationController::reactivateGripper(std_srvs::srv::Trigger::Request::SharedPtr /*req*/,
106-
std_srvs::srv::Trigger::Response::SharedPtr resp)
104+
bool RobotiqActivationController::reactivateGripper(
105+
std_srvs::srv::Trigger::Request::SharedPtr /*req*/,
106+
std_srvs::srv::Trigger::Response::SharedPtr resp)
107107
{
108108
command_interfaces_[REACTIVATE_GRIPPER_RESPONSE].set_value(ASYNC_WAITING);
109109
command_interfaces_[REACTIVATE_GRIPPER_CMD].set_value(1.0);
110110

111-
while (command_interfaces_[REACTIVATE_GRIPPER_RESPONSE].get_value() == ASYNC_WAITING)
112-
{
111+
while (command_interfaces_[REACTIVATE_GRIPPER_RESPONSE].get_value() == ASYNC_WAITING) {
113112
std::this_thread::sleep_for(std::chrono::milliseconds(50));
114113
}
115114
resp->success = command_interfaces_[REACTIVATE_GRIPPER_RESPONSE].get_value();
@@ -120,4 +119,6 @@ bool RobotiqActivationController::reactivateGripper(std_srvs::srv::Trigger::Requ
120119

121120
#include "pluginlib/class_list_macros.hpp"
122121

123-
PLUGINLIB_EXPORT_CLASS(robotiq_controllers::RobotiqActivationController, controller_interface::ControllerInterface)
122+
PLUGINLIB_EXPORT_CLASS(
123+
robotiq_controllers::RobotiqActivationController,
124+
controller_interface::ControllerInterface)

robotiq_driver/include/robotiq_driver/crc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#include <vector>
44
#include <cstdint>
55

6-
uint16_t computeCRC(const std::vector<uint8_t>& cmd);
6+
uint16_t computeCRC(const std::vector<uint8_t> & cmd);

robotiq_driver/include/robotiq_driver/hardware_interface.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class RobotiqGripperHardwareInterface : public hardware_interface::SystemInterfa
5454
RobotiqGripperHardwareInterface();
5555

5656
ROBOTIQ_DRIVER_PUBLIC
57-
CallbackReturn on_init(const hardware_interface::HardwareInfo& info) override;
57+
CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
5858

5959
ROBOTIQ_DRIVER_PUBLIC
6060
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
@@ -63,16 +63,20 @@ class RobotiqGripperHardwareInterface : public hardware_interface::SystemInterfa
6363
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
6464

6565
ROBOTIQ_DRIVER_PUBLIC
66-
CallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override;
66+
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
6767

6868
ROBOTIQ_DRIVER_PUBLIC
69-
CallbackReturn on_deactivate(const rclcpp_lifecycle::State& previous_state) override;
69+
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
7070

7171
ROBOTIQ_DRIVER_PUBLIC
72-
hardware_interface::return_type read(const rclcpp::Time& time, const rclcpp::Duration& period) override;
72+
hardware_interface::return_type read(
73+
const rclcpp::Time & time,
74+
const rclcpp::Duration & period) override;
7375

7476
ROBOTIQ_DRIVER_PUBLIC
75-
hardware_interface::return_type write(const rclcpp::Time& time, const rclcpp::Duration& period) override;
77+
hardware_interface::return_type write(
78+
const rclcpp::Time & time,
79+
const rclcpp::Duration & period) override;
7680

7781
private:
7882
static constexpr double NO_NEW_CMD_ = std::numeric_limits<double>::quiet_NaN();

robotiq_driver/include/robotiq_driver/robotiq_gripper_interface.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
class RobotiqGripperInterface
4242
{
4343
public:
44-
RobotiqGripperInterface(const std::string& com_port = "/dev/ttyUSB0", uint8_t slave_id = 0x09);
44+
RobotiqGripperInterface(const std::string & com_port = "/dev/ttyUSB0", uint8_t slave_id = 0x09);
4545

4646
/**
4747
* @brief Activates the gripper.
@@ -122,7 +122,9 @@ class RobotiqGripperInterface
122122

123123
private:
124124
std::vector<uint8_t> createReadCommand(uint16_t first_register, uint8_t num_registers);
125-
std::vector<uint8_t> createWriteCommand(uint16_t first_register, const std::vector<uint16_t>& data);
125+
std::vector<uint8_t> createWriteCommand(
126+
uint16_t first_register,
127+
const std::vector<uint16_t> & data);
126128

127129
/**
128130
* @brief read response from the gripper.
@@ -138,7 +140,7 @@ class RobotiqGripperInterface
138140
* @param cmd The command.
139141
* @throw serial::IOException on failure to successfully communicate with gripper port
140142
*/
141-
void sendCommand(const std::vector<uint8_t>& cmd);
143+
void sendCommand(const std::vector<uint8_t> & cmd);
142144

143145
/**
144146
* @brief Read the current status of the gripper, and update member variables as appropriate.

robotiq_driver/src/crc.cpp

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,72 @@
22

33
/* Table of CRC values for high–order byte */
44
static unsigned char kCRCHiTable[] = {
5-
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80,
6-
0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
7-
0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
8-
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
9-
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
10-
0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
11-
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00,
12-
0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
13-
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80,
14-
0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
15-
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01,
16-
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
17-
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80,
5+
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
6+
0x01, 0xC0, 0x80,
7+
0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80,
8+
0x41, 0x00, 0xC1,
9+
0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
10+
0x80, 0x41, 0x01,
11+
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00,
12+
0xC1, 0x81, 0x40,
13+
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
14+
0x00, 0xC1, 0x81,
15+
0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
16+
0x40, 0x01, 0xC0,
17+
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
18+
0x80, 0x41, 0x00,
19+
0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01,
20+
0xC0, 0x80, 0x41,
21+
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
22+
0x01, 0xC0, 0x80,
23+
0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81,
24+
0x40, 0x01, 0xC0,
25+
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
26+
0x81, 0x40, 0x01,
27+
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
28+
0xC0, 0x80, 0x41,
29+
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
30+
0x01, 0xC0, 0x80,
1831
0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
1932
};
2033

2134
/* Table of CRC values for low–order byte */
2235
static unsigned char kCRCLoTable[] = {
23-
0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D,
24-
0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB,
25-
0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2,
26-
0x12, 0x13, 0xD3, 0x11, 0xD1, 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BB, 0x7B, 0x7A, 0xBA,
53+
0xBE, 0x7E, 0x7F,
54+
0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3,
55+
0x73, 0xB1, 0x71,
56+
0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95,
57+
0x94, 0x54, 0x9C,
58+
0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88,
59+
0x48, 0x49, 0x89,
60+
0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, 0x44, 0x84, 0x85, 0x45,
61+
0x87, 0x47, 0x46,
3662
0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40
3763
};
3864

39-
uint16_t computeCRC(const std::vector<uint8_t>& cmd)
65+
uint16_t computeCRC(const std::vector<uint8_t> & cmd)
4066
{
4167
uint16_t crc_hi = 0x00FF;
4268
uint16_t crc_lo = 0x00FF;
4369

44-
for (auto byte : cmd)
45-
{
70+
for (auto byte : cmd) {
4671
std::size_t index = crc_lo ^ byte;
4772
crc_lo = crc_hi ^ kCRCHiTable[index];
4873
crc_hi = kCRCLoTable[index];

robotiq_driver/src/gripper_interface_test.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ constexpr auto kSlaveID = 0x09;
3636

3737
int main()
3838
{
39-
try
40-
{
39+
try {
4140
RobotiqGripperInterface gripper(kComPort, kSlaveID);
4241

4342
std::cout << "Deactivating gripper...\n";
@@ -50,29 +49,25 @@ int main()
5049

5150
std::cout << "Closing gripper...\n";
5251
gripper.setGripperPosition(0xFF);
53-
while (gripper.gripperIsMoving())
54-
{
52+
while (gripper.gripperIsMoving()) {
5553
std::this_thread::sleep_for(std::chrono::milliseconds(500));
5654
}
5755

5856
std::cout << "Opening gripper...\n";
5957
gripper.setGripperPosition(0x00);
60-
while (gripper.gripperIsMoving())
61-
{
58+
while (gripper.gripperIsMoving()) {
6259
std::this_thread::sleep_for(std::chrono::milliseconds(500));
6360
}
6461

6562
std::cout << "Half closing gripper...\n";
6663
gripper.setGripperPosition(0x80);
67-
while (gripper.gripperIsMoving())
68-
{
64+
while (gripper.gripperIsMoving()) {
6965
std::this_thread::sleep_for(std::chrono::milliseconds(500));
7066
}
7167

7268
std::cout << "Opening gripper...\n";
7369
gripper.setGripperPosition(0x00);
74-
while (gripper.gripperIsMoving())
75-
{
70+
while (gripper.gripperIsMoving()) {
7671
std::this_thread::sleep_for(std::chrono::milliseconds(500));
7772
}
7873

@@ -81,8 +76,7 @@ int main()
8176

8277
std::cout << "Closing gripper...\n";
8378
gripper.setGripperPosition(0xFF);
84-
while (gripper.gripperIsMoving())
85-
{
79+
while (gripper.gripperIsMoving()) {
8680
std::this_thread::sleep_for(std::chrono::milliseconds(500));
8781
}
8882

@@ -91,13 +85,10 @@ int main()
9185

9286
std::cout << "Opening gripper...\n";
9387
gripper.setGripperPosition(0x00);
94-
while (gripper.gripperIsMoving())
95-
{
88+
while (gripper.gripperIsMoving()) {
9689
std::this_thread::sleep_for(std::chrono::milliseconds(500));
9790
}
98-
}
99-
catch (const serial::IOException& e)
100-
{
91+
} catch (const serial::IOException & e) {
10192
std::cout << "Failed to communicating with the Gripper. Please check the Gripper connection";
10293
return 1;
10394
}

0 commit comments

Comments
 (0)