Skip to content

Commit 5e3efad

Browse files
committed
fix: adjustments for gcc11 and gcc12
1 parent 967e8ca commit 5e3efad

File tree

13 files changed

+222
-210
lines changed

13 files changed

+222
-210
lines changed

src/detect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ auto readDetailedInfosFromUnknown(dynamixel::USB2Dynamixel& usb2dyn, std::vector
3838
int successfullTransactions = 0;
3939

4040
std::vector<std::tuple<MotorID, int, size_t>> request;
41-
for (auto const [g_id, modelNumber] : motors) {
41+
for (auto const& [g_id, modelNumber] : motors) {
4242
request.push_back(std::make_tuple(g_id, int(mx_v1::Register::MODEL_NUMBER), 74));
4343
}
4444
auto response = usb2dyn.bulk_read(request, timeout);

src/simplyfile/Epoll.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
#include "FileDescriptor.h"
44

5+
#include <chrono>
56
#include <memory>
7+
#include <string>
68
#include <sys/epoll.h>
7-
#include <chrono>
89

910
namespace simplyfile
1011
{

src/simplyfile/Event.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
#include "FileDescriptor.h"
44

55
#include <sys/eventfd.h>
6+
#include <stdexcept>
67

78
namespace simplyfile
89
{
910

1011
struct Event : FileDescriptor {
11-
Event(int flags=0, int initval=0) noexcept
12+
Event(int flags=0, int initval=0) noexcept
1213
: FileDescriptor(eventfd(initval, flags))
1314
{}
1415

src/simplyfile/SerialPort.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "FileDescriptor.h"
44

5+
#include <string>
6+
57
namespace simplyfile
68
{
79

src/simplyfile/Timer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "Timer.h"
22

33
#include <cstring>
4-
#include <time.h>
4+
#include <ctime>
5+
#include <stdexcept>
6+
#include <string>
57

68

79
namespace simplyfile {

src/simplyfile/socket/Socket.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
#include <sys/ioctl.h>
2-
#include <cstring>
3-
#include <errno.h>
41
#include "Socket.h"
5-
#include <unistd.h>
2+
3+
#include <cstring>
4+
#include <cerrno>
5+
#include <stdexcept>
6+
#include <sys/ioctl.h>
67
#include <sys/un.h>
8+
#include <unistd.h>
79

810
namespace simplyfile
911
{

src/usb2dynamixel/LayoutAX.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,38 @@ auto MotorLayoutInfo::getDefaults() -> std::map<uint32_t, meta::Info<Register>>
5656
LayoutType::AX,
5757
"AX-12W",
5858
{"AX-12W"}, {
59-
{Register::MODEL_NUMBER , { 300, {}}},
60-
{Register::FIRMWARE_VERSION , { {}, {}}},
61-
{Register::ID , { 1, {}}},
62-
{Register::BAUD_RATE , { 1, {}}},
63-
{Register::RETURN_DELAY_TIME , { 250, {}}},
64-
{Register::CW_ANGLE_LIMIT , { 0, convertPosition}},
65-
{Register::CCW_ANGLE_LIMIT , {0x03ff, convertPosition}},
66-
{Register::TEMPERATURE_LIMIT , { 70, convertTemperature}},
67-
{Register::MIN_VOLTAGE_LIMIT , { 60, convertVoltage}},
68-
{Register::MAX_VOLTAGE_LIMIT , { 140, convertVoltage}},
69-
{Register::MAX_TORQUE , {0x03ff, convertTorque}},
70-
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
71-
{Register::ALARM_LED , { 36, {}}},
72-
{Register::SHUTDOWN , { 36, {}}},
73-
{Register::TORQUE_ENABLE , { 0, {}}},
74-
{Register::LED , { 0, {}}},
75-
{Register::CW_COMPLIANCE_MARGIN , { 4, {}}},
76-
{Register::CCW_COMPLIANCE_MARGIN, { 4, {}}},
77-
{Register::CW_COMPLIANCE_SLOPE , { 64, {}}},
78-
{Register::CCW_COMPLIANCE_SLOPE , { 64, {}}},
79-
{Register::GOAL_POSITION , { {}, convertPosition}},
80-
{Register::MOVING_SPEED , { {}, convertSpeed}},
81-
{Register::TORQUE_LIMIT , { {}, convertTorque}},
82-
{Register::PRESENT_POSITION , { {}, convertPosition}},
83-
{Register::PRESENT_SPEED , { {}, convertSpeed}},
84-
{Register::PRESENT_LOAD , { {}, {}}},
85-
{Register::PRESENT_VOLTAGE , { {}, convertVoltage}},
86-
{Register::PRESENT_TEMPERATURE , { {}, convertTemperature}},
87-
{Register::REGISTERED , { 0, {}}},
88-
{Register::MOVING , { 0, {}}},
89-
{Register::LOCK , { 0, {}}},
90-
{Register::PUNCH , { 32, {}}},
59+
{Register::MODEL_NUMBER , { 300, {}}},
60+
{Register::FIRMWARE_VERSION , { std::nullopt, {}}},
61+
{Register::ID , { 1, {}}},
62+
{Register::BAUD_RATE , { 1, {}}},
63+
{Register::RETURN_DELAY_TIME , { 250, {}}},
64+
{Register::CW_ANGLE_LIMIT , { 0, convertPosition}},
65+
{Register::CCW_ANGLE_LIMIT , { 0x03ff, convertPosition}},
66+
{Register::TEMPERATURE_LIMIT , { 70, convertTemperature}},
67+
{Register::MIN_VOLTAGE_LIMIT , { 60, convertVoltage}},
68+
{Register::MAX_VOLTAGE_LIMIT , { 140, convertVoltage}},
69+
{Register::MAX_TORQUE , { 0x03ff, convertTorque}},
70+
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
71+
{Register::ALARM_LED , { 36, {}}},
72+
{Register::SHUTDOWN , { 36, {}}},
73+
{Register::TORQUE_ENABLE , { 0, {}}},
74+
{Register::LED , { 0, {}}},
75+
{Register::CW_COMPLIANCE_MARGIN , { 4, {}}},
76+
{Register::CCW_COMPLIANCE_MARGIN, { 4, {}}},
77+
{Register::CW_COMPLIANCE_SLOPE , { 64, {}}},
78+
{Register::CCW_COMPLIANCE_SLOPE , { 64, {}}},
79+
{Register::GOAL_POSITION , { std::nullopt, convertPosition}},
80+
{Register::MOVING_SPEED , { std::nullopt, convertSpeed}},
81+
{Register::TORQUE_LIMIT , { std::nullopt, convertTorque}},
82+
{Register::PRESENT_POSITION , { std::nullopt, convertPosition}},
83+
{Register::PRESENT_SPEED , { std::nullopt, convertSpeed}},
84+
{Register::PRESENT_LOAD , { std::nullopt, {}}},
85+
{Register::PRESENT_VOLTAGE , { std::nullopt, convertVoltage}},
86+
{Register::PRESENT_TEMPERATURE , { std::nullopt, convertTemperature}},
87+
{Register::REGISTERED , { 0, {}}},
88+
{Register::MOVING , { 0, {}}},
89+
{Register::LOCK , { 0, {}}},
90+
{Register::PUNCH , { 32, {}}},
9191
}
9292
}}
9393
};

src/usb2dynamixel/LayoutMX_V1.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,45 +77,45 @@ auto MotorLayoutInfo::getDefaults() -> std::map<uint32_t, meta::Info<Register>>
7777
LayoutType::MX_V1,
7878
"MX106",
7979
{"MX-106T", "MX-106R"}, {
80-
{Register::MODEL_NUMBER , { 320, {}}},
81-
{Register::VERSION_FIRMWARE , { {}, {}}},
82-
{Register::ID , { 1, {}}},
83-
{Register::BAUD_RATE , { 34, {}}},
84-
{Register::RETURN_DELAY_TIME , { 250, {}}},
85-
{Register::CW_ANGLE_LIMIT , { 0, convertPosition}},
86-
{Register::CCW_ANGLE_LIMIT , {0x0fff, convertPosition}},
87-
{Register::DRIVE_MODE , { 0, {}}},
88-
{Register::TEMPERATURE_LIMIT , { 80, convertTemperature}},
89-
{Register::VOLTAGE_LIMIT_LOW , { 60, convertVoltage}},
90-
{Register::VOLTAGE_LIMIT_HIGH , { 160, convertVoltage}},
91-
{Register::MAX_TORQUE , {0x03ff, convertTorque}},
92-
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
93-
{Register::ALARM_LED , { 36, {}}},
94-
{Register::ALARM_SHUTDOWN , { 36, {}}},
95-
{Register::MULTI_TURN_OFFSET , { 0, {}}},
96-
{Register::RESOLUTION_DIVIDER , { 1, {}}},
97-
{Register::TORQUE_ENABLE , { 0, {}}},
98-
{Register::LED , { 0, {}}},
99-
{Register::D_GAIN , { 0, convertPID_D}},
100-
{Register::I_GAIN , { 0, convertPID_I}},
101-
{Register::P_GAIN , { 32, convertPID_P}},
102-
{Register::GOAL_POSITION , { {}, convertPosition}},
103-
{Register::MOVING_SPEED , { {}, convertSpeed}},
104-
{Register::TORQUE_LIMIT , { {}, convertTorque}},
105-
{Register::PRESENT_POSITION , { {}, convertPosition}},
106-
{Register::PRESENT_SPEED , { {}, convertSpeed}},
107-
{Register::PRESENT_LOAD , { {}, {}}},
108-
{Register::PRESENT_VOLTAGE , { {}, convertVoltage}},
109-
{Register::PRESENT_TEMPERATURE , { {}, convertTemperature}},
110-
{Register::REGISTERED , { 0, {}}},
111-
{Register::MOVING , { 0, {}}},
112-
{Register::LOCK , { 0, {}}},
113-
{Register::PUNCH , { 0, {}}},
114-
{Register::REALTIME_TICK , { 0, {}}},
115-
{Register::CURRENT , { 2048, convertCurrent}},
116-
{Register::TORQUE_CONTROL_MODE , { 0, {}}},
117-
{Register::GOAL_TORQUE , { 0, convertTorque}},
118-
{Register::GOAL_ACCELERATION , { 0, {}}},
80+
{Register::MODEL_NUMBER , { 320, {}}},
81+
{Register::VERSION_FIRMWARE , { std::nullopt, {}}},
82+
{Register::ID , { 1, {}}},
83+
{Register::BAUD_RATE , { 34, {}}},
84+
{Register::RETURN_DELAY_TIME , { 250, {}}},
85+
{Register::CW_ANGLE_LIMIT , { 0, convertPosition}},
86+
{Register::CCW_ANGLE_LIMIT , { 0x0fff, convertPosition}},
87+
{Register::DRIVE_MODE , { 0, {}}},
88+
{Register::TEMPERATURE_LIMIT , { 80, convertTemperature}},
89+
{Register::VOLTAGE_LIMIT_LOW , { 60, convertVoltage}},
90+
{Register::VOLTAGE_LIMIT_HIGH , { 160, convertVoltage}},
91+
{Register::MAX_TORQUE , { 0x03ff, convertTorque}},
92+
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
93+
{Register::ALARM_LED , { 36, {}}},
94+
{Register::ALARM_SHUTDOWN , { 36, {}}},
95+
{Register::MULTI_TURN_OFFSET , { 0, {}}},
96+
{Register::RESOLUTION_DIVIDER , { 1, {}}},
97+
{Register::TORQUE_ENABLE , { 0, {}}},
98+
{Register::LED , { 0, {}}},
99+
{Register::D_GAIN , { 0, convertPID_D}},
100+
{Register::I_GAIN , { 0, convertPID_I}},
101+
{Register::P_GAIN , { 32, convertPID_P}},
102+
{Register::GOAL_POSITION , { std::nullopt, convertPosition}},
103+
{Register::MOVING_SPEED , { std::nullopt, convertSpeed}},
104+
{Register::TORQUE_LIMIT , { std::nullopt, convertTorque}},
105+
{Register::PRESENT_POSITION , { std::nullopt, convertPosition}},
106+
{Register::PRESENT_SPEED , { std::nullopt, convertSpeed}},
107+
{Register::PRESENT_LOAD , { std::nullopt, {}}},
108+
{Register::PRESENT_VOLTAGE , { std::nullopt, convertVoltage}},
109+
{Register::PRESENT_TEMPERATURE , { std::nullopt, convertTemperature}},
110+
{Register::REGISTERED , { 0, {}}},
111+
{Register::MOVING , { 0, {}}},
112+
{Register::LOCK , { 0, {}}},
113+
{Register::PUNCH , { 0, {}}},
114+
{Register::REALTIME_TICK , { 0, {}}},
115+
{Register::CURRENT , { 2048, convertCurrent}},
116+
{Register::TORQUE_CONTROL_MODE , { 0, {}}},
117+
{Register::GOAL_TORQUE , { 0, convertTorque}},
118+
{Register::GOAL_ACCELERATION , { 0, {}}},
119119
}
120120
}}
121121
};

src/usb2dynamixel/LayoutMX_V2.cpp

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -82,58 +82,58 @@ auto MotorLayoutInfo::getDefaults() -> std::map<uint32_t, meta::Info<Register>>
8282
LayoutType::MX_V2,
8383
"XM430-W350",
8484
{"XM430-W350-T", "XM430-W350-R"}, {
85-
{Register::MODEL_NUMBER , { 1020, {}}},
86-
{Register::MODEL_INFORMATION , { {}, {}}},
87-
{Register::VERSION_FIRMWARE , { {}, {}}},
88-
{Register::ID , { 1, {}}},
89-
{Register::BAUD_RATE , { 1, {}}},
90-
{Register::RETURN_DELAY_TIME , { 250, {}}},
91-
{Register::DRIVE_MODE , { 0, {}}},
92-
{Register::OPERATING_MODE , { 3, {}}},
93-
{Register::SECONDARY_ID , { 255, {}}},
94-
{Register::PROTOCOL_VERSION , { 2, {}}},
95-
{Register::HOMING_OFFSET , { 0, {}}},
96-
{Register::MOVING_THRESHOLD , { 10, {}}},
97-
{Register::TEMPERATURE_LIMIT , { 80, convertTemperature}},
98-
{Register::MAX_VOLTAGE_LIMIT , { 160, convertVoltage}},
99-
{Register::MIN_VOLTAGE_LIMIT , { 95, convertVoltage}},
100-
{Register::PWM_LIMIT , { 885, {}}},
101-
{Register::CURRENT_LIMIT , { 1193, convertCurrent}},
102-
{Register::ACCELERATION_LIMIT , {32767, {}}},
103-
{Register::VELOCITY_LIMIT , { 200, convertSpeed}},
104-
{Register::MAX_POSITION_LIMIT , { 4095, convertPosition}},
105-
{Register::MIN_POSITION_LIMIT , { 0, convertPosition}},
106-
{Register::SHUTDOWN , { 52, {}}},
107-
{Register::TORQUE_ENABLE , { 0, {}}},
108-
{Register::LED , { 0, {}}},
109-
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
110-
{Register::REGISTERED_INSTRUCTION , { 0, {}}},
111-
{Register::HARDWARE_ERROR_STATUS , { 0, {}}},
112-
{Register::VELOCITY_I_GAIN , { 1920, {}}},
113-
{Register::VELOCITY_P_GAIN , { 100, {}}},
114-
{Register::POSITION_D_GAIN , { 0, convertPID_D}},
115-
{Register::POSITION_I_GAIN , { 0, convertPID_I}},
116-
{Register::POSITION_P_GAIN , { 800, convertPID_P}},
117-
{Register::FEEDFORWARD_2ND_GAIN , { 0, {}}},
118-
{Register::FEEDFORWARD_1ST_GAIN , { 0, {}}},
119-
{Register::BUS_WATCHDOG , { 0, {}}},
120-
{Register::GOAL_PWM , { {}, {}}},
121-
{Register::GOAL_CURRENT , { {}, convertCurrent}},
122-
{Register::GOAL_VELOCITY , { {}, convertSpeed}},
123-
{Register::PROFILE_ACCELERATION , { 0, {}}},
124-
{Register::PROFILE_VELOCITY , { 0, convertSpeed}},
125-
{Register::GOAL_POSITION , { {}, convertPosition}},
126-
{Register::REALTIME_TICK , { {}, {}}},
127-
{Register::MOVING , { 0, {}}},
128-
{Register::MOVING_STATUS , { 0, {}}},
129-
{Register::PRESENT_PWM , { {}, {}}},
130-
{Register::PRESENT_CURRENT , { {}, convertCurrent}},
131-
{Register::PRESENT_VELOCITY , { {}, convertSpeed}},
132-
{Register::PRESENT_POSITION , { {}, convertPosition}},
133-
{Register::VELOCITY_TRAJECTORY , { {}, convertSpeed}},
134-
{Register::POSITION_TRAJECTORY , { {}, convertPosition}},
135-
{Register::PRESENT_INPUT_VOLTAGE , { {}, convertVoltage}},
136-
{Register::PRESENT_TEMPERATURE , { {}, convertTemperature}},
85+
{Register::MODEL_NUMBER , { 1020, {}}},
86+
{Register::MODEL_INFORMATION , { std::nullopt, {}}},
87+
{Register::VERSION_FIRMWARE , { std::nullopt, {}}},
88+
{Register::ID , { 1, {}}},
89+
{Register::BAUD_RATE , { 1, {}}},
90+
{Register::RETURN_DELAY_TIME , { 250, {}}},
91+
{Register::DRIVE_MODE , { 0, {}}},
92+
{Register::OPERATING_MODE , { 3, {}}},
93+
{Register::SECONDARY_ID , { 255, {}}},
94+
{Register::PROTOCOL_VERSION , { 2, {}}},
95+
{Register::HOMING_OFFSET , { 0, {}}},
96+
{Register::MOVING_THRESHOLD , { 10, {}}},
97+
{Register::TEMPERATURE_LIMIT , { 80, convertTemperature}},
98+
{Register::MAX_VOLTAGE_LIMIT , { 160, convertVoltage}},
99+
{Register::MIN_VOLTAGE_LIMIT , { 95, convertVoltage}},
100+
{Register::PWM_LIMIT , { 885, {}}},
101+
{Register::CURRENT_LIMIT , { 1193, convertCurrent}},
102+
{Register::ACCELERATION_LIMIT , { 32767, {}}},
103+
{Register::VELOCITY_LIMIT , { 200, convertSpeed}},
104+
{Register::MAX_POSITION_LIMIT , { 4095, convertPosition}},
105+
{Register::MIN_POSITION_LIMIT , { 0, convertPosition}},
106+
{Register::SHUTDOWN , { 52, {}}},
107+
{Register::TORQUE_ENABLE , { 0, {}}},
108+
{Register::LED , { 0, {}}},
109+
{Register::STATUS_RETURN_LEVEL , { 2, {}}},
110+
{Register::REGISTERED_INSTRUCTION , { 0, {}}},
111+
{Register::HARDWARE_ERROR_STATUS , { 0, {}}},
112+
{Register::VELOCITY_I_GAIN , { 1920, {}}},
113+
{Register::VELOCITY_P_GAIN , { 100, {}}},
114+
{Register::POSITION_D_GAIN , { 0, convertPID_D}},
115+
{Register::POSITION_I_GAIN , { 0, convertPID_I}},
116+
{Register::POSITION_P_GAIN , { 800, convertPID_P}},
117+
{Register::FEEDFORWARD_2ND_GAIN , { 0, {}}},
118+
{Register::FEEDFORWARD_1ST_GAIN , { 0, {}}},
119+
{Register::BUS_WATCHDOG , { 0, {}}},
120+
{Register::GOAL_PWM , { std::nullopt, {}}},
121+
{Register::GOAL_CURRENT , { std::nullopt, convertCurrent}},
122+
{Register::GOAL_VELOCITY , { std::nullopt, convertSpeed}},
123+
{Register::PROFILE_ACCELERATION , { 0, {}}},
124+
{Register::PROFILE_VELOCITY , { 0, convertSpeed}},
125+
{Register::GOAL_POSITION , { std::nullopt, convertPosition}},
126+
{Register::REALTIME_TICK , { std::nullopt, {}}},
127+
{Register::MOVING , { 0, {}}},
128+
{Register::MOVING_STATUS , { 0, {}}},
129+
{Register::PRESENT_PWM , { std::nullopt, {}}},
130+
{Register::PRESENT_CURRENT , { std::nullopt, convertCurrent}},
131+
{Register::PRESENT_VELOCITY , { std::nullopt, convertSpeed}},
132+
{Register::PRESENT_POSITION , { std::nullopt, convertPosition}},
133+
{Register::VELOCITY_TRAJECTORY , { std::nullopt, convertSpeed}},
134+
{Register::POSITION_TRAJECTORY , { std::nullopt, convertPosition}},
135+
{Register::PRESENT_INPUT_VOLTAGE , { std::nullopt, convertVoltage}},
136+
{Register::PRESENT_TEMPERATURE , { std::nullopt, convertTemperature}},
137137
}
138138
}}
139139
};

src/usb2dynamixel/LayoutPart.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#include <cstring>
66
#include <functional>
77
#include <map>
8-
#include <vector>
8+
#include <optional>
99
#include <stdexcept>
10+
#include <vector>
1011

1112
namespace dynamixel {
1213

0 commit comments

Comments
 (0)