GithubHelp home page GithubHelp logo

sonyccd / roboclaw_ros Goto Github PK

View Code? Open in Web Editor NEW
46.0 9.0 89.0 52 KB

ros for roboclaw

License: BSD 2-Clause "Simplified" License

Python 86.52% CMake 13.48%
ros robotics roboclaw motor-controller

roboclaw_ros's Introduction

roboclaw_ros

Build Status Codacy Badge

This is the ROS driver for the Roboclaw motor controllers made by Ion Motion Control.

#HELP: I have been busy with another project that is not using robo claw. Message me if you want to become a contributer and help keep this thing alive!

Before you begin

Before you use this package you need to calibrate the velocity PID on the Roboclaw. This will requare the installation of the free software IonMotion (Windows only). You do not need to tune for position just velocity.

From the user manual:

IonMotion includes the option to autotune velocity and or position values. To use these options you should first make sure your encoder and motor are running in the correct direction and that basic PWM control of the motor works as expected. To do this go to the PWM Settings screen in IonMotion. Slide the motor slider up to start moving the motor forward. Check the encoder is increasing in value. If it is not either reverse the motor wires or the encoder wires.

If you are using autotune for Position control you must first set the motors QPPS value. Unlike Velocity autotune the QPPS value will not be automatically measured. This is because most position control systems have a limited range of movement. Once you have manually set the motors QPPS value(eg the maximum speed the motor can run at) you can continue with Position autotuning.

Then just click the autotune button for the motor you want to tune. The autotune function will try to determine the best settings for the motor. In the Velocity settings window it will autotune for velocity. In the Position Settings window you have the option to tune a simple PD position controller, a PID position controller or a cascaded Position/Velocity controller(PIV). The cascaded tune will determine both the velocity and position values for the motor but still requires the QPPS be manually set for the motor before starting. Autotune functions usually return reasonable values but in most cases you will still need to manually adjust them for optimum performance.

Usage

Just clone the repo into your catkin workspace. It contains the ROS package and the motor controller driver. Remmeber to make sure ROS has permisions to use the dev port you give it.

cd <workspace>/src
git clone https://github.com/sonyccd/roboclaw_ros.git
cd <workspace>
catkin_make
source devel/setup.bash
roslaunch roboclaw_node roboclaw.launch

Parameters

The launch file can be configure at the command line with arguments, by changing the value in the launch file or through the rosparam server.

Parameter Default Definition
dev /dev/ttyACM0 Dev that is the Roboclaw
baud 115200 Baud rate the Roboclaw is configured for
address 128 The address the Roboclaw is set to, 128 is 0x80
max_speed 2.0 Max speed allowed for motors in meters per second
ticks_per_meter 4342.2 The number of encoder ticks per meter of movement
base_width 0.315 Width from one wheel edge to another in meters

Topics

###Subscribed /cmd_vel (geometry_msgs/Twist)
Velocity commands for the mobile base. ###Published /odom (nav_msgs/Odometry)
Odometry output from the mobile base.

#IF SOMETHING IS BROEKN: Please file an issue, it makes it far easier to keep track of what needs to be fixed. It also allows others that might have solved the problem to contribute. If you are confused feel free to email me, I might have overlooked something in my readme.

roboclaw_ros's People

Contributors

kotaweav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roboclaw_ros's Issues

ROS problems connecting

Hi

my Roboclaw is connected via USB and it shows as (crw-rw---- 1 root dialout 166, 0 Mar 18 16:34 ttyACM0)

I had checked on the ionmc windows SW and I had set-up speed to be 115200,address 128, had setup and check both encoders and are working as should be.

but when I run the roboclaw_node I got this

core service [/rosout] found
process[roboclaw_node-1]: started with pid [6463]
process[diagnostic_aggregator-2]: started with pid [6464]
[FATAL] [WallTime: 1458318918.777312] Could not connect to Roboclaw
Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/core.py", line 402, in signal_shutdown
h()
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 290, in shutdown
roboclaw.ForwardM1(self.address, 0)
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 700, in ForwardM1
return _write1(address, Cmd.M1FORWARD, val)
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 335, in _write1
_sendcommand(address, cmd)
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 126, in _sendcommand
port.write(chr(address))
NameError: global name 'port' is not defined
[WARN] [WallTime: 1458318918.949848] Problem getting roboclaw version
Traceback (most recent call last):
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 304, in
node = Node()
File "/home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 171, in init
if not version[0]:
UnboundLocalError: local variable 'version' referenced before assignment
[roboclaw_node-1] process has died [pid 6463, exit code 1, cmd /home/user/ros/agitr/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py __name:=roboclaw_node __log:=/home/user/.ros/log/0fdfe700-ed27-11e5-8ac9-a0f3c11ea6b9/roboclaw_node-1.log].
log file: /home/user/.ros/log/0fdfe700-ed27-11e5-8ac9-a0f3c11ea6b9/roboclaw_node-1*.log
^C[diagnostic_aggregator-2] killing on exit

