ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

foxy rviz2 robot inverse

asked 2023-04-29 20:28:14 -0500

rcarrasquel gravatar image

I connect my real robot with rviz but when i drive forward by teleoperation in RVIZ2 it goes backwards. When I load the model everything loads with their respective xyz positions and looks good, I did a test with gazebo and the urdf model and it works fine. What I can be doing wrong?

I'm using ros2 version foxy

To teleoperate use ros2 run teleop_twist_keyboard teleop_twist_keyboard and using ros2 topic echo /diff_cont/cmd_vel_unstamped to see the speeds

If I press (i) the linear velocity is positive and my real robot's wheels are going in the right direction, if I press (m) the linear velocity is negative and my real robot is going in the right direction

edit retag flag offensive close merge delete

Comments

It sounds like whatever is publishing your odometry is configured incorrectly, but its difficult to say without more information. when you say "it goes backwards" in RViz, what is "it"? Are you visualizing a robot model? are you looking at the tf frames of your wheels?

The first place I would suggest looking is that your wheel frames are spinning the correct direction in RViz when a fwd velocity command is input. If not, you may just need to flip the direction of the axis on your wheel joints. If have a hunch that's not it, since it "works well in Gazebo". If that's not the issue, I'd suggest updating your question with more details on your odometry source, so people can potentially help you identify the issue.

shonigmann gravatar image shonigmann  ( 2023-05-01 10:29:05 -0500 )edit

Thank you for your comments, I did some that you commented but I'm still in trouble

rcarrasquel gravatar image rcarrasquel  ( 2023-05-02 14:54:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-02 14:53:39 -0500

rcarrasquel gravatar image

These are the steps I currently do:

Step 1: ros2 launch robot_v1 launch_robot.launch.py

[robot_state_publisher-1] Parsing robot urdf xml string. [robot_state_publisher-1] Link base_footprint had 0 children [robot_state_publisher-1] Link chassis had 2 children [robot_state_publisher-1] Link caster_wheel had 0 children [robot_state_publisher-1] Link laser_frame had 0 children [robot_state_publisher-1] Link left_wheel had 0 children [robot_state_publisher-1] Link right_wheel had 0 children Step 2: launch rviz2

Step 3: launch ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/diff_cont/cmd_vel_unstamped

Step 4: List my topics ros2 topic list

/diff_cont/cmd_vel_unstamped
/dynamic_joint_states /joint_states
/odom /parameter_events
/robot_description /rosout /tf
/tf_static

Step 5: Show velocity used with teleop ros2 topic echo /diff_cont/cmd_vel_unstamped linear: x: 0.5 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0

Step 6: The big error is here ros2 topic echo /odom

header: stamp: sec: 1683055943 nanosec: 697278387 frame_id: odom child_frame_id: base_link pose: pose: position: x: -1.2107849808063793 y: -0.08094175530158954 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.06693663980673284 w: 0.9977572281128229 twist: twist: linear: x: -2.0595504468534641e-16 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 2.1163626406917045e-17

Now I don't know how to solve this part. The wheels of my robot go in the correct direction when using the teleoperation from the keyboard and in gazebo it works well. Now, I have noticed that on some occasions the linear velocity in twist appears as positive but the position in pose appears in negative. I have changed the orientation of the axes and I think the problem is worse, because the wheels rotate in the opposite direction but the robot's pose always goes negative on the x axis if I want to move forward

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-04-29 20:28:14 -0500

Seen: 142 times

Last updated: May 02 '23