Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79

This commit is contained in:
Mees Roelofsz
2024-10-02 12:43:35 +02:00
7 changed files with 44 additions and 53 deletions

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2016 National Centre of Robotics
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -12,7 +12,7 @@ if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "DEBUG")
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

View File

@@ -627,22 +627,24 @@ long CKobuki::loop(void *user_data, TKobukiData &Kobuki_data)
return 0;
}
// povie kobukimu ze ma ist niekolko metrov dopredu alebo dozadu, rozhoduje
// znamienko funkcia kompenzuje chodenie rovno pomocou regulatora, interne
// vyuziva setArcSpeed a ako spatnu vazbu pouziva data z enkoderov
void CKobuki::goStraight(long double distance)
{
long double u_translation = 0; // riadena velicina, rychlost robota pri pohybe
long double w_translation = distance; // pozadovana hodnota
// parametre regulatora
long double Kp_translation = 4500;
long double e_translation = 0;
int upper_thresh_translation = 600;
int lower_thresh_translation = 40;
int translation_start_gain = 20;
long double u_rotation = 0; // riadena velicina
// tells the kobuki to go a few meters forward or backward, the sign decides
// the function compensates for walking straight with the controller, internally it uses setArcSpeed and
// uses encoder data as feedback
void CKobuki::goStraight(long double distance){
long double u_translation = 0; // controlled magnitude, speed of the robot in motion
long double w_translation = distance; // requested value
// controller parameters
long double Kp_translation = 4500;
long double e_translation = 0;
int upper_thresh_translation = 600;
int lower_thresh_translation = 40;
int translation_start_gain = 20;
long double u_rotation = 0; // controlled magnitude
long double w_rotation = 0;
long double Kp_rotation = 57;
long double e_rotation = 0;
@@ -652,7 +654,7 @@ void CKobuki::goStraight(long double distance)
theta = 0;
long i = 5;
//send command and hold until robot reaches point
while (fabs(x - w_translation) > 0.005 && x < w_translation)
{
e_translation = w_translation - x;
@@ -683,10 +685,9 @@ void CKobuki::goStraight(long double distance)
{
u_rotation = -32767;
}
//send command to robot
this->setArcSpeed(u_translation, u_rotation);
usleep(25 * 1000);
// increment starting speed
i = i + translation_start_gain;
}
@@ -757,10 +758,9 @@ void CKobuki::doRotation(long double th)
}
}
std::cout << "stop the fuck!" << std::endl;
// usleep(25*1000);
std::cout << "Rotation done" << std::endl;
this->setRotationSpeed(0);
usleep(25 * 1000);
usleep(25*1000);
}
// combines navigation to a coordinate and rotation by an angle, performs movement to

View File

@@ -36,7 +36,7 @@ int movement()
if (text == 1)
{
robot.goStraight(10);
robot.goStraight(1);
}
else if (text == 2)
{