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

How can i get the robot to move after clicking 2d nav goal on rviz?

asked 2022-09-16 08:40:59 -0600

PBT gravatar image

updated 2022-09-18 22:02:37 -0600

jayess gravatar image

Hey guys, i'm trying to implement the ros navigation stack. I am using a Jetson nano Dev kit and a waveshare's Jetracer Ai Kit as my robot(it has 4 wheels without encoders). i am using ros melodic and ubuntu 18.04.

I have been able to successfully set up the robot follow these instructions (https://tutorial.cytron.io/2021/04/16...)

using ros package RPLiDAR_S1 and hector slam i was able to create 2D map of an environment.

Now i am trying to implement the ros navigation stack following these instructions https://automaticaddison.com/how-to-s...

i modified the launch file to suit the nodes i have running. I also included save my hector slam map into the launch file.

these are the are the topics being published after launching the file.

user@user-jetracer:~$ rostopic list
/amcl/parameter_descriptions
/amcl/parameter_updates
/amcl_pose
/clicked_point
/cmd_vel
/diagnostics
/goal_2d
/imu/data
/imu/data_raw
/initial_2d
/initialpose
/map
/map_metadata
/move_base/NavfnROS/plan
/move_base/TrajectoryPlannerROS/cost_cloud
/move_base/TrajectoryPlannerROS/global_plan
/move_base/TrajectoryPlannerROS/local_plan
/move_base/TrajectoryPlannerROS/parameter_descriptions
/move_base/TrajectoryPlannerROS/parameter_updates
/move_base/cancel
/move_base/current_goal
/move_base/feedback
/move_base/global_costmap/costmap
/move_base/global_costmap/costmap_updates
/move_base/global_costmap/footprint
/move_base/global_costmap/inflation_layer/parameter_descriptions
/move_base/global_costmap/inflation_layer/parameter_updates
/move_base/global_costmap/obstacle_layer/parameter_descriptions
/move_base/global_costmap/obstacle_layer/parameter_updates
/move_base/global_costmap/parameter_descriptions
/move_base/global_costmap/parameter_updates
/move_base/global_costmap/static_layer/parameter_descriptions
/move_base/global_costmap/static_layer/parameter_updates
/move_base/goal
/move_base/local_costmap/costmap
/move_base/local_costmap/costmap_updates
/move_base/local_costmap/footprint
/move_base/local_costmap/inflation_layer/parameter_descriptions
/move_base/local_costmap/inflation_layer/parameter_updates
/move_base/local_costmap/obstacle_layer/parameter_descriptions
/move_base/local_costmap/obstacle_layer/parameter_updates
/move_base/local_costmap/parameter_descriptions
/move_base/local_costmap/parameter_updates
/move_base/local_costmap/static_layer/parameter_descriptions
/move_base/local_costmap/static_layer/parameter_updates
/move_base/parameter_descriptions
/move_base/parameter_updates
/move_base/recovery_status
/move_base/result
/move_base/status
/move_base_simple/goal
/odom_data_quat
/particlecloud
/robot_pose_ekf/odom_combined
/rosout
/rosout_agg
/scan
/temperature
/tf
/tf_static

on the python code for my robot i try to subcribe to the topic /cmd_vel which i understand is responsible for getting the mobile base to move in a linear and angular direction.

bottom line is on Rviz when i click 2d Nav Goal on the map, my robot doesn;t move. rather i am getting this error.

[INFO] [1663328447.037749]: Throttle: 0.0
[INFO] [1663328447.042918]: Steering: 0.0
[INFO] [1663328447.141553]: Throttle: 0.0
[INFO] [1663328447.144452]: Steering: 0.0
[INFO] [1663328447.191959]: /cmd_vel: x: -0.1
y: 0.0
z: 0.0
[ERROR] [1663328447.221475]: bad callback: <function callback_cmd at 0x7fa28af7b8>
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/user/catkin_ws/src/cytron_jetracer/scripts/racecar.py", line 32, in callback_cmd
    car.throttle = cmd.linear
  File "/usr/local/lib/python3.6/dist-packages/traitlets/traitlets.py", line 585, in __set__
    self.set(obj, value)
  File "/usr/local/lib/python3.6/dist-packages/traitlets/traitlets.py", line 559, in set
    new_value = self._validate(obj, value)
  File "/usr/local/lib/python3.6/dist-packages/traitlets/traitlets.py", line 591, in _validate
    value = self.validate(obj, value)
  File "/usr/local/lib/python3.6/dist-packages/traitlets/traitlets.py", line 1976, in validate
    self.error(obj, value)
  File "/usr ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-09-18 19:44:36 -0600

tomarRobin gravatar image

Hey there, seems like a issue with your cmd callback. The throttle field of car seems to have a different data type than the cmd vel data type. You need to extract the throttle and steering values from cmd vel and then provide them to respective fields. Directly providing cmd vel to throttle will result in such error.

edit flag offensive delete link more

Comments

This is it right here. The car.throttle attribute is a float, but a geometry_msgs.msg._Vector3.Vector3 was given instead. See the error (truncated) message below:

traitlets.traitlets.TraitError: The 'throttle' trait of a NvidiaRacecar instance must be a float, but a value of x: -0.1
y: 0.0
z: 0.0 <class 'geometry_msgs.msg._Vector3.Vector3'> was specified.
jayess gravatar image jayess  ( 2022-09-18 22:05:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-09-16 08:40:59 -0600

Seen: 130 times

Last updated: Sep 18 '22