working with the real robots - ori-systems/work_experience GitHub Wiki

Working with the real robots

Prerequisite

Install dependencies:

sudo apt-get install ros-noetic-hector-sensors-description

Connect to jackal-x WiFi network

Password: <ask_for_password>


Connect to the robot

Jackal IP Addresses https://oxfordrobotics.atlassian.net/wiki/spaces/platforms/pages/322043905/Jackal+refit+networking

ssh ori@<MVC_robot_ip_address>
Password: <ask_for_password>

Example for the Jackal 4:

You can do a quick test: In the same terminal where you ssh the robot

rostopic pub /cmd_vel geometry_msgs/Twist -r 10 -- '[0.1, 0.0, 0.0]' '[0.0, 0.0, -0.0]'

Configuring your base station (your PC)

Edit your .bashrc Add the following lines:

# Jackal
export ROS_MASTER_URI=http://<LLC_IP>:11311 
export ROS_IP=<your_IP>

Example for the Jackal 4:

export ROS_MASTER_URI=http://10.0.4.2:11311 
export ROS_IP=10.0.4.151 #this is my IP address

To find your IP address you can use the ifconfig command

Example: In a terminal:

ifconfig

You should see something like this:

$ ifconfig
wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.4.151  netmask 255.255.255.0  broadcast 10.0.4.255
        inet6 fe80::56ac:5198:9c96:9247  prefixlen 64  scopeid 0x20<link>
        ether f0:9e:4a:b1:7f:ab  txqueuelen 1000  (Ethernet)
        RX packets 102284  bytes 115532205 (115.5 MB)
        RX errors 0  dropped 10  overruns 0  frame 0
        TX packets 33309  bytes 12044246 (12.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Configuring your /etc/hosts Edit your /etc/hosts and add:

<MVC_IP_ADDRESS> jackal-X-mvc
<LLC_IP_ADDRESS> cpr-jackal-10X-llc

Note that X is the Jackal number

Example for Jackal 4

10.0.4.3 jackal-4-mvc
10.0.4.2 cpr-jackal-104-llc


Launching the lidar

In a terminal: MVC / robot - Start the 3D lidar

ssh ori@<MVC_robot_ip_address> 
roslaunch autoinspect_jackal_bringup sensors.launch

and in another terminal let's create a 2D laser scan from it by projecting the 3D point cloud onto a plane

ssh ori@<MVC_robot_ip_address> 
roslaunch autoinspect_jackal_bringup laserscan.launch laser_topic:=/front/scan

Default topic name: /scan

Example for Jackal 4

ssh [email protected]
roslaunch autoinspect_jackal_bringup sensors.launch

followed by

ssh [email protected]
roslaunch autoinspect_jackal_bringup laserscan.launch laser_topic:=/front/scan

Visualising the lidar In a terminal on your local machine

rviz

You should see something like this:

Add a LaserScan visualisation Select the topic /front/scan Set Fixed Frame: base_link

You should see something like this:



Basic Mapping

You will need 5 terminals open. Power up the robot and when the link light comes on, connect to the Jackal-XXX-wlan wireless network.

Build the map

Use Terminal 1 and Terminal 2 to start the 2D lidar and project into 2D as described above.

Terminal 3 : MVC - Run gmapping

ssh ori@<MVC_robot_ip_address> 
roslaunch jackal_navigation gmapping.launch config:=gmapping

Example for the Jackal 4

ssh [email protected]
roslaunch jackal_navigation gmapping.launch config:=gmapping

Terminal 4 : Remote PC - Visualise

roslaunch autoinspect_jackal_bringup view_robot.launch

Add a Map visualisation

You should see something like this:

Drive the robot around to build up a map using interactive markers in RViz.

Note: If Interactive markers not showing, run the following command in a terminal:

roslaunch interactive_marker_twist_server interactive_markers.launch

When the map seem to be ready...

Terminal 4 : MVC - Save the map

ssh ori@<MVC_robot_ip_address> 
cd /home/ori/maps
rosrun map_server map_saver

Once the map is saved, you can stop gmapping in Terminal 2, using Ctrl+C.

Navigate the map Terminal 1 : MVC - Start the lidar

ssh ori@<MVC_robot_ip_address> 
roslaunch autoinspect_jackal_bringup sensors.launch

Example for Jackal 4

ssh [email protected]
roslaunch autoinspect_jackal_bringup sensors.launch

Terminal 2 : MVC - Project the lidar into 2D

ssh ori@<MVC_robot_ip_address> 
roslaunch autoinspect_jackal_bringup laserscan.launch laser_topic:=/front/scan

Example for Jackal 4

ssh [email protected]
roslaunch autoinspect_jackal_bringup laserscan.launch laser_topic:=/front/scan

Terminal 3 : MVC - Run AMCL

ssh ori@<MVC_robot_ip_address> 
roslaunch jackal_navigation amcl_demo.launch map_file:=/home/ori/maps/map.yaml

Example for Jackal 4

ssh [email protected]
roslaunch jackal_navigation amcl_demo.launch map_file:=/home/ori/maps/map.yaml

Terminal 4 : Remote PC - Visualise and command autonomy

roslaunch autoinspect_jackal_bringup view_robot.launch

If everything is working correctly, the saved map should appear with a cost map overlaid on top and the robot sitting somewhere.

You should see something like this:

Use the 2D Pose Estimate command in RViz to click on the map and estimate where the robot is and initialise localisation.

Once localised, use the 2D Nav Goal to tell the robot where to drive autonomously!!



Let's play some more with the robot!

For the following exercises, we are going to use the methods found in robot_control_class_jackal.py

IMPORTANT NOTE: Remember, in order to be able to use the methods to control the robot, you will need to do two things:

  1. Import the Python class contained in the robot_control_class_jackal.py file. You can do this with the following line (place it at the top of your program).

    from robot_control_class_jackal import RobotControl
  2. Create an object of the class in order to be able to call the methods. You can do this with the following line:

    robotcontrol = RobotControl()

Now, you will be able to call the methods from this object, like this:

robotcontrol.move_straight_time(necessary_parameters)


Exercise 1

Inside the ~/work_experience_ws/src/robot_control folder, create a new Python script named control_jackal.py.

Open the control_jackal.py file and copy the following contents:

control_jackal.py

from robot_control_class_jackal import RobotControl

robotcontrol = RobotControl()

robotcontrol.move_straight_time("forward", 0.3, 5)
robotcontrol.turn("clockwise", 0.3, 7)

Execute in a terminal:

cd ~/work_experience_ws/src/work_experience
cd robot_control
python control_jackal.py


Section 2 but now on real robots

Now, you have the opportunity to try things from Introduction to Jackal in Gazebo simulator and Jackal Navigation in Gazebo on real robots. Have fun!

⚠️ **GitHub.com Fallback** ⚠️