Issues launching roboclaw_node

Hey all,
So i've got the roboclaw_ros package built and running. Roboclaw plugged in over usb and powered / tested running. In the process of trying to pass some messages to the node I found some errors that came up in the roboclaw_node-1.log file.

I think the main takeaway that I have is that "Could not get version from roboclaw" means that the firmware may no longer be compatible.

If anyone has an idea of what might be going wrong id super appreciate any and all advice. Thanks so much in advance. Thank you @sonyccd for writing this node, it's really helpful to have a ROS node written already.

roboclaw_node-1.log file:
[rosout][INFO] 2019-02-11 15:39:51,365: Connecting to roboclaw
[rospy.internal][INFO] 2019-02-11 15:39:51,554: topic[/rosout] adding connection to [/rosout],
count 0
[rospy.internal][INFO] 2019-02-11 15:39:51,657: topic[/diagnostics] adding connection to [/diag
nostic_aggregator], count 0
[rosout][WARNING] 2019-02-11 15:39:51,704: Could not get version from roboclaw
[rosout][WARNING] 2019-02-11 15:39:52,397: Could not process inbound connection: topic types do
not match: [std_msgs/Int32] vs. [nav_msgs/Odometry]{'message_definition': 'int32 data', 'calle
rid': '/rosbridge_websocket', 'tcp_nodelay': '0', 'md5sum': 'da5909fbe378aeaf85e547e830cc1bb7',
'topic': '/odom', 'type': 'std_msgs/Int32'}
[rosout][INFO] 2019-02-11 15:39:53,389: Starting motor drive
[rosout][INFO] 2019-02-11 15:39:53,392: Did not get command for 1 second, stopping
[rosout][WARNING] 2019-02-11 15:39:53,418: Could not process inbound connection: topic types do
not match: [std_msgs/Int32] vs. [nav_msgs/Odometry]{'message_definition': 'int32 data', 'calle
rid': '/rosbridge_websocket', 'tcp_nodelay': '0', 'md5sum': 'da5909fbe378aeaf85e547e830cc1bb7',
'topic': '/odom', 'type': 'std_msgs/Int32'}
[rosout][WARNING] 2019-02-11 15:39:54,424: Could not process inbound connection: topic types do
not match: [std_msgs/Int32] vs. [nav_msgs/Odometry]{'message_definition': 'int32 data', 'calle
rid': '/rosbridge_websocket', 'tcp_nodelay': '0', 'md5sum': 'da5909fbe378aeaf85e547e830cc1bb7',

unable to check for odometry and telemetry data

I'm unable to see the /odom data when using the node, also it is not possible to see other status conditions from the controller (i.e battery status and Voltage, temperature) and to set up an E-stop signal

Getting "SpeedM1M2 OSError 11" and "ReadEncM1/2 OSError 11" and movement commands don't work

I was trying to get my teleop code running with roboclaw as motor controller but I got these warnings when launching the roboclaw.launch.
[WARN] [WallTime: 1472045242.277871] SpeedM1M2 OSError: 11
[WARN] [WallTime: 1472045242.376828] ReadEncM1 OSError: 11
[WARN] [WallTime: 1472045242.798931] ReadEncM2 OSError: 11
And of course I was unable to control my robot's wheels with no feedback. Is it the same problem causing the warnings? what could it be? And can such error occur when there is something wrong with the roboclaw's settings?
Any help would be appreciated.

Noetic support

Hi,

Has anyone succeeded in using the package in ROS Noetic on Ubuntu 20.04?

My roboclaw_node process dies during launch, and running the python file directly gives the following error:

TypeError: unicode strings are not supported, please encode to bytes: '\x80'

I suspect this has something to do with the python environment being Python 3.x and the lines containing port.write(chr()).

2 roboclaws?

Hi!

Thanks for this great work! This is not an issue with this repo... which works great to be honest!

I have a couple of questions if its possible to use this node to control 2 roboclaw boards... my robot has 4 wheels, 4 motors, 4 encoders and 2 roboclaw boards.

For a robot as follows:

[ a ]-------[ b ]
|..................... |
| .....................|
[ c ]-------[ d ]

I currently have one roboclaw controlling motor a and c, the other one controls b and d.

Of course if I use directly this node I can only control one side :P

what do you think?

Thanks a lot!!

Roboclaw _node process has died.

HI,
I am trying out the roboclaw with ros and i have sucessfully made it work with teleop_twist_keyboard and joy_teleop. The problem is that the Roboclaw_node dies after a while when i have the button "pressed in" or the joystick pressed in.

I get the following error:

process[rosout-1]: started with pid [14545]
started core service [/rosout]
process[roboclaw_node-2]: started with pid [14562]
process[diagnostic_aggregator-3]: started with pid [14563]
Traceback (most recent call last):
File "/home/nvidia/rfbot/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 305, in
node.run()
File "/home/nvidia/rfbot/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 232, in run
rospy.logdebug(" Encoders %d %d" % (enc1, enc2))
TypeError: %d format: a number is required, not NoneType
[roboclaw_node-2] process has died [pid 14562, exit code 1, cmd /home/nvidia/rfbot/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py __name:=roboclaw_node __log:=/home/nvidia/.ros/log/ae2a0626-c880-11e7-8a40-00044b8cfad9/roboclaw_node-2.log].
log file: /home/nvidia/.ros/log/ae2a0626-c880-11e7-8a40-00044b8cfad9/roboclaw_node-2*.log

any suggestions how to fix this?

Issue launching Roboclaw

I'm having issues when trying to run the robolcaw node. I'm using this roboclaw_ros package and haven't changed any of the source code. I get the follwing error:

[FATAL] [1592845100.478977]: Could not connect to Roboclaw
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 568, in signal_shutdown
h()
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_pyscript.py", line 318, in shutdown
roboclaw.ForwardM1(self.address, 0)
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 700, in ForwardM1
return _write1(address, Cmd.M1FORWARD, val)
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 335, in _write1
_sendcommand(address, cmd)
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/src/roboclaw_driver/roboclaw_driver.py", line 126, in _sendcommand
port.write(chr(address))
NameError: global name 'port' is not defined
[WARN] [1592845100.646772]: Problem getting roboclaw version
Traceback (most recent call last):
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_pyscript.py", line 332, in
node = Node()
File "/home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_pyscript.py", line 174, in init
if not version[0]:
UnboundLocalError: local variable 'version' referenced before assignment
[roboclaw_node-8] process has died [pid 8459, exit code 1, cmd /home/nano/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_pyscript.py __name:=roboclaw_node __log:=/home/nano/.ros/log/8e2cd43a-b4a9-11ea-93ad-00044be65023/roboclaw_node-8.log].
log file: /home/nano/.ros/log/8e2cd43a-b4a9-11ea-93ad-00044be65023/roboclaw_node-8*.log

I am able to see the driver when I type the command usb-devices into my terminal window.
usb_devices

Any input would be helpful in debugging this issue.

[Error] cmd: 59 failed crc_check

Hello,
I'm working on a robot using the Roboclaw card. The system worked properly but one of the motors bunred during some tests :-(
We tried to change it but, for an unkown reason, the roboclaw card stopped working. The motor and the roboclaw have been changed.
Know when we launch ROS, we encounter the following error:

[ERROR]: ...... :cmd : 59 failed crc_check.

We have configured the roboclaw the microbasic application with the right parameters (got from the config of another same setting).

If you could help :-)
Thank's a lot !

