mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
Add time parameter to speedj for UR software >= 3.3
Fixes #15. Related to https://github.com/ThomasTimm/ur_modern_driver/issues/92
This commit is contained in:
committed by
Simon Rasmussen
parent
0611afcf40
commit
d7d84caee7
@@ -49,7 +49,27 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool speedj(std::array<double, 6> &speeds, double acceleration);
|
virtual bool speedj(std::array<double, 6> &speeds, double acceleration) = 0;
|
||||||
virtual bool setDigitalOut(uint8_t pin, bool value);
|
virtual bool setDigitalOut(uint8_t pin, bool value);
|
||||||
virtual bool setAnalogOut(uint8_t pin, double value);
|
virtual bool setAnalogOut(uint8_t pin, double value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class URCommander_V3_1__2 : public URCommander_V3_X
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
URCommander_V3_1__2(URStream &stream) : URCommander_V3_X(stream)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool speedj(std::array<double, 6> &speeds, double acceleration);
|
||||||
|
};
|
||||||
|
|
||||||
|
class URCommander_V3_3 : public URCommander_V3_X
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
URCommander_V3_3(URStream &stream) : URCommander_V3_X(stream)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool speedj(std::array<double, 6> &speeds, double acceleration);
|
||||||
|
};
|
||||||
|
|||||||
@@ -80,8 +80,10 @@ public:
|
|||||||
{
|
{
|
||||||
if (major_version_ == 1)
|
if (major_version_ == 1)
|
||||||
return std::unique_ptr<URCommander>(new URCommander_V1_X(stream));
|
return std::unique_ptr<URCommander>(new URCommander_V1_X(stream));
|
||||||
|
else if (minor_version_ < 3)
|
||||||
|
return std::unique_ptr<URCommander>(new URCommander_V3_1__2(stream));
|
||||||
else
|
else
|
||||||
return std::unique_ptr<URCommander>(new URCommander_V3_X(stream));
|
return std::unique_ptr<URCommander>(new URCommander_V3_3(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<URParser<StatePacket>> getStateParser()
|
std::unique_ptr<URParser<StatePacket>> getStateParser()
|
||||||
|
|||||||
@@ -86,16 +86,6 @@ bool URCommander_V1_X::setDigitalOut(uint8_t pin, bool value)
|
|||||||
return write(s);
|
return write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool URCommander_V3_X::speedj(std::array<double, 6> &speeds, double acceleration)
|
|
||||||
{
|
|
||||||
std::ostringstream out;
|
|
||||||
out << std::fixed << std::setprecision(5);
|
|
||||||
out << "speedj(";
|
|
||||||
formatArray(out, speeds);
|
|
||||||
out << "," << acceleration << ")\n";
|
|
||||||
std::string s(out.str());
|
|
||||||
return write(s);
|
|
||||||
}
|
|
||||||
bool URCommander_V3_X::setAnalogOut(uint8_t pin, double value)
|
bool URCommander_V3_X::setAnalogOut(uint8_t pin, double value)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
@@ -130,3 +120,25 @@ bool URCommander_V3_X::setDigitalOut(uint8_t pin, bool value)
|
|||||||
std::string s(out.str());
|
std::string s(out.str());
|
||||||
return write(s);
|
return write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool URCommander_V3_1__2::speedj(std::array<double, 6> &speeds, double acceleration)
|
||||||
|
{
|
||||||
|
std::ostringstream out;
|
||||||
|
out << std::fixed << std::setprecision(5);
|
||||||
|
out << "speedj(";
|
||||||
|
formatArray(out, speeds);
|
||||||
|
out << "," << acceleration << ")\n";
|
||||||
|
std::string s(out.str());
|
||||||
|
return write(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool URCommander_V3_3::speedj(std::array<double, 6> &speeds, double acceleration)
|
||||||
|
{
|
||||||
|
std::ostringstream out;
|
||||||
|
out << std::fixed << std::setprecision(5);
|
||||||
|
out << "speedj(";
|
||||||
|
formatArray(out, speeds);
|
||||||
|
out << "," << acceleration << "," << 0.008 << ")\n";
|
||||||
|
std::string s(out.str());
|
||||||
|
return write(s);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user