in the course project for python basics for robotics, when i want to move backwards, i use negative values for linear velocity, the robot just ignores all parameters and functions just goes full speed backward collide with the wall and fly off the map.
time.sleep(2) → is ignored, sample move value of linear as 0.5 moves it just a little bit forward, perfect no issues but if u give -0.5 it just flies off the turtlebot.
i havent tried other courses projects yet but if all are like this then i wont be able to complete them to get the certificates.
sure, below is the function that was already there in the file.
#~#~#~#~#~# start your function definitions after this line #~#~#~#~#~#
def sample_move(linear, angular):
# sample function to move the robot
# this function can be deleted later!
global robot_interface
robot_interface.linear_velocity = linear
robot_interface.angular_velocity = angular
return None
#~#~#~#~#~# finish your function definitions before this line #~#~#~#~#~#
and here is the 2 versions of usage:
try:
#~#~#~#~#~# start your program after this line #~#~#~#~#~#
#~#~#~#~#~# write code here to run only once #~#~#~#~#~#
sample_move(0.5, 0.000)
time.sleep(5.0)
sample_move(0.000, 0.000)
time.sleep(1.0)
#~#~#~#~#~# write code here to run continuously #~#~#~#~#~#
#~#~#~#~#~# finish your program before this line #~#~#~#~#~#
the above works fine the robot just moves slightly forward, next is the following:
try:
#~#~#~#~#~# start your program after this line #~#~#~#~#~#
#~#~#~#~#~# write code here to run only once #~#~#~#~#~#
sample_move(-0.5, 0.000)
time.sleep(5.0)
sample_move(0.000, 0.000)
time.sleep(1.0)
#~#~#~#~#~# write code here to run continuously #~#~#~#~#~#
#~#~#~#~#~# finish your program before this line #~#~#~#~#~#
this time the robot just full steam ahead goes and bashes into the back wall and flies off the map then to be restored in the middle of the map again.
I do not get from what course did you get the info.
My assumption is that you have to put something like linear.x and angular.z . The TWIST messages have for a differential robot linear speed around X and angular one around z
thanks for your response, the course is python basics for robotics, and its the course project.
these functions were already implemented in the workspace that was given. i just added the negative sign to the linear speed to go backwards but it dosent seem to work too well.
yeah +0.5 moves it a little bit whereas -0.5 moves it quite a bit more and crashes it from where then it flies off the map.
your idea of 0.1 value worked in terms of it dint keep on moving until it crashes. i think with 0.1 its doable. i have attached some videos for reference of the behavior.
yes python 3 course, at the end there is a final project where you have to first simulate and then perform on the real robot right so that one is a little glitchy.
I think it makes sense to reduce the speed for reverse as we have in real life . If you use lower sleep values it also works, as demonstrated in the video below