Who wants to contribute to this?

I have been really busy with several other projects that are not using the robot claw and it's hard to find time to work on this. This needed to keep being developed. Would someone like to join as a contributor ?

Error while launching the driver

I have cloned the package and executed catkin_make successfully. When i launched the driver with the command $ roslaunch roboclaw_node roboclaw.launch, i got the below error. How to fix this error?

Traceback (most recent call last):
  File "/home/kishore/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 6, in <module>
    import roboclaw_driver.roboclaw_driver as roboclaw
ImportError: No module named roboclaw_driver.roboclaw_driver
[roboclaw_node-2] process has died [pid 9110, exit code 1, cmd /home/kishore/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py __name:=roboclaw_node __log:=/home/kishore/.ros/log/8f624f98-6aa5-11e7-86c7-3c77e651e7b9/roboclaw_node-2.log].
log file: /home/kishore/.ros/log/8f624f98-6aa5-11e7-86c7-3c77e651e7b9/roboclaw_node-2*.log

How do you calculate that ticks per meter defined in the launch file.

The ticks per meter defined in the launch file is the fixed number we need to use or we need to calculate it for our own case. If we need to calculate it for our case, how to do that. I am confused because I am not able to understand how do these ticks coming from the encoders related to the PPR or CPR given for that particular motor. The motor I am using is the gobilda motor. Please can I know how to do it?

