[ YES ] I am at the right place and my issue is directly related to ROS#. General technical questions I would post e.g. at ROS Answers or Stack Overflow. For library-specific questions I would look for help in the corresponding library forums.
[ YES ] I have thoroughly read the Contributing Guideline and writing this issue is the right thing to do in my case.
I have a question!
[ YES ] I searched the Wiki, open and closed issues for an answer. I tried my best to find the answer by myself without success. I believe that the discussion we will have in this issue, and the solutions we might find, will help me, and likely other community members who have a similar problem.
Here is my question:
I'm using ubuntu 18.04.5, ROS Melodic, Gazebo 9, Unity 2021.3.24f1 and turtlebot3.
I followed all the tutorials and videos. I'm using a xbox controller to move my robot here's my code if it helps for context:
using UnityEngine;
public class ControlDeRobot : MonoBehaviour
{
public float moveSpeed = 1.0f; // Velocidad de movimiento del objeto
public float rotationSpeed = 100.0f; // Velocidad de rotación del objeto
private bool DeadmanPressed = false;
private bool PlusVelInput = false;
private bool MinVelInput = false;
private float VariadorVel = 0.0f;
void Update()
{
//Verificar si el botón de hombre muerto está presionado
//El botón "DeadmanButton" está configurado como "LT" en el mando Xbox en Input Manager
DeadmanPressed = Input.GetButton("DeadmanButton");
if (DeadmanPressed)
{
// Captura la entrada de los ejes horizontal y vertical
float horizontalInput = Input.GetAxis("MoverHorizontal");
float verticalInput = Input.GetAxis("MoverVertical");
//Captura la entrada de los botones de subir y bajar velocidad
PlusVelInput = Input.GetButton("PlusVel");
MinVelInput = Input.GetButton("MinVel");
// Calcula el desplazamiento en función de la entrada
Vector3 moveDirection = new Vector3(horizontalInput, 0, verticalInput).normalized;
//Aumenta el valor del variador de velocidad en 0.2 cada que se presione botón PlusVel
if (PlusVelInput)
{
VariadorVel = VariadorVel + 0.1f;
}
//Disminuye el valor del variador de velocidad en 0.2 cada que se presione el botón MinVel
if (MinVelInput)
{
VariadorVel = VariadorVel - 0.1f;
}
moveSpeed = moveSpeed + VariadorVel;
moveSpeed = Mathf.Clamp(moveSpeed, 0.0f, 6.0f); // Limita la velocidad a un rango de 0 a 5
// Mueve el objeto en la dirección calculada
transform.Translate(moveDirection * moveSpeed * Time.deltaTime);
// Captura la entrada de los ejes de rotación (joysticks del control de Xbox)
float rotationInput = Input.GetAxis("Xbox360RightStickX");
// Calcula la rotación en función de la entrada
Vector3 rotation = new Vector3(0, rotationInput, 0) * rotationSpeed * Time.deltaTime;
// Rota el objeto en la dirección calculada
transform.Rotate(rotation);
}
}
}
First I use: roslaunch file_server ros_sharp_communication.launch , then I play my scene in UNITY, after that I run: roslaunch file_server visualize_robot.launch model:=$(rospack find x_1)/turtlebot3_burger.urdf.urdf (I've done the steps in unity transfer URDF to ROS). Finally y use: roslaunch gazebo_simulation_scene gazebo_simulation_scene.launch
In MY rqt GRAPH it show this:
instead of this that is shown in the video:
I've researched a lot, but haven't figured out what is wrong and why my turtlebot 3 is not moving in gazebo along with the one in Unity.
I have a question!
Here is my question: I'm using ubuntu 18.04.5, ROS Melodic, Gazebo 9, Unity 2021.3.24f1 and turtlebot3.
I followed all the tutorials and videos. I'm using a xbox controller to move my robot here's my code if it helps for context:
First I use:
roslaunch file_server ros_sharp_communication.launch
, then I play my scene in UNITY, after that I run:roslaunch file_server visualize_robot.launch model:=$(rospack find x_1)/turtlebot3_burger.urdf.urdf
(I've done the steps in unity transfer URDF to ROS). Finally y use:roslaunch gazebo_simulation_scene gazebo_simulation_scene.launch
In MY rqt GRAPH it show this:
instead of this that is shown in the video:
I've researched a lot, but haven't figured out what is wrong and why my turtlebot 3 is not moving in gazebo along with the one in Unity.
Thank you so much for your help.