Robot: Apply clang format
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include "kdl_cp/chain.hpp"
|
||||
#include "kdl_cp/chain.hpp"
|
||||
#endif
|
||||
|
||||
#include <Base/Reader.h>
|
||||
@@ -32,12 +32,12 @@
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI 3.14159265358979323846 /* pi */
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI 3.14159265358979323846 /* pi */
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_2
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
#endif
|
||||
|
||||
using namespace Robot;
|
||||
@@ -45,10 +45,10 @@ using namespace Base;
|
||||
using namespace KDL;
|
||||
|
||||
|
||||
TYPESYSTEM_SOURCE(Robot::Waypoint , Base::Persistence)
|
||||
TYPESYSTEM_SOURCE(Robot::Waypoint, Base::Persistence)
|
||||
|
||||
Waypoint::Waypoint(const char* name,
|
||||
const Base::Placement &endPos,
|
||||
const Base::Placement& endPos,
|
||||
WaypointType type,
|
||||
float velocity,
|
||||
float acceleration,
|
||||
@@ -56,64 +56,67 @@ Waypoint::Waypoint(const char* name,
|
||||
unsigned int tool,
|
||||
unsigned int base)
|
||||
|
||||
: Name(name)
|
||||
, Type(type)
|
||||
, Velocity(velocity)
|
||||
, Acceleration(acceleration)
|
||||
, Cont(cont)
|
||||
, Tool(tool)
|
||||
, Base(base)
|
||||
, EndPos(endPos)
|
||||
{
|
||||
}
|
||||
: Name(name)
|
||||
, Type(type)
|
||||
, Velocity(velocity)
|
||||
, Acceleration(acceleration)
|
||||
, Cont(cont)
|
||||
, Tool(tool)
|
||||
, Base(base)
|
||||
, EndPos(endPos)
|
||||
{}
|
||||
|
||||
Waypoint::Waypoint()
|
||||
: Type(UNDEF)
|
||||
, Velocity(1000.0)
|
||||
, Acceleration(100.0)
|
||||
, Cont(false)
|
||||
, Tool(0)
|
||||
, Base(0)
|
||||
{
|
||||
}
|
||||
: Type(UNDEF)
|
||||
, Velocity(1000.0)
|
||||
, Acceleration(100.0)
|
||||
, Cont(false)
|
||||
, Tool(0)
|
||||
, Base(0)
|
||||
{}
|
||||
|
||||
Waypoint::~Waypoint() = default;
|
||||
|
||||
unsigned int Waypoint::getMemSize () const
|
||||
unsigned int Waypoint::getMemSize() const
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Waypoint::Save (Writer &writer) const
|
||||
void Waypoint::Save(Writer& writer) const
|
||||
{
|
||||
writer.Stream() << writer.ind() << "<Waypoint "
|
||||
<< "name=\"" << Name << "\" "
|
||||
<< "Px=\"" << EndPos.getPosition().x << "\" "
|
||||
<< "Py=\"" << EndPos.getPosition().y << "\" "
|
||||
<< "Pz=\"" << EndPos.getPosition().z << "\" "
|
||||
<< "Q0=\"" << EndPos.getRotation()[0] << "\" "
|
||||
<< "Q1=\"" << EndPos.getRotation()[1] << "\" "
|
||||
<< "Q2=\"" << EndPos.getRotation()[2] << "\" "
|
||||
<< "Q3=\"" << EndPos.getRotation()[3] << "\" "
|
||||
<< "vel=\"" << Velocity << "\" "
|
||||
<< "acc=\"" << Acceleration << "\" "
|
||||
<< "cont=\"" << int((Cont)?1:0) << "\" "
|
||||
<< "tool=\"" << Tool << "\" "
|
||||
<< "base=\"" << Base << "\" ";
|
||||
if(Type == Waypoint::PTP)
|
||||
writer.Stream() << writer.ind() << "<Waypoint "
|
||||
<< "name=\"" << Name << "\" "
|
||||
<< "Px=\"" << EndPos.getPosition().x << "\" "
|
||||
<< "Py=\"" << EndPos.getPosition().y << "\" "
|
||||
<< "Pz=\"" << EndPos.getPosition().z << "\" "
|
||||
<< "Q0=\"" << EndPos.getRotation()[0] << "\" "
|
||||
<< "Q1=\"" << EndPos.getRotation()[1] << "\" "
|
||||
<< "Q2=\"" << EndPos.getRotation()[2] << "\" "
|
||||
<< "Q3=\"" << EndPos.getRotation()[3] << "\" "
|
||||
<< "vel=\"" << Velocity << "\" "
|
||||
<< "acc=\"" << Acceleration << "\" "
|
||||
<< "cont=\"" << int((Cont) ? 1 : 0) << "\" "
|
||||
<< "tool=\"" << Tool << "\" "
|
||||
<< "base=\"" << Base << "\" ";
|
||||
if (Type == Waypoint::PTP) {
|
||||
writer.Stream() << " type=\"PTP\"/> ";
|
||||
else if(Type == Waypoint::LINE)
|
||||
}
|
||||
else if (Type == Waypoint::LINE) {
|
||||
writer.Stream() << " type=\"LIN\"/> ";
|
||||
else if(Type == Waypoint::CIRC)
|
||||
}
|
||||
else if (Type == Waypoint::CIRC) {
|
||||
writer.Stream() << " type=\"CIRC\"/> ";
|
||||
else if(Type == Waypoint::WAIT)
|
||||
}
|
||||
else if (Type == Waypoint::WAIT) {
|
||||
writer.Stream() << " type=\"WAIT\"/> ";
|
||||
else if(Type == Waypoint::UNDEF)
|
||||
}
|
||||
else if (Type == Waypoint::UNDEF) {
|
||||
writer.Stream() << " type=\"UNDEF\"/> ";
|
||||
writer.Stream()<< std::endl;
|
||||
}
|
||||
writer.Stream() << std::endl;
|
||||
}
|
||||
|
||||
void Waypoint::Restore(XMLReader &reader)
|
||||
void Waypoint::Restore(XMLReader& reader)
|
||||
{
|
||||
// read my Element
|
||||
reader.readElement("Waypoint");
|
||||
@@ -127,24 +130,26 @@ void Waypoint::Restore(XMLReader &reader)
|
||||
reader.getAttributeAsFloat("Q2"),
|
||||
reader.getAttributeAsFloat("Q3")));
|
||||
|
||||
Velocity = (float) reader.getAttributeAsFloat("vel");
|
||||
Acceleration = (float) reader.getAttributeAsFloat("acc");
|
||||
Cont = (reader.getAttributeAsInteger("cont") != 0)?true:false;
|
||||
Tool = reader.getAttributeAsInteger("tool");
|
||||
Base = reader.getAttributeAsInteger("base");
|
||||
Velocity = (float)reader.getAttributeAsFloat("vel");
|
||||
Acceleration = (float)reader.getAttributeAsFloat("acc");
|
||||
Cont = (reader.getAttributeAsInteger("cont") != 0) ? true : false;
|
||||
Tool = reader.getAttributeAsInteger("tool");
|
||||
Base = reader.getAttributeAsInteger("base");
|
||||
|
||||
std::string type = reader.getAttribute("type");
|
||||
if(type=="PTP")
|
||||
if (type == "PTP") {
|
||||
Type = Waypoint::PTP;
|
||||
else if(type=="LIN")
|
||||
}
|
||||
else if (type == "LIN") {
|
||||
Type = Waypoint::LINE;
|
||||
else if(type=="CIRC")
|
||||
}
|
||||
else if (type == "CIRC") {
|
||||
Type = Waypoint::CIRC;
|
||||
else if(type=="WAIT")
|
||||
}
|
||||
else if (type == "WAIT") {
|
||||
Type = Waypoint::WAIT;
|
||||
else
|
||||
}
|
||||
else {
|
||||
Type = Waypoint::UNDEF;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user