Thanks

TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'**

Hi,
When i run the roboclaw ros package to control the speed of the motor i get the following error.

File "/home/dhanraj/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py", line 77, in ## update_publish
if abs(enc_left - self.last_enc_left) > 20000:
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

[roboclaw_node-1] process has died [pid 10701, exit code 1, cmd /home/dhanraj/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py __name:=roboclaw_node __log:=/home/dhanraj/.ros/log/576dcfaa-ebe6-11e7-9751-74e543172118/roboclaw_node-1.log].
log file: /home/dhanraj/.ros/log/576dcfaa-ebe6-11e7-9751-74e543172118/roboclaw_node-1*.log

When i run the scripts the motors does not movie at all and i get the above error after the script has run for couple of minutes. Any help on this is appreciated.

regards
Dhanraj

Bugfixes

Hey,

We used your driver in our teaching project and found some bugs.
I can't make a PR because the commits to make your software work on our robots are mixed with bugfixing commits.
So, here's just a list of commits that you might want to cherry-pick:

8c4513d
8d4054e
0a95f8b

The last commit also includes a possibility to invert the motors, in case they are wired differently. It's an extra feature but it also includes a bugfix. The line 0a95f8b#diff-c00ddbd0620c770bb87191dbe474030cL231 is wrong, you can't use if enc1 in locals() to check if a variable has value. So if you don't want the feature I would at least get rid of this line.

Cheers and thanks for providing this!
Gaya

Connect driver

Hi,
I get problem to connect in jetson nano
[FATAL] [1621933180.991824]: Could not connect to Roboclaw

please help

motors keep accelerating instead of constant velocity

Hello,

I'm currently sending this command but the motors keep accelerating.

rostopic pub -r 0.5 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.1, y: 0.0, z: 0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

Which values should i send to maintain constant velocity?

Thank you!

I just damaged my new roboclaw 2x45A controller by launching this file

It is useless now and here is what I did,

I have opened the windows app and limited the max I to 50 for protection.
Checked P I D parameters. They were all 0.
Then cloned the repo.
Connected the computer via usb.
Started roslaunch roboclaw_node roboclaw.launch
Firstly motor 1 started to run in full pwm,
Then motor 2 started to run in full pwm and instantly changed direction
Because of the inertia, the controller died even Motors were in neutral.
It was the weirdest thing that I have experience. No idea what the launch file did.
There was not encoders only motors without touching ground.

Anyway, does anybody know why? I have just buy a 2x60A roboclaw and I certainly do not want to damage this one too.

TypeError: %d format: a number is required, not NoneType

Hi,
I was trying to run your roboclaw node. During launcing, I got the following error:

[ WARN] [1644700619.659559738]: Analyzer specification should now include the package name. You are using a deprecated API. Please switch from GenericAnalyzer to diagnostic_aggregator/GenericAnalyzer in your Analyzer specification.
[WARN] [1644700622.220984]: Could not get version from roboclaw
Traceback (most recent call last):
  File "/home/ecl/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_[node.py](https://node.py/)", line 305, in <module>
    [node.run](https://node.run/)()
  File "/home/ecl/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_[node.py](https://node.py/)", line 232, in run
    rospy.logdebug(" Encoders %d %d" % (enc1, enc2))
TypeError: %d format: a number is required, not NoneType
[roboclaw_node-1] process has died [pid 24989, exit code 1, cmd /home/ecl/catkin_ws/src/roboclaw_ros/roboclaw_node/nodes/roboclaw_node.py __name:=roboclaw_node __log:=/home/ecl/.ros/log/ea28366e-8c37-11ec-9748-401c83808469/roboclaw_node-1.log].
log file: /home/ecl/.ros/log/ea28366e-8c37-11ec-9748-401c83808469/roboclaw_node-1*.log

We are kind of stuck. Any solution would help. Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.