Menu

Topic-icon Control robot with 2 XDC2460S + RoboCAN

More
3 years 8 months ago - 3 years 8 months ago #29531884 by slloyd
I'm using two roboteq XDC2460S to drive two motors of a a large robot in 'tank style' configuration. I understand that i need to configure a master/slave relationship and that the master will provide the mixing of RC commands and communicate to the second controller via CANbus.

The wiring on DB15, do i wire directly pin 6 of controller 1 to pin 6 of controller 2? same for pin 7. using twisted pair. distance is very short in my case.

"RoboCAN" is not a word that appears in the 244 page manual. where can i get info on what i need to know in order to configure roboteqs for my application? other than the two sources below, is there anything else i need to know?

dev.roboteq.com/dev1/index.php/component...l-robots?Itemid=1208

dev.roboteq.com/dev1/index.php/technology-menu/296-robocan

Next question - we are running in torque control mode using external current sensors. Do I run BOTH current sensors back to one roboteq (master), or one per roboteq?

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #29531888 by niko
Hello,

The CAN bus requires additionally a resistor between CANL and CANH.

The documentation you provided is all we have and all you need in order to have the controllers communicate via RoboCAN.

Concerning the sensor, If you write a script that will implement the closed loop in one controller for both motors then you need to connect both sensors in this controller. If you use one script in each controller, or use the built-in closed loop featur (see manual, Torque Mode Using an External Amps Sensor, p.109) you connect each sensor to the respective controller. I would choose the latter if I were you.
The following user(s) said Thank You: slloyd

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #29531890 by slloyd
Excellent, and thanks for reminder of termination resistor, i forgot about that (figure 60 in manual).

let's say that master roboteq decides by virtue of some script that there needs to be a change in amp limit. one could write:
setconfig(_ALIM, 500)

and all will be well.
but how does Master roboteq tell Slave roboteq to do the same thing? this would have to be via CAN, would the script code look like this?:
@02_ALIM 500

could both lines above be replaced with this single:
@00_ALIM 500

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #29531891 by niko
As stated in the links you mentioned above, for the command you require it should be:
- for console:
@02^ALIM 500 for unicast to node 2.
@00^ALIM 500 for broadcast.
- for scripting:
setCANCommand(02, _ALIM, 500)

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #29531905 by slloyd
lets say i have Master Roboteq configuration set to Mix 1 (does this even have meaning in a single channel controller??) my RC receiver channel 1 and 2 are both wired to only the Master. so The master Roboteq will take the commands and will drive one motor (which was proven) but to get it to use its already calculated command for the other separate tank style motor it has to send this command via Canbus? and this can only be done within the script? so i suppose it would be good if the script's wait time were set to 0.

what is the name of the variable that is for motor power to be sent to canbus?

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #29531909 by niko
Mixed Mode in single channel has no meaning.
What you can do is to write a script that implementes mixed mode and apply the motor commands locally for one motor and via RoboCAN for the other motor.

Advise the user manual for the syntax of the commands.
The following user(s) said Thank You: slloyd

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #29531910 by slloyd
i thought it might have meaning because motor was doing something when in mixed mode. ok, i go to separate mode and make the RC mixing via script.

Master = Canbus Node 1
Slave = Canbus Node 2

Master has to set speeds by sending _G commands to Slave at Node 2
Slave has to listen to Master at Node 1

normally one would make these selections in the configuration window and download to device. but when i make the selection and download it crashes, (i have a ticket in with Cosma). But i am under timeline, so i post here also my questions to resolve this issue. since it crashes from configuration window but seems to not crash when setting configurations via scripts. so now i am writing a huge script to make ALL the configurations... including the canbus. but i'm not sure what the syntax is for canbus configuration. all other configurations i think i found in the manual, but canbus. Can you please advise the syntax for CanBus configuraiton options? i can not find how to set IN SCRIPT canbus enable, rate, id, listen node etc.

ps. on crash issue, i cycled power many times. i re-flashed firmware. did not solve.

Please Log in or Create an account to join the conversation.

  • roboteq
  • roboteq's Avatar
3 years 8 months ago #29531913 by roboteq
Replied by roboteq on topic Control robot with 2 XDC2460S + RoboCAN
The code below (untested) recreates the mixing mode 1 and drives a local and a remote motor. Remote is node address 5 in this example

option explicit

dim ThrottleCmd as integer
dim SteeringCmd as integer

dim Motor_Speed_Right as integer
dim Motor_Speed_Left as integer

top:

ThrottleCmd = getvalue(_PIC, 1) ' Read throttle from Pulse input connected to throttle channel
SteeringCmd = getvalue(_PIC, 2) ' Read throttle from Pulse input connected to steering channel

' Mixing algorithm
Motor_Speed_Right = ThrottleCmd
Motor_Speed_Left = ThrottleCmd
Motor_Speed_Left -= SteeringCmd
Motor_Speed_Right += SteeringCmd

' Cap results within -1000 and +1000
if ( Motor_Speed_Left > 1000) then Motor_Speed_Left = 1000
if ( Motor_Speed_Left < -1000) then Motor_Speed_Left = -1000
if ( Motor_Speed_Right > 1000) then Motor_Speed_Right = 1000
if ( Motor_Speed_Right < -1000) then Motor_Speed_Right = -1000

' Apply to motors
setcommand(_G, 1, Motor_Speed_Left) ' Local controller
setcancommand(5, _G, 1, Motor_Speed_Right) ' Slave controller via RoboCAN

wait(10)
goto top

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #29531914 by slloyd
thanks, it was the "_PIC" variable i did not know. your script is just what i need.

however, as i emailed blake & cosma, i have trouble setting Canbus parameters on slave roboteq because download from configuration window causes an unrecoverable crash. seems however that i can download from Script.. so .. i need to know how to make all the Canbus parameter syntax from script in RoboCan format (rate, id, listen node, heartbeat). can you help with that? I looked at manual and two links at top of this thread and all i could find is that maybe setting canbus ID would be like this: setconfig(_CanID, 5) ?

Update, by random trial and error i discovered two of the seven Canbus config:
CNOD = canbus Node
CLSN = canbus Listen Node

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #29531917 by niko
When you configure in configuration tree and press save then move to console tab and you will see the respective commands. Adding a _ before is ready for use in script (e.g. CNOD can be used as setconfig(_CNOD, 1))

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.114 seconds
Go to top