This was due to a conflict between python2 and python3. Installing autobahn for python2 solved this (although I first had to do python -m pip install --upgrade pip to be able to upgrade. Rebuilding the blocky_ws seems to work.
Yet, nothing moves, but that is also truth for helloworld so time to recharge the battery again.
Trying this suggestion to publish my updated turtlebot3_blocky project.
Created the new project with git remote add turlebot3_blockly https://github.com/physar/turtlebot3_blockly.git.
Yet, when I do git push turtlebot3_blockly, I get problems with th branch I am using:
fatal: The current branch testChanges has no upstream branch.
To push the current branch and set the remote as upstream, use
yet, when I do git push --set-upstream turtlebot3_blockly testChanges, I get: fatal: 'turtlebot3_blockly' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Created the repository from my github page, but still same message (problems with authentication that had to be renewed?)
The trick was to also point the submodule to my repository, perform the commit in the submodule directory, perform another commit (of the submodule) in the root of the repository, and do a push.
Should also install curl. catkin should not be installed, because ros-melodic-catkin is already installed. Yet, you should source the melodic setup.bash before running catkin_make.
The build works, but the run fails on missing rospkg.
Strange, because rospkg is installed.
Solved it by creating some symbolic links from /opt/ros/melodic/lib/python2.7/dist-packages/ to /usr/lib/python2.7/dist-packages/ (for rospkg, rospkg_modules, catkin_pkg, pyparsing).
Yet, the webserver still uses python3.6 to start autobahn, so python3.6 -m pip install cryptography==2.9.2 authobahn (the latest version cryptography-38.0.1 fails on CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK, after a warning that from cryptography import x509 is no longer supported for python3.6.
Checked higher versions (2.9.2 was the minimal version). V3.4.8 still works, V.36.0.2 also. V.37.0.4 gives the warning, but doesn't fail.
Tried the installation on nb-ros with recharged battery.
The generated code works fine (when the node is initiated0, but the autobahn running python3 and melodic running python2 gives conflicts:
[ERROR] [1666012752.318869]: bad callback: >
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/arnoud/blockly_ws/install_isolated/lib/turtlebot3_blockly/scripts/turtlebot3_blockly_backend.py", line 132, in _send_code_status
self.sendMessage(payload.encode('utf-8'), False)
File "/home/arnoud/.local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 2217, in sendMessage
raise Disconnected("Attempt to send on a closed protocol")
autobahn.exception.Disconnected: Attempt to send on a closed protocol
Started the webserver on nb-dual. Yet, the blocks are empty, because the two submodules are not updated. Yet, git submodule init; git submodule update fails on connetion timeout.
The command git submodule status gives at nb-ros:
b082bcb4bf2da27a8def3c438a33ebf0dffe5afe ace-builds (v1.2.0-3-gb082bcb)
5c76aa2cb5f1b7e3741f128d964b1e2462327488 blockly (heads/testChanges)
while at nb-ros both tags/branches are (null)
Removed the submodules and committed both branches as is.
Testing it on nb-dual fails, because WSL2 has no direct connection to the wlan. Setting the ROS_MASTER_URL (nb-ros) and ROS_HOSTNAME (nb-dual) fails, because no ros-core is running on the underlying WINDOWS. The default port of roscore is 11311, so maybe I could redirect the port to WSL.
Tried to do port forwarding with the netsh interface suggested in this post. Yet, with the port forwarding running on port 45039 and explictly using this port with roscore -p 45039, still gives:
Unable to contact my own server at [http://192.168.0.204:40013/].
This usually means that the network is not configured properly.
Manually converted helloworld to ROS2. I can see the ro2 topics. I can run the ros-foxy/helloworld.py, yet the loops seem to run for ever.
Used part of the trick of this post, bu seems like I also have to include the spin in a seperate thread.
That works, I now have a simple ROS2 program that drives a square: turn_square.py.
October 14, 2022
Looking for people with simular synchronisation problems. One suggestion is to flash the OpenCR bootloader.
The version of opencr that I have is verions 1.2.6, which contains two types of bins (regular and noetic), which could be ROS1 and ROS2. The version file is from September 2018, but the latest content is form January 2021. Seems to be the latest version (applied the opencr setup last September 29.
On the command-line the OpenCR board mentions that is has core(v1.2.2).
Yet, the Turtle1 had still upgrades that could be done (including a bootloade of the raspberry pi), so try that first and see if the behavior of yesterday is still there.
The command python helloworld.py works fine. The test python short_test.py does nothing.
Made a shorter_test.py version which goes forward (and gives no stop command at the end). Copied both python programs into ~/projects/TurtleBot3.
Checked the blockly version of arvindk2604, which indicates the testTurtlebot branch I used was for the TurtleBot2.
The testChanges branch is intended for the TurtleBot3, and is 9 commits ahead of the erlerobot:master.
The last commit on blockly/blocks/dabit-turtlebot3.js has tag f37ada9a.
Moved the wrong branch to ~/not_used and checked the correct branch with git clone -b testChanges https://github.com/aravindk2604/blockly.git.
Rebuild the package with catkin_make_isolated -j2 --pkg turtlebot3_blockly --install. The socket was already in use, so I rebooted.
Started the blocky webserver with roslaunch turtlebot3_blockly turtlebot3_blockly.launch and now the http://127.0.0.1:1036 also has the stop block.
When looking at the Python code I could see that now the topic cmd_vel is used.
Still, there is a small bug in the generated code, because the number of seconds is stored in a string, which is not converted to an int.
Still, the Turtle is not moving, while hello_world.py works (in most of the cases, lost sync messages still appear).
Looked for differences. In the cmd-loop of forward_3_seconds.py no rospy.Rate(10).sleep() was included, but that didn't help.
Replaced the first loop with the move_forward function of hello_word.py. Still nothing.
When I also copy the move_cmd = Twist() initialisation of the move_forward function it suddenly works.
Kept the second loop original, only changed the parameter name from twist to move_cmd now also the second loop works (made it driving backwards. Publishing on the topic cmd_vel or /cmd_vel both worked.
The different scripts can be found in turtlebot3_blockly/frontend/blockly/generators/python/scripts/turtlebot3/
Changed the move_forward.py and stop.py script. Code looks good, but nothing happens. Tried what was the main difference with the previous forward_3_seconds.py, but gradually changing it didn't help.
Yet, both forward_3_seconds and helloworld.py are also no longer working (out of battery, time to go home.
Don't forget to set python back to 2 in the http://127.0.0.1:1036/ interface next time.
.py
October 13, 2022
The test.py code generated by blocky yesterday, subscribes to a publisher with the topics of a TurtleBot2, instead of a TurtleBot3.
Changed rospy.Publisher('/cmd_vel_mux/input/navi',...) to pub = rospy.Publisher('/cmd_vel', ...). Now I receive the output:
ERROR: connection refused to [http://192.168.0.148:40805/]
ERROR: connection refused to [http://192.168.0.229:40443/]
ERROR: connection refused to [http://192.168.0.229:34095/]
ERROR: connection refused to [http://192.168.0.229:44949/]
Unable to contact the following nodes:
* /turtlebot3_core
* /blockly_node_3487_1 665580300039
* /turtlebot3_diagnostics
* /turtlebot3_lds
* /cv_camera
Warning: these mi ght include alive and functioning nodes, e.g. in unstable networks.
Cleanup will purge all information about these nodes from the master.
The current rostopic list is:
/battery_state
/blockly
/cmd_vel
/cmd_vel_mux/input/navi
/cmd_vel_rc100
/current_block_id
/current_code_status
/cv_camera/camera_info
/cv_camera/image_raw
/diagnostics
/firmware_version
/image_view/output
/image_view/parameter_descriptions
/image_view/parameter_updates
/imu
/joint_states
/magnetic_field
/motor_power
/odom
/reset
/rosout
/rosout_agg
/rpms
/scan
/sensor_state
/sound
/tf
/version_info
The cmd_vel proxy was actually called twice. The blocky connection could be part of set_current_block = rospy.ServiceProxy('program_set_current_block_id', SetCurrentBlockId). The other connections are for the moment a mistery.
When I agree on purging the information, I get the following output. After that the my_test.py finishes again without any output:
Cleanup will purge all information about these nodes from the master.
Please type y or n to continue:
y
Unregistering /turtlebot3_core
Unregistering /blockly_node_3487_1665580300039
Unregistering /turtlebot3_diagnostics
Unregistering /turtlebot3_lds
Unregistering /cv_camera
done
It is essential to also bringup the ros-nodes on the side of the turtle.
Yet, the robot is not always reacting. On some helloworlds.py it reacts (none on short_test.py), although sometimes it reacts long after the program finishes (buffer?)
On the Turtle side I see messages like (not synchronized with my python programs:
[INFO] [1665654849.912282]: Calibration End
[ERROR] [1665654885.166053]: Lost sync with device, restarting...
[INFO] [1665654885.182556]: Requesting topics...
October 12, 2022
Setting up Iris account on nb-ros.
Added ros-melodic to her bashrc.
Followed the instructions of turtlebot-3-blocky and cloned the repository. Goes wrong with the submodules: the git submodule add gives submodule already in index. The following command git submodule init tries a git clone git://github.com/aravindk2604/ace-builds.git which fails on a timeout.
Strange enough a direct clone with https requests now username and password. My token was renewed (not in the cash yet), but the old one is not expired.
A git pull indicates that the two submodules seem to be up to date.
Solved it by copying content of my blocky to Iris' blocky. Now all blocks (except stop) are there.
Could connect to Turtle1 (local 192.168.0.229).
The ROS Melodic uses python2.7, so installed autobahn for python2 with pip (instead of pip3). Now the blocky works, in the sense that it generates a test.py. When I run this program no error is given, but the bot is not responding.
The OpenCR board has several IO-ports. Looked into the documentation, but it the provided examples use serial communication to control a number of simple sensors as a tilt and rotation sensor.
For autonomous driving example they use a TurtleBot3 with camera (Raspberry Pi camera with Fisheye Lens).
The Mirthe cam with a HBCVCAM v33 (with USB-connection and a HM1355 Chip).
Using the Turtle 4 (ROS foxy) with only the Raspberry Pi powered. Connected the HM1355 camera. dmesg | tail recognizes the camera, with lsusb it is probably the device without ID.
Seems that there in package ros-foxy-cv-camera, so I have to build it from source. The package should be dependend on image_common, but that versions seems quite old.
When doing colcon build, the Turtle complains that OpenCV is not installed (which I know is not trivial).
Looked at Noetic version of Autonomous Driving, and installed at least ros-foxy-image-transport on Turtle 4. That works. Also ros-foxy-cv-bridge seems to work, although that requires the installation of 100+ packages. Did a sudo apt upgrade afterwards, because more than 400+ were outdated.
Note that the ROS-Kinetic page on panorama-demo uses the turtlebot_rpicamera packages, instead of a webcam.
When I now do colcon build there is no complaint on opencv anymore. I still had to install ros-foxy-camera-info-manager, but that was all (only one warning and no errors during the build).
I could start the node with ros2 run cv_camera cv_camera_node. This publishes both a /camera_info and /image_raw. The /image_raw could be displayed with ros2 rviz2 rviz2 on nb-dual:
On Turtle 1 (ROS Melodic) the installation was much easier sudo apt install ros-melodic-cv-camera (181 packages).
This also works, I could publish images under the topic /cv_camera/image_raw, which I could display with rosrun image_view image_view image:=/cv_camera/raw_image and rviz (note this is ROS1).
Using a Raspberry Pi camera seems to be a bit harder, if I read this post
At least, there is no turtlebot3_rpicamera.launch on foxy, but robot.launch should also work.
Connected the camera, but /dev/video0 and /dev/video1 do not exist.
Used the tricks of this page. Installed sudo apt install libraspberrypi-bin, followed by sudo vcgencmd get_camera. That gave supported=0, detected=0.
When I try raspistill -v -o test.jpg, I get Failed to open vchiq instance. Tried sudo usermod -a -G video, still same error.
The command raspi-config doesn't work.
Went to /boot/firmware and edited sysconf.txt by adding a start_x=1 line before enable_uart=1. Still supported=0, detected=0.
Placed the original sysconf.txt back and removed the camera. Time to go home.
The test.py that was generated by blocky contained also the cmd_vel/navi messages which were the msg-format of the TurtleBot2, like the goforward.py example Iris used.
October 11, 2022
Replaced the missing wigs with t-wraps, which seem to work.
The board is a Orange Pi Zero v1.5. The LTS version seems to match, although I could not see if it was marked v1.4 or v1.5. The sticker gives Orange Pi Zero 512, with a long serial number, while on the Bottow view of the documentation 512M is the start of a much shorter number.
Anyway, it should be possible to connect a small OLED-091 from diymore.cc to the Orange Pi, so that it displays its ip. I borrowed one from Seed Jetbot. The OLED uses four pins: GND, VCC, SCL, SDA.
The OLED-091 seems to have a SSD1306 control chip, but no documentation is given.
Found github project with python examples. The example shows sys_stats as network-traffic, but you need a connection first.
Better follow this post, which has oled_ip.py script which can be fired up at startup.
As this LCD I2C indicates, the connection to I2c is not trivial. The SDA is clear (next to the square pin), and GND and VCC is also clear. Still puzzling on SCL.
Should check this Adafruit page, which indicates that you can specify the board layout from /etc/armbian-release.
This I2C sensor uses the SCK for SCL (and the 3.3V for VCC).
Time to get my broadboard (after lunch).
Connected the OLED to the Orange PI, but connecting via Mirte's access-point is not very stable. Everytime I make a connection I am disconnected after a short while.
Found two USB-TTL converters, so wired up the TX-RXI and RX-TXO as specified beginners guide.
The guide was written for Windows, but putty is also available under Linux.
Checked the connection with dmesg | tail and lsubs and the serial converter is available as /dev/ttyUSB0
Used all the tricks from stackoverflow and checked the connection with moserial. After chmod o+rw /dev/ttyUSB0 I get a lot of bits streaming over the serial connection.
Also tried putty. Set the connection to serial (and speed to 115200), but I only receive rubbish.
Tried the same again on nb-dual (with a reboot of mirte), but same result.
putty can make a connection, but gets lots rubbish.
Looked what I could do with ICSP pins, but mainly seem to be available to flash the controller. Got a lot of details on additional communication options.
Was looking if I could use the keyboard PCB-entry with putty :-)
Connected wireless to mirte.
DId pip install adafruit-circuitpython-ssd1306, but all requirements were allready satisfied (which is nice, because I didn't had any connection to the internet yet)
Picked up in the RoboHouse a Mirte robot. Checked the electronics. There is an additional sonar sensor (2x instead of 1x) and an additional camera (including Orange PI interface board). What is missing from the list is 1x Keypad and 1x OLED screen (1x instead of 2x).
From the wooden components I have one additional middle plate, but missing the PenHolder and 6x wigs.
Switched on the Orange Pi card, but nor a Zoef_* or a Mirte_* wireless network becomes visible.
After a reboot mirte_XXXXX was visible. Also connected via ethernet, but status kept in connecting state. Changed the IP4 settings from Automatic DHCP to Shared and later link-local only.
The ping mirte.local and ssh mirte@mirte.local worked when connected via the mirte_XXXX access-point, but when I followed the instructions, the access point was gone, but no direct way to find the ip inside the network. The mirte.local ip was still the same as before.
Also when connected to the router I cannot connect (although now another ip is suggested).
Try a reboot. It takes some time before the dns to know the name.
The Ubuntu version is focal, the ROS version is noetic. Upgrading 246 packages. Python version is 3.8
September 29, 2022
The PC with the roscore should already be in the same network, otherwise th e roslaunch turtlebot3_bringup turtlebot3_robot.launch fails.
The ROS Serial Python Node is connecting to the OpenCR via /dev/ttyACM0, but when Requesting topics it gets this error:
Unable to sync with device: possible link problem of software version mismatch.
Trying a reboot, otherwise I should perform the firmware update.
After reboot, I first tried a update / upgrade cyle (294 packages could be updated).
According to this post, that is the correct order.
Another suggestion is to check the baud-rate. Note that I am working with Turtle 1, which was working perfectly (with a ROS foxy stick) before.
The software update was not enough, but after the firmware update of the opencr (now v1.2.2) the launch was succesfull and I could see the topics at nb-ros with rostopic list:
/battery_state
/cmd_vel
/cmd_vel_rc100
/diagnostics
/firmware_version
/imu
/joint_states
/magnetic_field
/motor_power
/odom
/reset
/rosout
/rosout_agg
/rpms
/scan
/sensor_state
/sound
/tf
/version_info
When the Melodic connection works, I could try ROS bridge.
Had to install sudo apt-get install ros-melodic-turtlebot3-teleop first, but after that roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch works.
The error message seems to be not related with handclosed. That is changing the cursor when dragging the blocks. handclosed and handdelete works, handopen not. All three hand*.cur can be found in frontend/blocky/media.
Interesting directory is frontend/blockly/generators/python/scripts/.
Seems that I cloned the master-branch of Blockly, while the column with Turtleblocks is defined in the testTurtlebot branch. Also switched the branch in ace-build: git checkout gh-pages. Now I have most of the Dabit-Turtlebot3 elements:
The one missing seems to be the Stop block.
Tried to launch my first program, but the button Launch shows Server down.
The webserver gives also warnings: /pages/assets/handclosed.cur: File not found.
Yet, the turtle is running ROS2 foxy, so I will first try to control it via nb-ros.
The ROS_DOMAIN_ID was set on 0, changed it to the default 30.
Followed the instructions and could ssh to the expected ip of the turtlebot.
For Turtle 4 the ROS_DOMAIN should have been 4!
When I start up ros2 launch turtlebot3_bringup robot.launch.py the output reports that everything is OK. Yet, I don't see any topics back in the list. Doing the same with Turtle 1 gives:
/battery_state
/clicked_point
/cmd_vel
/imu
/joint_states
/magnetic_field
/move_base_simple/goal
/odom
/parameter_events
/robot_description
/rosout
/scan
/sensor_state
/tf
/tf_static
Checked the SD-card of Turtle 1 in Turtle 4, which works. Turtle 1 has not the ip from the manual, it has now ip 192.168.0.105
With ROS_DOMAIN_ID=0 I was able to see the topics. The rqt-tool fails on nb-dual, but rviz2 is able to see the robot_description. Yet, the scan is not visible, although I can see the measurements when I do ros2 topic echo /scan.
I had to do ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 map odom to make the /robot_description visible:
Installed the rosglove tool, which shows that the laserscans are changing, but could only find a text-based panel. Also the teleop panel didn't work.
The ros2 run turtlebot3_teleop teleop_keyboard required that I defined the environment variable TURTLEBOT3_MODEL=burger. After that the comand ros2 run turtlebot3_teleop teleop_keyboard started, but nothing moved. In the mean time the turtle was beeping, so maybe I should reload the battery.
Running Rviz as instructed gave a few were many frames were missing. Doing ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 map odom was not enough.
rqt fails on an import from python_qt_binding. Currently I use python3.8.
The teleop_keyboard now works (nicely slowly).
Downloading the ROS melodic Turtlebot SD-card image for the Raspberry Pi.
Also downloaded the Raspberry Pi burner on nb-ros.
Strange enough, the download seems not to install the rpi-imager.
It can be installed by sudo snap install rpi-imager, but that version fails to see the SD-stick.
So, installed the rpi-imager on nb-dual.
Wrote the Rapsberry 3B image. Could connect to vislab_wifi. Defined the ROS_MASTER_URI and ROS_HOSTNAME.
Encountered the problem with the ROS GPG Key, so followed the instructions. After that sudo apt update works.
Installed libc6:armhf, but assumed that the firmware update was already done .
Back to nb-ros. Installed 147 new packages.
The bringup seems to work, only didn't power up the OpenCR. To be tested tomorrow.
The Blocky blocks can be opened to reveal the python code below, which is build on top of ROS.
The Mirte can have a Jupyter notebook running, although it is a bit heavy for the Orange Pi.
Note that the Turtlebot blocky code is 5y old and tested on Ubuntu 16.04 and ROS Kinetic Kame.
Looking if I could also build it on a Ubuntu 18.04 machine (nb-ros) with ROS Melodic.
Seems that Melodic accepts the same catkin commands as Kinetic: catkin_make_isolated --install.
The recurse-submodules seems not to work. Try it per submodule.
Seems that the tag was no longer valid. Instead did a direct git clone https://github.com/aravindk2604/ace-builds.git
The build worked (although for the launch you need source devel_isolated/turtlebot3_blockly/setup.bash). The turtlebot3_blockly_backend.py fails on import mavros.
Followed the instructions from Mavros python examples and installed pip install MAVProxy and sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras.
Next package to be missing is autobahn. Installed it with pip install autobahn, but still fails. The call is actually in python3.6, so I had to do pip3 install autobahn. Now I get the output:
SUMMARY
========
There are two options: Lite and Pro. Concerning sensors and actuators, the main difference are the IMU, LEDS and display (which we have). So, an option for an assignment would be to upgrade a Lite to a Pro.
Surprised that the control board is a Raspberry Pi and not a Jetson. That would also be an option.
For the chess-robot, the GelSight Mini ($499) would be great to detect if the chess piece is in the hand. USB-based and has a ROS and python interface.
September 22, 2022
Copied the joints.txt from nb-dual to nb-ros, and made playall read this file in an endless loop.
The UMI-RTX performed this loop without problems for more than 4 hours.
September 8, 2022
Trying to replicate the experiment of March 10 with nb-dual in the new robolab.
Also tried bin/chess. The initialisation works, but chess itself fails after:
before get_command(black)
inside get_command(black)
Created file: chess.error_report
The command sudo ./invinit seems to work (although I see no UMI-prints, so the final commands seems not to be send):
Read information about robot from xml-file:
'../data/umi.rtx'.
Placing robot in standard position.
zed sh elbow yaw pitch roll grip
800.0 -90.0 0.0 0.0 0.0 0.0 0.0
Done.
Robot should now be in the starting position.
The command sudo ./pathinit fails:
MAIN begin
Read information about chess_board from file:
'../data/board.rtx'.
Read information about chess_set from file:
'../data/pieces.rtx'.
spp_draw_board: opening file ../tmp/board.rtx
Read current board file ../tmp/board.rtx with 864 items in draw_board
Yet, for tomorrow I need the program playall (continuation from March 14, 2022.
The playall is already made in src/playall, but fails on no such file ../data/name_file. Copied playall and joints.txt to bin. Then it works (no idea what it does (drawing?)
Tested the code on Ubuntu 18.04 from nb-ros. For the chess executable the robot also nicely initializes, but stops after gnuchessr says.
The progress holds in chess_command in chessraw, where a call to gnuchessr is made (which is not made yet).
Made gnuchessr. The program itself works:
Chess 3.1
Opening the book ../data/gnuchess.book
e2e4
1. e2e4
1. ... e7e5
My move is: e7e5
b1c3
2. b1c3
2. ... g8f6
My move is: g8f6
The gnuchessr is started up with a fork, but now the programming is no longer continuing:
inside get_command(black)
Created file: chess.error_report
I expect to see inside chess_command, but nothing is printed.
Strange enough, the command ./gnuchessr 1 4 does something different at nb-ros and nb-dual. On nb-ros it prints two empty lines, and the initial board, followed by Your move is?. On nb-dual no question is printed, although the program responds to a legal move as 'e2e4'.
Synchronized both repositories, now both start with printing the board.
March 23, 2022
Tested the compilation at nb-ros (Ubuntu 18.04), Created spp.h with definitions of the functions. Only receive a warning that in studb_pp/pp.c SAFE_HEIGHT is redefined (from 140mm to 220mm).
March 22, 2022
Tried in subdirectory move to do make rtxinit. Still missing references: rtx_move_list and move_list.
move_list is defined in game/chesscmds.c, when MAIN1 is defined. Yet, init_invkin uses the same function. No, that was protected with an #if 0. Recompiled, and it chess could be made in game.
Tested chess. Goes well, until:
No such file /home/rtxipc/robot/name_file
No access rights for user
Contact the practicum-assistants
before get_command
inside get_command
Created file: chess.error_report
gnuchessr says 0�j�
Added a correct location of the name-file. Now the initialization geos well, although the program chess starts after that (gnuchess says nothing):
ETX is now external initialised
before get_command
inside get_command
Created file: chess.error_report
gnuchessr says
Checked update_board_strike(). It finds a piece at e4, which is incorrect. The piece also has incorrect parameters (side is an enum of black and white):
Board-garbage does exist, with side -42875 and pos 0
The update_board_strike is called twice in make_path. Seems that the human move is incorrect. Confusing is that both chess_move_tm and chess_move_t exist. chess_move_tm is defined in basics.h, and used in make_path.c and move_piece.c.
The human move seems to be OK, update_board_strike fails on the computer_move, which it receives from remove_piece.
In pathplan.c the command 'e2e4' is converted to format '4143'. Used that to see if I can go further, but it seems that even the board is not correct:
MAIN begin
Read information about chess_board from file:
'../data/board.rtx'.
Read information about chess_set from file:
'../data/pieces.rtx'.
after init_pathplan
From (row column) To (row column): 4143
Path Planning: Start
Succesfull opened file ../tmp/board.rtx with 1 items
7 0 0 0 0 1 2 3 4
6 . . . . 0 0 0 0
5 . . . . . . . .
4 . . . . . . . .
3 . . . . . . . .
2 0 0 0 0 . . . .
1 5 3 2 1 0 0 0 0
0 . . . . 1 2 3 4
Remove the board, so that it could make a fresh one. Same result. Moved the board.rtx from robotics/src/game to ~/git/umi-rtx/tmp, same result.
Yet, in main.c there was a strange human move('0303'), changed that in '4645' (e736).
In stub_init_board all the pieces are put on the board, strange that it fails on the Black trash (piece != NULL) while it should.
Added a draw_board directly after stub_init_board in stub_pp/pp.c, but noting is drawn. Also added it in init_pathplan.c Now something happens:
spp_draw_board: opening file ../tmp/board.rtx
Read current board file ../tmp/board.rtx with 864 items in draw_board
Segmentation fault (core dumped)
March 15, 2022
The libpathplan.a can be build, still move has some missing references. One of them is stub_init_board, another is Rotx3D and Roty3D.
Tried to build a test for pathplan with the provided main, but that uses Xyz_list_tm instead of xyz_list_t.
Made a line in the makefile to compile main.c, to test the package. But also this executable has still some dependencies (as on matrix). Commited this version.
Made a working stub_pp and matrix. Move is still missing some functions (move_list), but in pathplan I can do make pathinit.
Yet, sudo ./pathinit fails with a segmentation fault:
MAIN begin
Segmentation fault
The segmentation fault is due because init_pathplan tries to read ../data/board.rtx which doesn't exist. fopen returns a NULL, not a negative number, so error handling wasn't activated. Corrected that, which brings a bit further:
MAIN begin
../data/board.rtx: No such file or directory
Sorry, cannot read the details of board.
Can't continue.
Segmentation fault
Also handle this gracefully. Next segmentation is in load_board:
MAIN begin
../data/board.rtx: No such file or directory
Sorry, cannot read the details of board.
Can't continue.
after init_pathplan
From (row column) To (row column): e e
Path Planning: Start
Error in 'load_board'; couldn't open file.
Segmentation fault
load_board now returns an error when the file doesn't exists. The program now fails gracefully:
MAIN begin
../data/board.rtx: No such file or directory
Sorry, cannot read the details of board.
Can't continue.
after init_pathplan
From (row column) To (row column): e2 e4
Path Planning: Start
Error in 'load_board'; couldn't open file.
MAIN end
Made sure that board file existed, yet this triggers again a segmentation fault: more ../data/board.rtx 165.00
165.00 0.00 0.00 0.00 1.00 0.0038.5038.5018.0015.0015.00
Still:
MAIN begin
Read information about chess_board from file:
'../data/board.rtx'.
Segmentation fault (core dumped)
This was a missing pieces file. I already repaired that, but forget to link to the updated library. Now I get (without ../data/pieces.rtx:
MAIN begin
Read information about chess_board from file:
'../data/board.rtx'.
../data/pieces.rtx: No such file or directory
Sorry, cannot read the lengths of the arm.
Can't continue.
after init_pathplan
From (row column) To (row column): e2 e4
Path Planning: Start
Error in 'load_board'; couldn't open file.
MAIN end
Also provided the two missing files. Still, something goes wrong:
MAIN begin
Read information about chess_board from file:
'../data/board.rtx'.
Read information about chess_set from file:
'../data/pieces.rtx'.
after init_pathplan
From (row column) To (row column): e2 e4
Path Planning: Start
Succesfull opened file board.rtx with 1 items
free(): double free detected in tcache 2
Aborted (core dumped)
Indeed, load_board closed its file discriptor twice. Still a SIGSEGV, but in code compiled without debug information: Cannot access memory at address 0x3ff0000000000000>, eb=0x0, a=-9920) at genops.c:33. Added some print statements. It goes wrong in make_move_list() in Path_plan.c
The b2l_matrix goes still well, check further. Goes wrong after Step4: update_board_strike()
Note that the local board.rtx is now binary. Made a tmp directory for this file.
March 14, 2022
Found an old README from Matthijs Spaan en Capser Dick on the umi-drivers, including the rational behind IPC and hostlib. Added that file to the hostlib directory on github.
Continue with adding everything needed for playall and game to the repository.
Starting with the umi-directory. Made a different include directory for the robotics (course) files. Seems that this directory has a dependence on libarm.a, which is part of the previous build umi-drivers
umiinit.c is using arm_init_position(), which should be defined in a arm.h
Actually, this function is defined in test/init.c. Yet, it is both defined and used in umiinit.c
Commited the code. Also tried out the umiinit, which is a simple test when you created when you type make umiinit. The exec is created without errors, but the program fails with:
U.M.I. RTX Robot Arm
====================
Initialisation Program $Revision$
======================= ARM version 8 March 2022
downloadlib has problems connecting to UNIX socket: No such file or directory
[armlib:downloadlib] failed
Can't open the data file 'init.dat'
Using data from program
arm_stop(3)
RTX can not be initialised!
Error: Communication not initialised
When I try sudo rtxsh, go to arm and do init_comms 1 2 the initiation works fine:
arm> init_comms 1 2
======================= ARM version 8 March 2022
Problem is the location of the binary (PORTINFO is read from a path relative to the binary. When I move the program to ~/git/umi-rtx/bin it works fine:
U.M.I. RTX Robot Arm
====================
Initialisation Program $Revision$
======================= ARM version 8 March 2022
Can't open the data file 'init.dat'
Using data from program
arm_stop(3)
Initialising Zed
arm_stop(0)
Initialising Gripper
arm_stop(0)
arm_stop(0)
Initialising Wrist
move elbow out ..
arm_stop(0)
move elbow out done..
arm_stop(0)
arm_stop(0)
arm_stop(0)
arm_stop(0)
Initialising Shoulder
arm_stop(0)
Initialising Elbow and Yaw
arm_stop(0)
Initialising Zed
arm_stop(0)
Going to initial position...
RTX is now initialised and ready to use
Next is move, which defines rtx_move_init. It calls both the initialisation of the inverse kinematics and pathplanning, so should be later in the queue. It only includes "path.h" (on IK), and should have a define on REAL or SIMULATOR.
Actually, the rtx_move_list(0 is defined in simulator/simulator.c, while the actual umi_move is performed in simulator/robot.c. Also rtx_simulator_list() is defined in simulator/simulator.c
So, the move-directory has a dependency on pathplan and inverse.
Start with inverse. Compiles, but is missing the functions sqrt, atan2, acos and read_xml_robot. The mathematical functions are easy solved with adding -lm, but for the last one I need directory xml_parser.
Created the library. Also make create_xml_robot_info works, although the command ./create_xml_robot_info seems to work:
Read information about robot from xml-file:
'../data/umi.rtx'.
Written information about robot into binary file:
'../data/linux/umi.rtx'.
but actually the binary files is empty.
Note that libxmlparser.a is not added to libpract.a
Added libxmlparser.a to the Makefile of inverse and make invinit, which gives:
./invinit
Read information about robot from xml-file:
'../data/umi.rtx'.
Placing robot in standard position.
Yet, the robot doesn't move, so the last sentence is a bit optimistic.
There was a move_list.c, but that is not a known function. playchess defines it in move_list.c, chessmds.c also impliments it.
Tested the -DMAIN with S-DIMULATION and with D-DEBUG option. Gives for SIMULATION option:
Read information about robot from xml-file:
'../data/umi.rtx'.
Placing robot in standard position.
zed sh elbow yaw pitch roll grip
800.0 -90.0 0.0 0.0 0.0 0.0 0.0
Done.
and for the DEBUG option:
Read information about robot from xml-file:
'../data/umi.rtx'.
Robotnaam = Umi-Rtx Robot software Stam, Janssen, den Boer en v. Inge
Theta alpha a d ecmin ecmax Rmin Rmax RT
90.00 0.00 67.50 1082.00 -3478.00 0.00 0.00 925.00 2.00
0.00 0.00 253.50 95.00 -2630.00 2630.00 -90.00 90.00 1.00
0.00 0.00 253.50 80.00 -2630.00 2206.00 -180.00 151.00 1.00
0.00 -90.00 0.00 0.00 -1071.00 1071.00 -110.00 110.00 1.00
0.00 90.00 0.00 0.00 -2642.00 108.00 -98.00 4.00 1.00
0.00 0.00 0.00 189.00 -3560.00 4882.00 -132.00 181.00 1.00
0.00 0.00 0.00 0.00 -30.00 1200.00 0.00 90.00 0.00
Placing robot in standard position.
March 10, 2022
Tested the new code on nb-dual, and it worked flawlessly.
First checked if there was still a data-file owned by root, but all files were from the local user.
Tried to run the daemon without root permission, but that gave this error message in the log:
tail ../logs/rtxlog
2022-03-10 09:25:23 (RTXD) Restarting, listening to port 42937 on XPS-13-9300
2022-03-10 09:25:23 (RTXD) Couldn't open '/dev/ttyUSB0'
2022-03-10 09:25:23 (RTXD) No rtx_ops found for '/dev/ttyUSB0'
2022-03-10 09:25:23 (RTXD) Can not talk to RTX
With sudo, the log shows only the Restarting message.
The same for the shell. Without sudo the command ./rtxsh:
RTX command line interface $Revision$
======================= ARM version 8 March 2022
downloadlib has problems connecting to UNIX socket: Permission denied
[armlib:downloadlib] failed
init: Retry the connection
======================= ARM version 8 March 2022
downloadlib has problems connecting to UNIX socket: No such file or directory
[armlib:downloadlib] failed
init: Cannot connect to daemon
rtxsh> quit
With sudo, you get:
RTX command line interface $Revision$
======================= ARM version 8 March 2022
rtxsh> arm
arm> soak init
arm> soak off
arm> quit
rtxsh> quit
Tried again at nb-ros, which also works (didn't do make clean at nb-dual), if you type in the right commands.
Without argument, the daemon tries to connect via IPC:
2022-03-10 09:37:27 (RTXD) Restarting, listening to port 33849 on nb-ros
/dev/ipc0: No such file or directory
/dev/vme32: No such file or directory
2022-03-10 09:37:27 (RTXD) Can not open IPC
2022-03-10 09:37:27 (RTXD) 'IPC' should start with '/dev/'
2022-03-10 09:37:27 (RTXD) No rtx_ops found for 'IPC'
2022-03-10 09:37:27 (RTXD) Can not talk to RTX
On nb-ros there were files owned by root (from previous sessions) in the directory umi-rtx/ports (rtx and rtx-socket). That gives another error message :
Current working dir ~/git/umi-rtx
./ports/rtx: Permission denied .
With sudo for the daemon and shell I could perform a soak init.
Did a clean installation on my workstation (Ubuntu 21.04).
The rtxlib gives still some warnings. A few could be repaired, but I don't see which code or library implements the function putstatus.
By mistake I edited the rtxlib files on nb-ros, so I first had to install github cli to be able to push and pull code to the repository.
Made an end of rtxcmds.c as link in daemon and shell. Yet, daemon was compiled with the option -DIPC. Compilation of the shell works, as long as the two libaries (libvrtx.a and librtx.a) are called in the right order.
Time to test to new 'clean' version tomorrow.
March 8, 2022
Copied and made without warnings armlib (only modified the Makefile).
Still, the rtxsh fails to be linked, because of undefined references in misc.c:
~/git/umi-rtx/src/shell/misc.c:433: undefined reference to `rtx_probe'
~/git/umi-rtx/src/shell/misc.c:534: undefined reference to `rtxstrcommand'
~/git/umi-rtx/src/shell/misc.c:574: undefined reference to `rtx_finish'
This function is defined in ../daemon/vrtx.c.
Solved this a bit crude with creating symbolic links in the makefile (equivalent with the daemon/Makefile):
rtxcmds.c : ../rtxlib/rtxcmds.c
ln -s ../rtxlib/rtxcmds.c .
That works, although I get some other undefined references.
Created a new libvrtx.a, with vrtx.o ipcio.o ttyio.o in it. Combined with libhost.a that works to build rtxsh.
Unfortunatelly, still problems with the socket:
sudo ./rtxsh
RTX command line interface $Revision$
======================= ARM version 27 July 2016
downloadlib has problems connecting to socket: No such file or directory
[armlib:downloadlib] failed
init: Retry the connection
======================= ARM version 27 July 2016
downloadlib has problems connecting to socket: No such file or directory
[armlib:downloadlib] failed
init: Cannot connect to daemon
rtxsh>
Tried the same with the code in /opt/prac/robotics/rtxipc/bin. There rtxsh starts without problems. Tried the combination of /opt/prac/.../rtxd and ~/git/.../rtxsh which fails.
The vice-versa combination (~/git/.../rtxd and /opt/prac/.../rttxsh fails with a simple:
RTX command line interface $Revision$
======================= ARM version 27 July 2016
init: No response
rtxsh>
Updated armlib/armcmds.c: (ARM version 8 March 2022)
Added a chdir(RTX_DIR) before I open RTXD_PORTINFO in armraw.c.
Yet, download.c failed because no nlist.h was available. Yet, at nb-dual this works, without nlist explicitly in one of the included directories.
Actually, nlist.h on nb-dual is in /usr/include and /usr/include/bsd (from Jan 2020 / Aug 2021). Another source could be openbsd
With those two files compilation works, but making the daemon fails on missing -lelf. Without the elf-library there is an undefined reference to nlist.
Note that I made a install-dependency.sh script with sudo apt install libelf-dev and sudo apt install libreadline-dev.
March 7, 2022
Starting testing on nb-dual. The rtxd in the git nicely starts, although it publishes its log still on opt/prac/robotics/rtxipc/logs/rtxlog.
Testing this deameon with th chess program in ~/onderwijs/ZSB/assistance/repository/robotics/src/game (Feb 24).
The game stopped on Alarm clock when removing a piece from the board (should increase the time-out with a factor 2).
Modified rtxd.c: it now reads everything relative from ./bin/... Seems to work. Also changed the group of rtxd to dailout. The rtxd-daemon starts nicely, but umi_init fails:
U.M.I. RTX Robot Arm
====================
Initialisation Program, UMI version 19 June 2014
======================= ARM version 27 July 2016
downloadlib has problems connecting to socket: Connection refused
[armlib:downloadlib] failed
init connections : Cannot connect to daemon
restart: Communication not initialised
Trying to make rtxsh in ~/git/umi-rtx.
Renamed usage, error, warn to their equivalent in the rtxsh_ namespace. Functions where defined in shell.c
March 1, 2022
Starting with adding the first code to github: the rtx daemon.
Not clear if I made a fresh daemon and tested it. Copying the code from ~/onderwijs/ZSB/assistance/repository/umi-drivers. Oldest files are from June 2013, latest files from Jul 2016.
Makefile depended on both ../Makefile.std and ../Makefile.common. Should check what is the difference.
There are include files in the daemon directory and in a ../include directory. Decided to create include/umi-drivers, to distinguish from the robotics includes.
Changed some of the includes from system to local.
Updating the includes. Making progress, until ttyio.c, which fails on missing sys/filio.h.
Couldn't find the file, so made for the moment a local copy from https://github.com/openbsd/src/blob/master/sys/sys/filio.h v1.5 (1994).
As this post says: filio.h is typically on bsd or bsd-variants like solaris. So, looks like that I need an additional IFDEF, because Linux is not Solaris. Actually, it is protected with #ifndef __USE_BSD
That compiles, although I receive some warnings on misleading idents (which are misleading (see line 581 and 583 from ttyio.c). Should correct that when I can test.
Now I got into some makefile dependencies. The makefile needs rtxcmds, which it links from ../rtxlib. That goes well. Yet, with the flag MAKLIBS true, the makefile goes into the directories of the needed libraries and does a make there. In rtxlib this goes wrong, because it ../hostlab/linux doesn't exist (yet).
The make is now ready with compiling, but fails with linking on missing option -lelf. Removing this options helps, the linking now fails on rtxcmds.o, openipc.o and download.o to be recompiled.
Removed rtxd.2013.
rtxlib now compiles, although I receive some warnings on implicit int declarations in raw.c
Committed first version with code (for the rtxd). Should be tested with umi-rtx (for instance with nb-ros).
February 28, 2022
Received a hardcopy of the Inside RTX and Maintenance Manual for RTX (August 1987). Also received a box with spare parts, including a number of belts and an elbow pulley (7038/06/00#29,#39,#40,#42,#43 and 7038/06/12.
Couldn't find the serial number of the robot. Maybe under the cover or on the bottom.
February 24, 2022
Trying to run (coupled to gnuchess-3.1) on the UMI-RTX. A whole game is suggested by gnuchess, but the program doesn't wait till the movement is executed.
The chess-board is complete, except two white knights and one white bischop.
Actually, the move_list body was commented out with the comment /* obsolete I hope, Matthijs */
Yet, when uncommented, the alarm I have set kicks in:
RTX is now external initialised
before get_command
inside get_command
Created file: chess.error_report
gnuchessr says Chess
command : white
before mode select
before chess_command GO
command : go
answer : 1. go
answer : 1. ... e2e4
after chess_command GO
1. e2e4
after get_command
before move_list
RTX ready to use
Alarm clock
Increasing the alarm with a factor 10 (to alarm(30) solves this. It played 10 plys, the only thing what failed was the move 7. ... e1g1, which is a two-step of the King, so should have been o-o.
February 23, 2022
Tried out the oldest version from gnu.org (gnuchess-5.05), but this program outputs in the same SAN-format.
Searched for gnuchess-4. The link to gnuchess-4.0.pl79 on ibiblio.org was broken, but I found an old archive which had gnuchess-4.0.pl74.
Unfortunatelly, building this version failed on TLS definition: /lib/x86_64-linux-gnu/libc.so.6 section .tbss mismatches non-TLS reference in dspcomN.o. This file is made with options $(CC) $(CFLAGS) $(HASH) $(LANGF). CC is called with teh options -DUSEINT -DCACHE -DGDX -DHASGETTIMEOFDAY -DNULLMOVE -DQUIETBACKGROUND -DWAY4PL64 -DHISTORY -DHASHSTATS -DAGING -DKILLT -DECO -DUNLIMITEDCAPS -DPRUNE -DOLDTIME
Following the 3rd suggestion and adding __thread to the extern int ernno definition works, yet the linking still fails, because the inline function CheckMove is not recognized.
Found this askubuntu page on gcc-versions. Could install gcc-7 and see if that works. Compiling works, linking still fails on CheckMove. With gcc-5, following the instructions of adding xenial repositories, and also adding __thread to the errno in gnuan.c it works. Tried ./gnuchessr, which gave:
~/packages/gnuchess-4.0.pl74/src$ ./gnuchessr
Enter [moves] minutes[:sec] [increment][+]:
White 0:00 Black 0:00
R N B Q K B N R
P P P P P P P P
- - - - - - - -
- - - - - - - -
- - - - - - - -
- - - - - - - -
p p p p p p p p
r n b q k b n r
Book used 0 of 250000 entries.
Warning can't find book.
Playing without hashfile
Your move is? go
1. ... e2e4
My move is: e2e4
Note that gnuchess-3.1 is also still available on the old archive.
Looking at ~/onderwijs/ZSB/assistance/repository/robotics/src/playall, which was last updated in 2014.
Started the daemon with sudo /opt/prac/robotics/rtxipc/bin/rtxd /dev/ttyUSB0.
Running sudo playall worked, the joints.txt seems to be a forward push. The exectuble is using an older ARM version:
U.M.I. RTX Robot Arm
====================
Initialisation Program, UMI version 19 June 2014
======================= ARM version 18 July 2014
Recompiled the program with make playall. Now the 2016 version of the ARM-lib is used:
U.M.I. RTX Robot Arm
====================
Initialisation Program, UMI version 19 June 2014
======================= ARM version 27 July 2016
Looking into ~/onderwijs/ZSB/assistance/repository/robotics/src/game
In chessraw.c the function chess_init() executes a fork and starts a programm gnuchessr from the path DEF_PROGRAM defined in gnuchessr.h, which again is GNUCHESS defined in ~/onderwijs/ZSB/assistance/repository/robotics/include/config.h. This points to /opt/prac/robotics/bin/gnuchessr, which should be /opt/prac/robotics/rtxipc/bin/gnuchessr. (and when exectuted directly indicates that no ./gnuchessr exists).
Looks like GNU Chess still exists (latest version 6.2.9 is from July 2021). Downloaded this version. It was made without any problems.
Followed the instructions and started ~/packages/gnuchess-6.2.9/src/gnuchess:
GNU Chess 6.2.9
Copyright (C) 2021 Free Software Foundation, Inc.
...
White (1) : easy
White (1) : new
White (1) : post
White (1) : depth 8
Search to a depth of 8.
White (1) : go
Thinking...
1 +26 0 2 Na3
White (1) : 1 +54 0 3 Nc3
2 +0 0 44 Nc3 Nc6
3 +54 0 148 Nc3 Nc6 Nf3
4 +0 0 300 Nc3 Nc6 Nf3 Nf6
5 +48 0 1729 Nc3 Nc6 Nf3 Nf6 d4
6 +0 0 3331 Nc3 Nc6 Nf3 Nf6 d4 d5
7 +42 1 15332 Nc3 Nc6 Nf3 Nf6 d4 d5 Bf4
8 +0 3 35078 Nc3 Nf6 Nf3 Nc6 d4 d5 Bf4 Bf5
8 +0 6 72286 Nc3 Nf6 Nf3 Nc6 d4 d5 Bf4 Bf5
black KQkq
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . N . . . . .
P P P P P P P P
R . B Q K B N R
My move is : Nc3
Invalid move:
Black (1) : Nf6
1. Nf6
white KQkq
r n b q k b . r
p p p p p p p p
. . . . . n . .
. . . . . . . .
. . . . . . . .
. . N . . . . .
P P P P P P P P
R . B Q K B N R
r n b q k b . r
p p p p p p p p
. . . . . n . .
. . . . . . . .
. . . P . . . .
. . N . . . . .
P P P . P P P P
R . B Q K B N R
My move is : d4
Changed include/config.h, which now points to ~/packages/gnuchess-6.2.9/src/gnuchess.
Going to test it with chessraw.c. Note that in the gnuchess code in ~/onderwijs/ZSB/assistance/repository/robotics/src/game is version 3.1 from 1990.
Note that the oldest version on Gnu Chess is v 5.05 from 2002.
Could still make gnuchessr in ~/onderwijs/ZSB/assistance/repository/robotics/src/game/gnuchess. I could also execute it. No response on easy, new, post. Depth gave a response (Illegal move (no matching move generated)), but go gave
1. go 0
1. ... d7d5
My move is: d7d5
quit
2. quit 11 d7d5 g1f3 g8f6 e2e3 c8g4 h2h3 g4h5 g2g4
Copied this version to /opt/prac/robotics/rtxipc/bin.
Modified config.h to point to this executable.
Making chess works (although I receive many warnings). Yet, executing the chess programms fails after the initialisation:
RTX is now external initialised
*** buffer overflow detected ***: terminated
Aborted
Added some debug statements and defined the correct location of gnuchess.book:
Placing robot in standard position.
before get_command
inside get_command
command : white
*** buffer overflow detected ***: terminated
Looked with gdb. The program crashes in chessraw.c:425
Increased the search_size. Now it works, the segmentation fault occurs when White wins:
44. ... e8e7
after get_command
before move_list
inside get_command
command : white
before mode select
before chess_command GO
command : go
answer : 89. go
answer : 89. ... c7e7
after chess_command GO
45. c7e7
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : White
Segmentation fault (core dumped)
Modified chesscmds.c so that it handles a win correctly. In most cases it works.
For instance a Draw:
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : 184. go
answer : 184. ... f4g4
after chess_command GO
92. f4g4
92. ... f4g4
after get_command
before move_list
inside get_command
command : white
before mode select
before chess_command GO
command : go
answer : Draw No pieces
It is a draw!
after chess_command GO
Ready!
after get_command
Time to stop
Black has won:
0. h3g3
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : 120. go
answer : 120. ... h1h2
after chess_command GO
60. h1h2
60. ... h1h2
after get_command
before move_list
inside get_command
command : white
before mode select
before chess_command GO
command : go
answer : Black
Black
has won!
after chess_command GO
Ready!
after get_command
Time to stop
A win for White:
1. ... e8f8
after get_command
before move_list
inside get_command
command : white
before mode select
before chess_command GO
command : go
answer : 123. go
answer : 123. ... d3d8
after chess_command GO
62. d3d8
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : White
White
has won!
after chess_command GO
Ready!
after get_command
Time to stop .
Yet, sometimes go gives no answer:
95. e2c2
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : 190. go
answer : 190. ... a8a7
after chess_command GO
95. a8a7
95. ... a8a7
after get_command
before move_list
inside get_command
command : white
before mode select
before chess_command GO
command : go
answer : 191. go
answer : 191. ... b7a7
after chess_command GO
96. b7a7
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : 192. go
According to gdb chessraw.c is hanging on line 501: fgets(answer, BSIZE, from);, so there comes no answer. Added an alarm of 3 seconds, which seems to work:
96. g3f3
after get_command
before move_list
inside get_command
command : black
before mode select
before chess_command GO
command : go
answer : 192. go
Alarm clock
Looked if version 6.2.9 could also be used. First attempt failed on license information.
Gnu Chess 3.1 only has one answer at startup:
/opt/prac/robotics/rtxipc/bin/gnuchessr
Chess
Gnu Chess 6.2.9 has five lines as answer at startup:
~/packages/gnuchess-6.2.9/src/gnuchess
GNU Chess 6.2.9
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Chess
Made some corrections, the chess_init and white is now handled correctly:
Placing robot in standard position.
before get_command
inside get_command
Created file: chess.error_report
gnuchessr says GNU Chess 6.2.9
command : white
answer : White (1) : Command 'white' is currently not supported.
before mode select
before chess_command GO
Created file: chess.error_report
gnuchessr says GNU Chess 6.2.9
command : go
answer : White (1) : Thinking...
White (1) : Thinking...
has won!
after chess_command GO
Ready!
after get_command
Time to stop
Only the go-command gives now responds wiht 14 lines, instead of 2 lines. Yet, the final line is the same, yet in another format: My move is: g8f6 (3.1) versus My move is : Nf6
This question is asked before. The suggestion was to use another engine (like stockfish).
In line 609 of frontend/move.cc a test is made if the string is in e2e4 notiation.
In line 198 of frontend/common.h the macro MOVE, TOSQ and FROMSQ are defined. ASCIITOSQ is defined in frontend/move.cc
February 7, 2022
At nb-dual, in ~/onderwijs/ZSB/assistance/repository/umi-drivers/chess_demo, I made a copy chess and chesscmds.c
chesscmds.c has several defines, such as MAIN1 and GNUCHESS
First tried a simple make. Got a warning that I am overriding recipe for target 'depend' (line 34), that I am using ../Makefile.common, with its own warning warning: ignoring old recipe for target 'depend' (line 15), which result in the error /usr/lang/cpp: not found
Changed in Makefile the definition of DEPGEN, and a new makefile is made with dependencies added to it (still the warning ignoring old recipe for target 'depend'). Yet, the additional lines now give *** missing separator. Stop..
Instead did make chess. Compiling gave two warnings. Problem was the linking. chessraw.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
Repaired the warnings. make all builds without the problems Linux/libchess.a (chesscmds compiled with flags -DMAIN1 and -DARNOUD). Also touched chessraw.c, which gave two warnings (and still same -fPIE error). Solved the two warnings, (check from move[0] == NULL to move == NULL), but -fPIE flag is also needed for libarm.a
Started in ~/onderwijs/ZSB/assistance/repository/robotics/src/umi. Moved the *.d to backup. Got some warnings. The manual of cuserid indicated that cuserid was defined in the 1988 version POSIX, but removed in the 1990 version. They said Do not use cuserid(), but use getpwuid(geteuid()) instead. Getpwuid seems a bit overkill, because it returns a complete structure, incuding name, group, shell, etc. An example of cuserid is given here. Replaced it for the moment with getlogin_r(user_name,L_cuserid);, which should do the same (difference between user of the shell and effictive user of the program).
Continue with ~/onderwijs/ZSB/assistance/repository/robotics/src/pathplan. The file Path_plan.c includes several source files. For instance, queue.c uses an implicit declaration of malloc. Added stdlib.h to queue.c. So first remove Path_plan.o, before you run make all. Removed some warnings in the code, by defining some new *.h files.
The inverse, matrix, xmlparser libraries were made without problems.
To make stub_ik I had to remove some warnings.
chess is now build anew.
Tested ~/onderwijs/ZSB/assistance/repository/umi-drivers/chess_demo with the daemon in /opt/prac/robotics/rtxipc/bin
January 14, 2022
Succesfully executed sudo ./playall joints.txt in ~/onderwijs/ZSB/assistance/repository/robotics/src/playall on nb-dual. The joints.txt seems to be a drawing move, not a chess move, because the gripper is pointing forwards, instead of downwards.
Moved to ~/onderwijs/ZSB/assistance/repository/umi-drivers/chess_demo and executed sudo ./chess, which gives a segmentation fault after it read /opt/prac/robotics/data/pieces.rtx
Checked with gdb chess where the segmentation fault occurs, but it is in init_invkin (line 274), when it try to reads /home/arnoud/src/robotica/data/umi.rtx.
Once I provided that file, the command ./sudo chess executes a 'e2-e4' move, followed by putting this e4 piece next to the board:
init_board
Read information about chess_board from file:
'/opt/prac/robotics/data/board.rtx'.
Read information about chess_set from file:
'/opt/prac/robotics/data/pieces.rtx'.
Read information about chess_board from file:
'/opt/prac/robotics/data/board.rtx'.
Read information about chess_set from file:
'/opt/prac/robotics/data/pieces.rtx'.
Read information about robot from file:
'/home/arnoud/src/robotica/data/umi.rtx'.
Placing robot in standard position.
U.M.I. RTX Robot Arm
====================
Initialisation Program, UMI version 19 June 2014
======================= ARM version 27 July 2016
arm_stop(3)
Initialising Zed
arm_stop(0)
Initialising Gripper
arm_stop(0)
arm_stop(0)
Initialising Wrist
move elbow out ..
arm_stop(0)
move elbow out done..
arm_stop(0)
arm_stop(0)
arm_stop(0)
arm_stop(0)
Initialising Shoulder
arm_stop(0)
Initialising Elbow and Yaw
arm_stop(0)
Can't open the data file 'init.dat'
Using data from program
RTX is now external initialised
RTX ready to use
No Piece in PICK_UP!
Can't execute an empty list.
Only thing that fails is that the gripper closes not far enough around the pawn when moving it to the garbage (2x in a row, so seems to be a setting).
Note my remark on June 8, 2017: Big difference between chess_joints.txt and joints.txt is the more subtle closing around a pawn (6.3 instead of 0.0), not that big opening (28.9 instead of 30.0).
Also not that I use the ARM version of 27 July 2016, which is the same as the library used on May 11, 2017.
January 13, 2022
Copied the ZSB directories from tunis to nb-dual. Started sudo ./rtxd /dev/ttyUSB0, which seemed to work. tail /opt/prac/robotics/rtxipc/logs/rtxlog gave 2022-01-13 16:14:20 (RTXD) Restarting, listening to port 41743 on XPS-13-9300.
Starting /opt/prac/robotics/rtxipc/bin/rtxsh gave error while loading shared libraries: libreadline.so.6.
Installing this library following this suggestion works. sudo rtxsh can connect to the daemon.
The robot arm performed without problems soak init_soak, which I could stop with soak off.
January 12, 2022
On October 7, 2019 I used nb-ros and tunis to control the robot. Now I use nb-dual with the long serial controller (pl2303).
With dmesg | tail I see wlp0s20f3: associated
Made a directory ~/onderwijs/ZSB/assistance, but have to find the repository. The git on sbt is no longer available.
Connected the pl2303 via the USB-C to UBS-B converter. Now I get usb 3-4.4: pl2303 converter now attached to ttyUSB0.
Created the group rtxipc with sudo addgroup rtxipc and added myself as user to this group with sudo adduser.
Made the directory /opt/prac/robotics and changed the ownership.
Installed sudo apt install gnuchess.
Found the repository from 2017 and copied it to ZSB-python. Run the command python3 chessgame.py, which works fine (python2 interprets the command input differently).
Created a Readme and made the chess_engine assignment document with pdflatex main.tex.
January 7, 2022
Cognibus has now several tutorials to work with Jetson robots.