29 YouBotBase myBase(
"youbot-base", CONFIG_FOLDER_PATH);
31 std::stringstream jointNameStream;
32 boost::ptr_vector<DataTrace> myTrace;
33 unsigned int step1 = 1000;
34 unsigned int step2 = 4000;
35 unsigned int step3 = 7000;
36 unsigned int step4 = 10000;
37 unsigned int step5 = 13000;
38 unsigned int step6 = 16000;
41 quantity<si::velocity> longitudinalVelocity = 0.0 * meter_per_second;
42 quantity<si::velocity> transversalVelocity = 0.0 * meter_per_second;
43 quantity<si::angular_velocity> angularVelocity = 0 * radian_per_second;
45 for (
int i = 1; i <= 4; i++) {
46 jointNameStream <<
"Joint_" << i <<
"_" << __func__;
48 jointNameStream.str(
"");
52 for (
int i = 0; i < 4; i++) {
53 myTrace[i].startTrace();
56 startTime = myTrace[0].getTimeDurationMilliSec();
57 overallTime = startTime + step6 +10;
59 while (myTrace[0].getTimeDurationMilliSec() < overallTime) {
60 if (myTrace[0].getTimeDurationMilliSec() > startTime + step1) {
61 longitudinalVelocity = 0.0 * meter_per_second;
62 transversalVelocity = 0.0 * meter_per_second;
63 angularVelocity = 0 * radian_per_second;
65 if (myTrace[0].getTimeDurationMilliSec() > startTime + step1
66 && myTrace[0].getTimeDurationMilliSec() < startTime + step2) {
67 longitudinalVelocity = 0.2 * meter_per_second;
68 transversalVelocity = 0.0 * meter_per_second;
69 angularVelocity = 0 * radian_per_second;
71 if (myTrace[0].getTimeDurationMilliSec() > startTime + step2
72 && myTrace[0].getTimeDurationMilliSec() < startTime + step3) {
73 longitudinalVelocity = 0.0 * meter_per_second;
74 transversalVelocity = 0.2 * meter_per_second;
75 angularVelocity = 0.0 * radian_per_second;
78 if (myTrace[0].getTimeDurationMilliSec() > startTime + step3
79 && myTrace[0].getTimeDurationMilliSec() < startTime + step4) {
80 longitudinalVelocity = 0.0 * meter_per_second;
81 transversalVelocity = 0.0 * meter_per_second;
82 angularVelocity = 0.2 * radian_per_second;
85 if (myTrace[0].getTimeDurationMilliSec() > startTime + step4
86 && myTrace[0].getTimeDurationMilliSec() < startTime + step5) {
87 longitudinalVelocity = 0.1 * meter_per_second;
88 transversalVelocity = 0.1 * meter_per_second;
89 angularVelocity = 0.0 * radian_per_second;
92 if (myTrace[0].getTimeDurationMilliSec() > startTime + step5
93 && myTrace[0].getTimeDurationMilliSec() < startTime + step6) {
94 longitudinalVelocity = 0.1 * meter_per_second;
95 transversalVelocity = 0.1 * meter_per_second;
96 angularVelocity = 0.0 * radian_per_second;
99 if (myTrace[0].getTimeDurationMilliSec() > startTime + step6) {
100 longitudinalVelocity = 0 * meter_per_second;
101 transversalVelocity = 0 * meter_per_second;
102 angularVelocity = 0 * radian_per_second;
105 myBase.
setBaseVelocity(longitudinalVelocity, transversalVelocity, angularVelocity);
106 for (
int i = 0; i < 4; i++) {
107 myTrace[i].updateTrace();
113 for (
int i = 0; i < 4; i++) {
114 myTrace[i].stopTrace();
115 myTrace[i].plotTrace();
virtual ~YouBotBaseKinematicsTest()
static severity_level logginLevel
YouBotJoint & getBaseJoint(const unsigned int baseJointNumber)
#define SLEEP_MICROSEC(microsec)
Creates a trace of all process data and reads all configuration parameter from one joint...
void youBotBaseKinematicsTest()
void setBaseVelocity(const quantity< si::velocity > &longitudinalVelocity, const quantity< si::velocity > &transversalVelocity, const quantity< si::angular_velocity > &angularVelocity)
It groups the base joints together.
void doJointCommutation()
does the sine commutation of the base joints
static EthercatMasterInterface & getInstance(const std::string configFile="youbot-ethercat.cfg", const std::string configFilePath="../config/", const bool ethercatMasterWithThread=true)
void setEncoderToZero()
set the encoder values of the joint to zero. This postion will be the new reference.
YouBotBaseKinematicsTest()