A little help to finish my hexapod
30 Jun 2018 18:31 #113139
by topone
A little help to finish my hexapod was created by topone
Hi everyone, I hope to have posted in the right section.
I'm trying to build a hexapod. I've finished the mechanical part but now I need help with the software.
I have used stepper motors and I have already tested the connections, the movements of the single axes are ok.
I generated a hexapod cnc with LinuxCNC config Picker. The generated cnc does not use stepper motors. I would like to change the hal file manually to drive the six stepper motors through two parallel ports.
I hope I have explained well, English is not my native language.
thanks in advance
I'm trying to build a hexapod. I've finished the mechanical part but now I need help with the software.
I have used stepper motors and I have already tested the connections, the movements of the single axes are ok.
I generated a hexapod cnc with LinuxCNC config Picker. The generated cnc does not use stepper motors. I would like to change the hal file manually to drive the six stepper motors through two parallel ports.
I hope I have explained well, English is not my native language.
thanks in advance
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19203
- Thank you received: 6436
01 Jul 2018 08:24 #113160
by tommylight
That is fairly easy to do, you need to make 6 sections one for each Joint/Axis with the same entries as the one that worked for you and change only the parts that refer to the Joints or Axis. As a rule in Linuxcnc you have the stepgens and feedbacks for each Joint/Axis that need to be changed something like
stepgen.0. <<<<<is for Joint 0 or X Axis
stepget.1. <<<<<is Joint 1 or Y Axis
and so on. the same goes for position and feedback.
Also you would need to set the "scale" accordingly.
Replied by tommylight on topic A little help to finish my hexapod
What is your native language ?Hi everyone, I hope to have posted in the right section.
I'm trying to build a hexapod. I've finished the mechanical part but now I need help with the software.
I have used stepper motors and I have already tested the connections, the movements of the single axes are ok.
I generated a hexapod cnc with LinuxCNC config Picker. The generated cnc does not use stepper motors. I would like to change the hal file manually to drive the six stepper motors through two parallel ports.
I hope I have explained well, English is not my native language.
thanks in advance
That is fairly easy to do, you need to make 6 sections one for each Joint/Axis with the same entries as the one that worked for you and change only the parts that refer to the Joints or Axis. As a rule in Linuxcnc you have the stepgens and feedbacks for each Joint/Axis that need to be changed something like
stepgen.0. <<<<<is for Joint 0 or X Axis
stepget.1. <<<<<is Joint 1 or Y Axis
and so on. the same goes for position and feedback.
Also you would need to set the "scale" accordingly.
The following user(s) said Thank You: Todd Zuercher
Please Log in or Create an account to join the conversation.
01 Jul 2018 11:31 #113162
by topone
Replied by topone on topic A little help to finish my hexapod
Hi tommylight and thank for the reply.
My native language is Italian.
I inserted these instructions in the core_sim_6.hal file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD num_joints=[TRAJ]AXES
instead of
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD num_joints=[TRAJ]AXES
# hook its functions to realtime threads
addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
# connect signals to step pulse generator outputs
net Xstep stepgen.0.step
net Xdir stepgen.0.dir
net Ystep stepgen.1.step
net Ydir stepgen.1.dir
net Zstep stepgen.2.step
net Zdir stepgen.2.dir
net Astep stepgen.3.step
net Adir stepgen.3.dir
net Bstep stepgen.4.step
net Bdir stepgen.4.dir
net Cstep stepgen.5.step
net Cdir stepgen.5.dir
I inserted these instruction in the core_sim_6.hal file
POSTGUI_HALFILE = hexapod_postgui.hal
and here the hexapod_postgui.hal
loadrt hal_parport cfg="0x0378 0xc050"
addf parport.0.read base-thread 1
addf parport.1.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.write base-thread -1
net Xstep parport.0.pin-02-out
net Xdir parport.0.pin-03-out
net Ystep parport.1.pin-06-out
net Ydir parport.1.pin-07-out
net Zstep parport.0.pin-06-out
net Zdir parport.0.pin-07-out
net Astep parport.0.pin-08-out
net Adir parport.0.pin-09-out
net Bstep parport.1.pin-02-out
net Bdir parport.1.pin-03-out
net Cstep parport.1.pin-04-out
net Cdir parport.1.pin-05-out
The program starts correctly but I have no signal on the parallel port. I've probably missed something but I don't understand what.
My native language is Italian.
I inserted these instructions in the core_sim_6.hal file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD num_joints=[TRAJ]AXES
instead of
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD num_joints=[TRAJ]AXES
# hook its functions to realtime threads
addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
# connect signals to step pulse generator outputs
net Xstep stepgen.0.step
net Xdir stepgen.0.dir
net Ystep stepgen.1.step
net Ydir stepgen.1.dir
net Zstep stepgen.2.step
net Zdir stepgen.2.dir
net Astep stepgen.3.step
net Adir stepgen.3.dir
net Bstep stepgen.4.step
net Bdir stepgen.4.dir
net Cstep stepgen.5.step
net Cdir stepgen.5.dir
I inserted these instruction in the core_sim_6.hal file
POSTGUI_HALFILE = hexapod_postgui.hal
and here the hexapod_postgui.hal
loadrt hal_parport cfg="0x0378 0xc050"
addf parport.0.read base-thread 1
addf parport.1.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.write base-thread -1
net Xstep parport.0.pin-02-out
net Xdir parport.0.pin-03-out
net Ystep parport.1.pin-06-out
net Ydir parport.1.pin-07-out
net Zstep parport.0.pin-06-out
net Zdir parport.0.pin-07-out
net Astep parport.0.pin-08-out
net Adir parport.0.pin-09-out
net Bstep parport.1.pin-02-out
net Bdir parport.1.pin-03-out
net Cstep parport.1.pin-04-out
net Cdir parport.1.pin-05-out
The program starts correctly but I have no signal on the parallel port. I've probably missed something but I don't understand what.
Please Log in or Create an account to join the conversation.
02 Jul 2018 16:07 #113240
by andypugh
Replied by andypugh on topic A little help to finish my hexapod
I don't think that any of your parport config belongs in the postgui halfile.
I think you should move it all in to the main HAL file. (Though it ought to work as it is, but the postgui halfile is only really for connecting pins that only exist after the GI is loaded).
linuxcnc.org/docs/2.7/html/man/man9/stepgen.9.html
I suspect that you have neglected to connect the stepgen.N.enable pins (typically to axis.N.amp-enable)
You also need to set the stepgen.N.scale to the correct number of steps-per-mm
And I would suggest that switching to the development version of LinuxCNC would be a good idea as it is better with complex kinematics. (It has better logical separation between the concepts of mechanical actuators (joints) and cartesian positions (axes)
I think you should move it all in to the main HAL file. (Though it ought to work as it is, but the postgui halfile is only really for connecting pins that only exist after the GI is loaded).
linuxcnc.org/docs/2.7/html/man/man9/stepgen.9.html
I suspect that you have neglected to connect the stepgen.N.enable pins (typically to axis.N.amp-enable)
You also need to set the stepgen.N.scale to the correct number of steps-per-mm
And I would suggest that switching to the development version of LinuxCNC would be a good idea as it is better with complex kinematics. (It has better logical separation between the concepts of mechanical actuators (joints) and cartesian positions (axes)
Please Log in or Create an account to join the conversation.
02 Jul 2018 21:18 #113256
by topone
Replied by topone on topic A little help to finish my hexapod
I made a mistake, I'm sorry. I have not changed the POSTGUI_HALFILE = hexapod_postgui.hal but the core_sim_6.hal file
I have inserted this line HALFILE = standard_pinout.hal
here the standard_pinout.hal
loadrt hal_parport cfg="0x0378 0xc050"
addf parport.0.read base-thread 1
addf parport.1.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.write base-thread -1
#
net Xstep parport.0.pin-02-out
net Xdir parport.0.pin-03-out
net Ystep parport.1.pin-06-out
net Ydir parport.1.pin-07-out
net Zstep parport.0.pin-06-out
net Zdir parport.0.pin-07-out
net Astep parport.0.pin-08-out
net Adir parport.0.pin-09-out
net Bstep parport.1.pin-02-out
net Bdir parport.1.pin-03-out
net Cstep parport.1.pin-04-out
net Cdir parport.1.pin-05-out
Then I made the changes suggested by tommylight and andypugh
net Xen <= axis.0.amp-enable-out
net Xen => stepgen.0.enable
Now the engines are moving. Remains to fix the scale and other parameters but this is a great step ahead for me.
thanks to everyone for your help
I have inserted this line HALFILE = standard_pinout.hal
here the standard_pinout.hal
loadrt hal_parport cfg="0x0378 0xc050"
addf parport.0.read base-thread 1
addf parport.1.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.write base-thread -1
#
net Xstep parport.0.pin-02-out
net Xdir parport.0.pin-03-out
net Ystep parport.1.pin-06-out
net Ydir parport.1.pin-07-out
net Zstep parport.0.pin-06-out
net Zdir parport.0.pin-07-out
net Astep parport.0.pin-08-out
net Adir parport.0.pin-09-out
net Bstep parport.1.pin-02-out
net Bdir parport.1.pin-03-out
net Cstep parport.1.pin-04-out
net Cdir parport.1.pin-05-out
Then I made the changes suggested by tommylight and andypugh
net Xen <= axis.0.amp-enable-out
net Xen => stepgen.0.enable
Now the engines are moving. Remains to fix the scale and other parameters but this is a great step ahead for me.
thanks to everyone for your help
Please Log in or Create an account to join the conversation.
15 Jul 2018 11:19 #114211
by topone
Replied by topone on topic A little help to finish my hexapod
Hi everyone
Finally my machine works but I notice a strange behavior.
The movements along the X and Y axes are correct, the movement is linear and precise and in the right direction.
The problem is movement along the Z axis and rotation along the axes.
The long Z-movement is reversed, i.e. if I execute the command G0 X10 ( mm) the machine moves 10 mm downwards, if -10 upwards.
Also, if I run the G0 A5 command I have a rotation of 5 degrees but in the opposite direction from the right hand rule. The same thing for the long Y rotation, i.e. G0 B5.
When I perform a movement along the X or the Y axis the motion is correct and because all six motors contribute to this movements I exclude that the problem can be due to wrong electrical connections or wrong controls that reverse the direction.
I made these changes to the measurements to adapt them to the size of my machine:
INI files
HOME = 0 0 180 0 0 0
LINEAR_UNITS = mm
# The same for all axes
[AXIS_0]
TYPE = LINEAR
HOME = 241.48
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 200.0
STEPGEN_MAXVEL = 100
STEPGEN_MAXACCEL = 937.5
BACKLASH = 0.000
INPUT_SCALE = 4000
SCALE = 200.0
OUTPUT_SCALE = 1.000
MIN_LIMIT = -1000.0
MAX_LIMIT = 1000.0
FERROR = 2.000
MIN_FERROR = 0.200
HOME_OFFSET= 241.48
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
kinematics.hal
# Base joints positions in base (world) coordinates
setp genhexkins.base.0.x 144.887
setp genhexkins.base.0.y 155.954
setp genhexkins.base.0.z 0.000
setp genhexkins.base.1.x 207.504
setp genhexkins.base.1.y 47.4988
setp genhexkins.base.1.z 0.000
setp genhexkins.base.2.x 62.6175
setp genhexkins.base.2.y -203.453
setp genhexkins.base.2.z 0.000
setp genhexkins.base.3.x -62.6175
setp genhexkins.base.3.y -203.453
setp genhexkins.base.3.z 0.000
setp genhexkins.base.4.x -207.504
setp genhexkins.base.4.y 47.4988
setp genhexkins.base.4.z 0.000
setp genhexkins.base.5.x -144.887
setp genhexkins.base.5.y 155.954
setp genhexkins.base.5.z 0.000
# Platform joints positions in platform coordinates
setp genhexkins.platform.0.x 15.00
setp genhexkins.platform.0.y 51.9615
setp genhexkins.platform.0.z 0.000
setp genhexkins.platform.1.x 52.5
setp genhexkins.platform.1.y -12.9904
setp genhexkins.platform.1.z 0.000
setp genhexkins.platform.2.x 37.5
setp genhexkins.platform.2.y -38.9711
setp genhexkins.platform.2.z 0.000
setp genhexkins.platform.3.x -37.5
setp genhexkins.platform.3.y -38.9711
setp genhexkins.platform.3.z 0.000
setp genhexkins.platform.4.x -52.5
setp genhexkins.platform.4.y -12.9904
setp genhexkins.platform.4.z 0.000
setp genhexkins.platform.5.x -15.0
setp genhexkins.platform.5.y 51.9615
setp genhexkins.platform.5.z 0.000
Any ideas?
tanks in advance
Finally my machine works but I notice a strange behavior.
The movements along the X and Y axes are correct, the movement is linear and precise and in the right direction.
The problem is movement along the Z axis and rotation along the axes.
The long Z-movement is reversed, i.e. if I execute the command G0 X10 ( mm) the machine moves 10 mm downwards, if -10 upwards.
Also, if I run the G0 A5 command I have a rotation of 5 degrees but in the opposite direction from the right hand rule. The same thing for the long Y rotation, i.e. G0 B5.
When I perform a movement along the X or the Y axis the motion is correct and because all six motors contribute to this movements I exclude that the problem can be due to wrong electrical connections or wrong controls that reverse the direction.
I made these changes to the measurements to adapt them to the size of my machine:
INI files
HOME = 0 0 180 0 0 0
LINEAR_UNITS = mm
# The same for all axes
[AXIS_0]
TYPE = LINEAR
HOME = 241.48
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 200.0
STEPGEN_MAXVEL = 100
STEPGEN_MAXACCEL = 937.5
BACKLASH = 0.000
INPUT_SCALE = 4000
SCALE = 200.0
OUTPUT_SCALE = 1.000
MIN_LIMIT = -1000.0
MAX_LIMIT = 1000.0
FERROR = 2.000
MIN_FERROR = 0.200
HOME_OFFSET= 241.48
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
kinematics.hal
# Base joints positions in base (world) coordinates
setp genhexkins.base.0.x 144.887
setp genhexkins.base.0.y 155.954
setp genhexkins.base.0.z 0.000
setp genhexkins.base.1.x 207.504
setp genhexkins.base.1.y 47.4988
setp genhexkins.base.1.z 0.000
setp genhexkins.base.2.x 62.6175
setp genhexkins.base.2.y -203.453
setp genhexkins.base.2.z 0.000
setp genhexkins.base.3.x -62.6175
setp genhexkins.base.3.y -203.453
setp genhexkins.base.3.z 0.000
setp genhexkins.base.4.x -207.504
setp genhexkins.base.4.y 47.4988
setp genhexkins.base.4.z 0.000
setp genhexkins.base.5.x -144.887
setp genhexkins.base.5.y 155.954
setp genhexkins.base.5.z 0.000
# Platform joints positions in platform coordinates
setp genhexkins.platform.0.x 15.00
setp genhexkins.platform.0.y 51.9615
setp genhexkins.platform.0.z 0.000
setp genhexkins.platform.1.x 52.5
setp genhexkins.platform.1.y -12.9904
setp genhexkins.platform.1.z 0.000
setp genhexkins.platform.2.x 37.5
setp genhexkins.platform.2.y -38.9711
setp genhexkins.platform.2.z 0.000
setp genhexkins.platform.3.x -37.5
setp genhexkins.platform.3.y -38.9711
setp genhexkins.platform.3.z 0.000
setp genhexkins.platform.4.x -52.5
setp genhexkins.platform.4.y -12.9904
setp genhexkins.platform.4.z 0.000
setp genhexkins.platform.5.x -15.0
setp genhexkins.platform.5.y 51.9615
setp genhexkins.platform.5.z 0.000
Any ideas?
tanks in advance
Please Log in or Create an account to join the conversation.
15 Jul 2018 11:39 #114212
by andypugh
Replied by andypugh on topic A little help to finish my hexapod
Try making the motors all run the other way.
(probably SCALE -200 in the INI)
This might also mirror the motion. But is the easiest thing to check first.
It might be a problem with the kins, which is probably designed for a platform (actuators below table)
(probably SCALE -200 in the INI)
This might also mirror the motion. But is the easiest thing to check first.
It might be a problem with the kins, which is probably designed for a platform (actuators below table)
Please Log in or Create an account to join the conversation.
15 Jul 2018 14:14 #114217
by topone
Replied by topone on topic A little help to finish my hexapod
I have inverted SCALE from 200 to -200 to all the motors and all movements are inverted. I mean that X and Y now go on wrong direction and Z axes displacement and rotation A and B are correct.
I have even check that with the right scale value (200) the axes' Z rotation is correct, so G0 C5 the rotation is correct as the rule of the right hand.
I have even check that with the right scale value (200) the axes' Z rotation is correct, so G0 C5 the rotation is correct as the rule of the right hand.
Please Log in or Create an account to join the conversation.
15 Jul 2018 15:17 #114220
by topone
Replied by topone on topic A little help to finish my hexapod
Another thing, my configuration is like this,
1)
and not like this
2)
In case 1) an increase of Z causes an upward movement and the links shorten, while in case 2) the same displacement cause a links lengthen.
How can I know what kind of configuration is working? Base and platform coordinates do not contain informations about the Z position of the axes' origin.
It is indicated only the distance (Z) between the platforms.
HOME = 0 0 180 0 0 0
180 is the distance between base and platform
# Base joints positions in base (world) coordinates
setp genhexkins.base.0.x 144.887
setp genhexkins.base.0.y 155.954
setp genhexkins.base.0.z 0.000
# Platform joints positions in platform coordinates
setp genhexkins.platform.0.x 15.00
setp genhexkins.platform.0.y 51.9615
setp genhexkins.platform.0.z 0.000
1)
and not like this
2)
In case 1) an increase of Z causes an upward movement and the links shorten, while in case 2) the same displacement cause a links lengthen.
How can I know what kind of configuration is working? Base and platform coordinates do not contain informations about the Z position of the axes' origin.
It is indicated only the distance (Z) between the platforms.
HOME = 0 0 180 0 0 0
180 is the distance between base and platform
# Base joints positions in base (world) coordinates
setp genhexkins.base.0.x 144.887
setp genhexkins.base.0.y 155.954
setp genhexkins.base.0.z 0.000
# Platform joints positions in platform coordinates
setp genhexkins.platform.0.x 15.00
setp genhexkins.platform.0.y 51.9615
setp genhexkins.platform.0.z 0.000
Please Log in or Create an account to join the conversation.
16 Jul 2018 10:06 #114285
by andypugh
Well, that's a start..
You could now try switching the sign of the X or Y coordinates. (though I suspect that would mess up the rotations).
I don't know if you have looked at the source code, there are some fairly good comments:
github.com/LinuxCNC/linuxcnc/blob/master...ematics/genhexkins.c
I can't immediately see how the kinematic can tell whether it is controlling a platform-up or platform-down arrangement.
Replied by andypugh on topic A little help to finish my hexapod
I have inverted SCALE from 200 to -200 to all the motors and all movements are inverted. I mean that X and Y now go on wrong direction and Z axes displacement and rotation A and B are correct..
Well, that's a start..
You could now try switching the sign of the X or Y coordinates. (though I suspect that would mess up the rotations).
I don't know if you have looked at the source code, there are some fairly good comments:
github.com/LinuxCNC/linuxcnc/blob/master...ematics/genhexkins.c
I can't immediately see how the kinematic can tell whether it is controlling a platform-up or platform-down arrangement.
Please Log in or Create an account to join the conversation.
Time to create page: 0.182 seconds